最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - How to add H1 Tag on Homepage?

programmeradmin1浏览0评论

I am using child theme of rehub theme to create a website. Just like many other themes it has option of "static homepage" and "recent posts" homepage. As my theme is a deal based theme I have to use "recent posts" options.

But, due to this the home page is missing H1 tag because there is no tag by default in the theme. I have no experience of php coding, so please help me in adding H1 tag on the homepage. The site link is - www.top20deals

Code of header.php from main rehub theme is as follows -

    <head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<!-- feeds & pingback -->
<link rel="profile" href="" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]><script src="<?php echo get_template_directory_uri(); ?>/js/html5shiv.js"></script><![endif]-->    
<?php wp_head(); ?>
<?php if(rehub_option('rehub_custom_css')) : ?><style><?php echo rehub_option('rehub_custom_css'); ?></style><?php endif; ?>
</head>

I am using child theme of rehub theme to create a website. Just like many other themes it has option of "static homepage" and "recent posts" homepage. As my theme is a deal based theme I have to use "recent posts" options.

But, due to this the home page is missing H1 tag because there is no tag by default in the theme. I have no experience of php coding, so please help me in adding H1 tag on the homepage. The site link is - www.top20deals

Code of header.php from main rehub theme is as follows -

    <head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<!-- feeds & pingback -->
<link rel="profile" href="http://gmpg/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]><script src="<?php echo get_template_directory_uri(); ?>/js/html5shiv.js"></script><![endif]-->    
<?php wp_head(); ?>
<?php if(rehub_option('rehub_custom_css')) : ?><style><?php echo rehub_option('rehub_custom_css'); ?></style><?php endif; ?>
</head>
Share Improve this question edited Nov 8, 2016 at 20:01 bravokeyl 3,3776 gold badges27 silver badges33 bronze badges asked Nov 8, 2016 at 19:53 Rahul OberoiRahul Oberoi 51 silver badge4 bronze badges 2
  • What do you want H1 tag to be? This also might be a little not trivial for dynamic data if theme is doing anything "creative" with front page. – Rarst Commented Nov 8, 2016 at 20:06
  • For H1 Tag - "Top Shopping & Travel Deals". While checking SEO, I found out that it is must for google, bing and other search engines. – Rahul Oberoi Commented Nov 8, 2016 at 20:08
Add a comment  | 

2 Answers 2

Reset to default 0

For H1 Tag - "Top Shopping & Travel Deals".

Since you just want it static just adding <h1>Top Shopping & Travel Deals</h1> to a template is not hard.

The likely hard part is determining which template is right place for it. You can consult with template hierarchy and check which templates theme has and which of them you would need to override in your child theme to get a proper result. You might need to create a new template, based on existing one to target necessary context precisely.

Whats about this in your Index.php:

<?php if ( is_home() && ! is_front_page() ) : ?>
        <h1>YOUR TEXT</h1>
<?php endif; ?>
发布评论

评论列表(0)

  1. 暂无评论