Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1222802

    Hello,

    How can I remove the following code across my site without messing with the template?

    <h1 class="h-landmark"><span>Blog</span></h1>

    I am not looking to hide it visually through CSS. I would like to completely remove it from the code of the page.

    I know that it is coming in from the x/framework/views/renew/_landmark-header.php page but I would like to avoid making changes to the theme if possible.

    If I were to copy that page into my child theme and then modify that code, it could cause me issues when you guys update the theme further down the road.

    Is there a way to turn it off through settings?

    Thanks and I look forward to your reply.

    Aaron

    #1222880

    Jade
    Moderator

    Hi Aaron,

    Currently, there is no way to remove the page title globally for now aside from hiding it through CSS or through overriding the child theme.

    You should be fine editing the header code as long as you do it through a child theme to avoid losing the changes you did when you update the theme.

    #1222905

    Okay, is there a way to write a filter that would remove that code instead of making a change to the template?

    
        <header class="x-header-landmark">
          <div class="x-container max width">
            <div class="x-landmark-breadcrumbs-wrap">
              <div class="x-landmark">
                  <h1 class="h-landmark"><span>Blog</span></h1>
              </div>
            </div>
          </div>
        </header>
    
    #1223311

    Friech
    Moderator

    Hi There,

    Comment out the line:

    <?php x_get_view( 'renew', '_landmark-header' ); ?>

    On wp-header.php file instead. No additional function, less line on the template, less action for the site.

    Thanks.

    #1224113

    Okay, I see what you’re talking about but how could I make this change without messing with your template.

    For example, isn’t there a way to create a filter in order to modify the output of that particular code?

    #1224407

    Nico
    Moderator

    Hi There,

    To remove the header title in your blog page, using CSS, add this in your Customizer > Custom > CSS:

    
    .blog .x-header-landmark {
        display: none;
    }

    Hope it helps.

    Let us know how it goes.

    Thanks.

    #1224433

    No, that does not solve the problem. I am not looking to hide it visually through CSS. Google will still see that meaningless H1 tag as being the first H1 tag on the page and that’s not a good idea.

    Is there any way to hook into actual function and modify the output of the code?

    <?php x_get_view( 'renew', '_landmark-header' ); ?>

    Something like this (I know, this code does not work but I’m looking for ideas):

    
    <?php 
    //This would be placed in my functions.php file of the child theme.
    
    add_filter('x_get_view', 'CleanHeaderCode');
    function CleanHeaderCode() {
        if ($a == "renew" && $b == "_landmark-header") {
           //do nothing. 
        } else {
           //do whatever is necessary
        }
    }
    ?>
    

    I know that I can go an manually modify the PHP code of the particular template (wp-header.php) by adding the said code to my child theme but I would like to avoid doing that because of your regular updates. The more I customize a template, the more I need to check each time you update the X-Theme.

    Do you see what I mean?

    #1224874

    Rad
    Moderator

    Hi there,

    That’s not possible with functions.php since it’s a template. You can move this file x/framework/views/renew/_landmark-header.php to your child theme and make changes there (eg. x-child/framework/views/renew/_landmark-header.php )

    It’s similar to adding codes to functions.php, but different file. The update will not overwrite the changes you made on your child theme.

    Thanks!

    #1225459

    Okay.

    I do think this issue should be taken back to the developers.

    It’s a really bad idea from and SEO perspective to have the first H1 tag of the page say blog on every single page.
    <h1 class="h-landmark"><span>Blog</span></h1>

    Even if it is visually hidden, Google will still see it.

    This is also an issue with the views/global/_brand.php page

    What is the point in having this line of code:

    echo '<h1 class="visually-hidden">' . $site_name . '</h1>';

    At least allow us to turn off these items without having to modify the template.

    #1225634

    Joao
    Moderator

    We certainly appreciate the feedback! This is something we can add to our list of feature requests. This way it can be taken into consideration for future development. Thanks!