How to fix header.php for better SEO?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5708 Reply
    Alex
    Guest

    I am trying Frontier theme on my new blog http://malware-detective.com/. It is great. However, there is a problem that SEO evaluation apps and Webmasters tools point to. I need to add description tag to my homepage and alt to my logo image. <H1> should be present on each page. So, I need some function in header.php to set <H1> tag conditionaly, depend on Home or Post page types. How can I do this? I think that these common problems solutions incorporated in Frontier theme will make it one of the greatest and most used WordPress themes on the web.

    #5712
    Ron
    Keymaster

    Frontier already has an H1 tag, the Site Title. But it looks like you disabled it.
    Go to Frontier Options -> Display -> Top Bar

    Enable Site Title (which has the H1 tag) and disable Site Description.

    You can then control what is displayed on the title by using this filter. Add this code on a child-theme functions.php

    function frontier_top_bar_title_text() {
       return 'Malware Removal & Advanced PC Protection';
    }
    add_filter( 'frontier_top_bar_title', 'frontier_top_bar_title_text' );

    If you need even more control then you can disable both Title and Description and use the action “frontier_before_top_bar” where you can output anything you want.

    #5713
    Ron
    Keymaster

    By description tag you mean the meta description on the <head> right? That can’t be added to the theme since that is a plugin territory functionality and is against wordpress.org’s theme guidelines. You can simply use any SEO plugin like Yoast.

    For the alt value on the logo, I’ve already added a default value for the next update. If you want more control you can either edit header.php or disable the logo and add a Text Widget on your header area where you can add your own logo markup.

    #5717
    Alex
    Guest

    I forgot to mention the idea suggested for SEO complience. For Homepage the site title is H1, and for Post pages it is H2 while the Post headline is H1 tag.

    #5718
    Ron
    Keymaster

    Like I said on my reply, for more control you can use the frontier_before_top_bar action to output anything. Disable both Top Bar Title and Description then on a child-theme functions.php add the example below.

    Example:

    function ra_top_bar_text() {
       $tag = is_front_page() ? 'h1' : 'h2' ;
       echo '<' . $tag . ' id="site-description">Your Text</' . $tag . '>';
    }
    add_action( 'frontier_before_top_bar', 'ra_top_bar_text' );
    #5725
    Alex
    Guest

    Thank you very much, Ron. I think it should work when I will set a child to Frontier theme. Actually, I started with a child theme because I needed many custom things, but I dropped this idea after some update with elements’ names changes. I just got lost in code, dropped the child, and started all over with custom CSS instead. Now, I afraid to update theme on the site before I will test it on a local server. Where can I find the information on details of consequent Frontier updates? It will help to adjust child theme as needed.

    Thank you again for your quick response and clear explanation.

    #5726
    Ron
    Keymaster

    Where can I find the information on details of consequent Frontier updates

    https://ronangelo.com/frontier/theme-changelog/
    There’s already a link to this page on Frontier Options.

    You can check that before updating. Theme updates are usually just minor changes but if there were major changes then that would be written on the changelog page.

    #5727
    Alex
    Guest

    Thank you, Ron. Now, I see it was 1.1.4 when my child theme got broken. Fortunately, it was on a local server. I found Asteroid about 2 years ago, and since then I was sure that it is the best of free themes in terms of user’s interface and flexibility. I started to play with child themes, and then Frontier arrived. It was bingo! Thanks for this great theme. I will donate it’s development as soon as I get a positive cash flow.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: How to fix header.php for better SEO?
Your information: