Before you ask please READ THIS

Remove h1 & h2 from header in Single Work page

Can you please tell me how I can completely remove the h1 and h2 tags from the single work headers? I can see in the page settings the option to hide these with rgba, setting the colour opacity value to 0, plus I can do this in custom css with .single-work h1 {display:none;} etc, but what I would like to do is completely remove this in the template, as the page is still indexing it as an h1 and h2, which will affect my SEO as duplicates on the page. I would like to add custom h1 and h2 titles in the post itself to override these.

I may decide to keep one or the other so please let me know how to remove these individually.

Thanks

Comments

  • AirAir
    Posts: 10,970
    Hi there:-)

    You have many option to hide title bar.
    You can switch it off globally for works: Customizing ▸ Works settings ▸ Single work - title bar
    or in each work when you edit it.

    Hope that helps.

    With kind regards.
  • Thanks for the reply, however the option in the admin turns the entire header off, including the feature image which I want to keep as is and dynamic (I understand I can add a full with cover image but I prefer to keep what is there as the uploaded feature image).

    These are the settings I have currently: https://cl.ly/24063i1L413a/Screen Shot 2017-02-20 at 10.50.14.png

    So turning this off per page is fine, but as I said it removes everything, when I simply want the option to turn off h1 & h2 only.

    Is there a way to do this in single-work.php?
  • AirAir
    Posts: 10,970
    OK, that is more clear now :-)

    So to remove it only for single work go to line ~688, and change this:
    
            //subtitle
            if($subtitle_on){
                $html .= '<h2>'.$subtitle.'</h2>';
            }
    
    		//main title
    		$html .= '<h1 class="page-title">'.$title.'</h1>';//sometimes we add html here, so don't escape!
    
    to:
    
    		if(!$page_type['work']){
    			//subtitle
    			if($subtitle_on){
    				$html .= '<h2>'.$subtitle.'</h2>';
    			}
    
    			//main title
    			$html .= '<h1 class="page-title">'.$title.'</h1>';//sometimes we add html here, so don't escape!
    		}
    
    With kind regards.
  • Once again, this is perfect!!

    I opted for this in the end, so I can keep the H1 for now until I complete more portfolio pieces, so this method hides just the H2 and the H1 is still present

    if(!$page_type['work']){
    //subtitle
    if($subtitle_on){
    $html .= ''.$subtitle.'';
    }
    }

    //main title
    $html .= ''.$title.'';//sometimes we add html here, so don't escape!

    Thanks again, the site is really taking shape now and with your help has been so easy!!
  • AirAir
    Posts: 10,970
    Great! I am off for today, so if anything I will help you tomorrow:-)

    With kind regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!