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.
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
Dear Ismael,
Now I have same text H1 & H2.
Can I just remove the H2?
Thank you!
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
Great. Thank you!