-
AuthorPosts
-
May 15, 2015 at 6:34 pm #445108
Hi,
when I check the option “Display only breadcrumbs”, the title is gone but it leaves an empty h1 behind.
How do I remove the empty h1 tag i a Child theme I need a php solution for SEO :)
Greetings
May 18, 2015 at 4:37 pm #445798Hey il_pelle!
Try adding this to the child theme functions.php file.
function avia_title($args = false, $id = false) { global $avia_config; if(!$id) $id = avia_get_the_id(); $header_settings = avia_header_setting(); if($header_settings['header_title_bar'] == 'hidden_title_bar') return ""; $defaults = array( 'title' => get_the_title($id), 'subtitle' => "", //avia_post_meta($id, 'subtitle'), 'link' => get_permalink($id), 'html' => "<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}>{additions}</div></div>", 'class' => 'stretch_full container_wrap alternate_color '.avia_is_dark_bg('alternate_color', true), 'breadcrumb' => true, 'additions' => "", 'heading' => 'h1' //headings are set based on this article: http://yoast.com/blog-headings-structure/ ); if ( is_tax() || is_category() || is_tag() ) { global $wp_query; $term = $wp_query->get_queried_object(); $defaults['link'] = get_term_link( $term ); } else if(is_archive()) { $defaults['link'] = ""; } // Parse incomming $args into an array and merge it with $defaults $args = wp_parse_args( $args, $defaults ); $args = apply_filters('avf_title_args', $args, $id); //disable breadcrumb if requested if($header_settings['header_title_bar'] == 'title_bar') $args['breadcrumb'] = false; //disable title if requested if($header_settings['header_title_bar'] == 'breadcrumbs_only') $args['title'] = ''; // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before. extract( $args, EXTR_SKIP ); if(empty($title)) $class .= " empty_title "; $markup = avia_markup_helper(array('context' => 'avia_title','echo'=>false)); if(!empty($link) && !empty($title)) $title = "<a href='".$link."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".esc_attr( $title )."' $markup>".$title."</a>"; if(!empty($subtitle)) $additions .= "<div class='title_meta meta-color'>".wpautop($subtitle)."</div>"; if($breadcrumb) $additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true)); $html = str_replace('{class}', $class, $html); if($header_settings['header_title_bar'] == 'breadcrumbs_only') { $html = str_replace('{title}', $title, $html); } $html = str_replace('{additions}', $additions, $html); $html = str_replace('{heading}', $heading, $html); if(!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview()) { $avia_config['small_title'] = $title; } else { return $html; } } }
Best regards,
ElliottMay 18, 2015 at 6:37 pm #445943Thanks Eliott,
I tried the code in my theme by removing the last {
but it does not operate.the H1 is always visible in the code.
you can check if it is correct?
many thanks
May 19, 2015 at 4:53 pm #446546Hey!
Do you have the title bar setting set to only breadcrumbs? Send us a link to your page and we’ll take a look.
Cheers!
ElliottMay 21, 2015 at 11:15 am #447676This reply has been marked as private.May 22, 2015 at 5:28 pm #448492Hi!
I don’t see the H1 in the source code so it appears to be working. Try clearing your browser cache if your still seeing it.
Cheers!
ElliottMay 28, 2015 at 9:21 am #451014Hi Eliott
appears here
http://test.dpfotos.com/nuroa/wp_consejos/test/compraventa/vendedor/
and here
http://test.dpfotos.com/nuroa/wp_consejos/?s=casa
Cheers!
ElliottMay 29, 2015 at 5:56 pm #451730Hey!
Hmm, that is your archives? Try changing this line.
if($header_settings['header_title_bar'] == 'breadcrumbs_only') { $html = str_replace('{title}', $title, $html); }
To this.
if($header_settings['header_title_bar'] == 'breadcrumbs_only' && !is_archive()) { $html = str_replace('{title}', $title, $html); }
Cheers!
Elliott -
AuthorPosts
- You must be logged in to reply to this topic.