Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #358984

    Hi,

    I used the following code:
    add_filter(‘avf_title_args’, ‘fix_single_post_title’, 10, 2);
    function fix_single_post_title($args,$id)
    {
    if ( $args[‘title’] == ‘Blog – Latest News’ )
    {
    $args[‘title’] = get_the_title($id);
    $args[‘link’] = get_permalink($id);
    $args[‘heading’] = ‘h1’;
    }

    return $args;
    }

    The problem is that I have 2 H1 in the post.
    How do I remove the the second one by code (not css)?

    Thank you.

    #359273

    Hi eyeweb!

    Thank you for using Enfold.

    Add this on function.php:

    function avia_default_title_filter($current_post)
    	{
    		if(!empty($current_post['title']))
    		{
    			$heading = is_singular() ? "h2" : "h2";
    	
    			$output  = "";
    			//$output .= "<{$heading} class='post-title entry-title ". avia_offset_class('meta', false). "'>";
    			$output .= "<{$heading} class='post-title entry-title' ".avia_markup_helper(array('context' => 'entry_title','echo'=>false)).">";
    			$output .= "	<a href='".get_permalink()."' rel='bookmark' title='". __('Permanent Link:','avia_framework')." ".$current_post['title']."'>".$current_post['title'];
    			$output .= "			<span class='post-format-icon minor-meta'></span>";
    			$output .= "	</a>";
    			$output .= "</{$heading}>";
    	
    			$current_post['title'] = $output;
    		}
    
    		return $current_post;
    	}

    This will change the h1 tag to h2.

    Regards,
    Ismael

    #360257

    Dear Ismael,

    Now I have same text H1 & H2.
    Can I just remove the H2?

    Thank you!

    #360623

    Hey!

    Replace the code with this:

    function avia_default_title_filter($current_post)
    	{
    		if(!empty($current_post['title']))
    		{
    			$heading = is_singular() ? "h2" : "h2";
    	
    			$output  = "";	
    			$current_post['title'] = $output;
    		}
    
    		return $current_post;
    	}

    Cheers!
    Ismael

    #360669

    Great. Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Replace the default “Blog – Latest News” title – H1 twice’ is closed to new replies.