• Resolved barnez

    (@pidengmor)


    Hi,

    I use the Academica theme for my site http://www.englishlc.com. I also have Yoast WordPress SEO installed.

    My problem is that the Academica theme is automatically creating a meta description from the first paragraph of the page. This meta description is taking precedent over Yoast’s meta description I have created for each page. The theme also inserts the site title(English Language Centre)in every SERP for the site, meaning I can only use a short unique page title.

    Here is the code from the header.php, and I’d welcome any advice on the lines I need to remove so that there the page title and meta description showing on the search results are from the Yoast settings only.

    <?php
    global $options;
    foreach ($options as $value) {
        if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    
    <head profile="http://gmpg.org/xfn/11">
    
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <meta name="msvalidate.01" content="E9660FC4132856CCCDA450C30AE580A4" />
    
    <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?><?php bloginfo('name'); if(is_home()) { echo ' | '; bloginfo('description'); } ?></title>
    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_excerpt_rss(); ?>" />
    <?php csv_tags(); ?>
    <?php endwhile; endif; elseif(is_home()) : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style.css" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url');?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    <?php wp_enqueue_script('jquery');  ?>
    <?php wp_head(); ?>
    <script type='text/javascript'>
    jQuery(document).ready(function() {
    jQuery("#menuhead ul").css({display: "none"}); // Opera Fix
    jQuery("#menuhead li").hover(function(){
            jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show(268);
            },function(){
            jQuery(this).find('ul:first').css({visibility: "hidden"});
            });
    });
    </script>
    <style>
    
     </style>
    </head>
    
    <body>
    
    <div id="wrap">
    
    <div id="wrap1">
      <div id="mainNav">
        <div class="wrap">
    
          <?php wp_nav_menu( array('container' => '', 'container_class' => '', 'menu_class' => '', 'menu_id' => 'menuhead', 'sort_column' => 'menu_order', 'theme_location' => 'primary' ) ); ?>
    <div id="omw">
          <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Nav Translator') ) : ?>  <?php endif; ?>
    </div>
        </div><!-- end .wrap -->
      </div><!-- end #mainNav -->
    
      <div id="crumbs">
        <div class="wrap">
          <p><?php if(function_exists('bcn_display'))
    {
    	echo"You are here: "; bcn_display();
    }
    ?></p>
        </div><!-- end .wrap -->
      </div>
    
      <div id="header">
        <div class="wrap">
          <div id="logo"><a>"><?php if ($proud_misc_logo_path) { ?><img src="<?php echo "$proud_misc_logo_path";?>" alt="<?php bloginfo('name'); ?>" /><?php } else { ?><img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" /><?php } ?></a></div>
          <div id="search">
            <form method="get" action="<?php echo get_option('home'); ?>">
             <input type="text" name="s" id="setop" onblur="if (this.value == '') {this.value = 'search';}" onfocus="if (this.value == 'search') {this.value = '';}" value="search" />
             <input type="submit" id="searchsubmittop" class="submit" value="search" />
            </form>
          </div><!-- end #search -->
          <?php include(TEMPLATEPATH . '/inc_social.php'); // calling social block ?>
          <div class="clear"> </div>
        </div><!-- end .wrap -->
      </div><!-- end #header -->

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin]

Viewing 7 replies - 1 through 7 (of 7 total)
  • try to change this section:

    <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' | '; } ?><?php bloginfo('name'); if(is_home()) { echo ' | '; bloginfo('description'); } ?></title>
    <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <meta name="description" content="<?php the_excerpt_rss(); ?>" />
    <?php csv_tags(); ?>
    <?php endwhile; endif; elseif(is_home()) : ?>
    <meta name="description" content="<?php bloginfo('description'); ?>" />
    <?php endif; ?>

    to:

    <title><?php wp_title(''); ?></title>

    Thread Starter barnez

    (@pidengmor)

    Many thanks for your reply.

    I removed those lines and replaced as suggested. When I first tested the meta tags here I found that the title and description were unchanged. Then after I cleared the WordPress cache, Bingo! Title and meta descriptions contain no errors.

    Thanks for your advice alchymyth. Very much appreciated!

    Thread Starter barnez

    (@pidengmor)

    Firefox page source is now showing the following.

    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
    
    <head profile="http://gmpg.org/xfn/11">
    
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    
    <meta name="msvalidate.01" content="E9660FC4132856CCCDA450C30AE580A4" />
    
    <title>Private Lessons: academic & general</title>
    <link rel="stylesheet" type="text/css" href="http://englishlc.com/wp-content/themes/academica-1-child/style.css" />
    <link rel="alternate" type="application/rss+xml" title="English Language Centre RSS Feed" href="http://www.englishlc.com/en/feed/" />
    <link rel="alternate" type="application/atom+xml" title="English Language Centre Atom Feed" href="http://www.englishlc.com/en/feed/atom/" />
    <link rel="pingback" href="http://www.englishlc.com/xmlrpc.php" />
    
    <!-- This site is optimized with the Yoast WordPress SEO plugin v1.2.5 - http://yoast.com/wordpress/seo/ -->
    <meta name="description" content="With private lessons at English Language Centre we can help you to improve your English so your work, study and social life benefit."/>
    <link rel="canonical" href="http://www.englishlc.com/en/private-lessons/" />
    <!-- / Yoast WordPress SEO plugin. -->
    Thread Starter barnez

    (@pidengmor)

    This thread is resolved.

    Sopheak8888

    (@sopheak8888)

    Thanks, that’s help me.

    Hi,
    I am having the same issue and I cannot seem to resolve it even by changing the theme. As each theme has a different header.php. How can I stop this from happening when I change the theme? Everytime I do change it is still pulling in the “Site Title” + “SEO Title” to form the “page title” as one sentence. Also the meta description is the first few lines from the first on page paragraph, while there is also a second meta description (Which is the correct meta description). The h1 & h2 are also jumbled up as far as I can see. (Using screaming Frog to view)

    Domain: tyresdublin.com

    I looked for the code example above but it is different in the current theme I am using. I have placed the code from “Kickstart theme” I am using below. I’m not overly familiar with PHP, thankyou very much.

    <!DOCTYPE html>
    <!--[if IE 6]><html id="ie6" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 7]><html id="ie7" <?php language_attributes(); ?>><![endif]-->
    <!--[if IE 8]><html id="ie8" <?php language_attributes(); ?>><![endif]-->
    <!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?>><!--<![endif]-->
    <head>
    
    	<meta charset="utf-8" />
    	<?php $detect = new Mobile_Detect();
    	if ((ot_get_option('responsive_layout') == 'responsive_mobile' && !$detect->isTablet()) || ot_get_option('responsive_layout') == 'responsive_all') {
    		echo '<meta name="viewport" content="width=device-width, initial-scale=1" />';
    	} ?>
    
    	<title><?php bloginfo('name'); ?>  <?php wp_title('-'); ?></title>
    
    	<?php if (ot_get_option('favicon')){
    		echo '<link rel="shortcut icon" href="'. ot_get_option('favicon') .'" />';
    	} 
    
    	if (ot_get_option('ipad_retina_icon')){
    		echo '<link rel="apple-touch-icon" sizes="144x144" href="'. ot_get_option('ipad_retina_icon') .'" >';
    	} 
    
    	if (ot_get_option('iphone_retina_icon')){
    		echo '<link rel="apple-touch-icon" sizes="114x114" href="'. ot_get_option('iphone_retina_icon') .'" >';
    	}
    
    	if (ot_get_option('ipad_icon')){
    		echo '<link rel="apple-touch-icon" sizes="72x72" href="'. ot_get_option('ipad_icon') .'" >';
    	} 
    
    	if (ot_get_option('iphone_icon')){
    		echo '<link rel="apple-touch-icon" href="'. ot_get_option('iphone_icon') .'" >';
    	} ?>
    
    	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
    
    	<!--[if IE 7 ]>
    	<link href="<?php echo MNKY_CSS ?>/ie7.css" media="screen" rel="stylesheet" type="text/css">
    	<![endif]-->
    	<!--[if IE 8 ]>
    	<link href="<?php echo MNKY_CSS ?>/ie8.css" media="screen" rel="stylesheet" type="text/css">
    	<![endif]-->
    	<!--[if lte IE 6]>
    	<div id="ie-message">Your browser is obsolete and does not support this webpage. Please use newer version of your browser or visit <a href="http://www.ie6countdown.com/" target="_new">Internet Explorer 6 countdown page</a>  for more information. </div>
    	<![endif]-->
    
    	<?php echo ot_get_option('analytics_code'); ?>
    	<?php wp_head(); ?>
    </head>
    <body <?php body_class('default-header'); ?>>
    <!-- Layout wrapper -->
    	<div id="layout-wrapper" class="<?php echo ot_get_option('theme_layout', 'full-width'); ?>">
    
    <!-- Top bar -->
    	<?php if(ot_get_option('top_bar')) {
    		echo '<div id="top-bar-wrapper">
    			<div id="top-bar">';
    				get_sidebar('top-left');
    				get_sidebar('top-right');
    			echo '<div class="clear"></div>
    			</div>
    		</div>';
    	} ?>
    
    <!-- Header -->
    	<div id="header-wrapper">
    		<div id="header" class="size-wrap">
    
    			<div id="logo">
    				<?php
    				$default_logo = ot_get_option('logo_upload');
    				$retina_logo = ot_get_option('retina_logo_upload');
    				if (!$default_logo){
    					echo '<a href="'. home_url() .'">
    							<h1>', bloginfo('name') .'</h1>
    						</a>';
    				} else {
    					if ($retina_logo){
    						$retina_logo_width = ot_get_option('retina_logo_width');
    						$retina_logo_width = str_replace("px", "", $retina_logo_width);
    						$retina_logo_height = ot_get_option('retina_logo_height');
    						$retina_logo_height = str_replace("px", "", $retina_logo_height);
    						echo '<a href="'. home_url() .'">
    							<img src="'. $default_logo .'" alt="', bloginfo('name') .'" class="default-logo" />
    							<img src="'. $retina_logo .'" width="'. $retina_logo_width .'" height="'. $retina_logo_height .'" alt="', bloginfo('name') .'" class="retina-logo" />
    						</a>';
    					} else {
    						echo '<a href="'. home_url() .'">
    							<img src="'. $default_logo .'" alt="', bloginfo('name') .'" />
    						</a>';
    					}
    				}
    
    				?>
    			</div>
    
    			<?php get_sidebar('header') ?>
    			<div id="menu-wrapper">
    				<?php if (!ot_get_option('header_search')) { ?>
    					<a class="toggleMenu" href="#"><?php _e('Menu', 'kickstart'); ?><span></span><div class="clear"></div></a>
    					<?php wp_nav_menu( array('theme_location' => 'primary', 'container' => false, 'items_wrap' => '<ul id="primary-main-menu" class=%2$s>%3$s<li class="header-search-toggle"><a href="#">'. __('Search', 'kickstart') .'</a></li></ul>', 'fallback_cb' => false)); ?>
    				<?php } else { ?>
    					<a class="toggleMenu" href="#"><?php _e('Menu', 'kickstart'); ?><span></span><div class="clear"></div></a>
    					<?php wp_nav_menu( array('theme_location' => 'primary', 'container' => false, 'items_wrap' => '<ul id="primary-main-menu" class=%2$s>%3$s</ul>', 'fallback_cb' => false)); ?>
    				<?php } ?>
    				<div class="clear"></div>
    			</div>
    
    			<?php if (!ot_get_option('header_search')) {
    				echo '<div id="header-search-wrapper" >';
    					get_search_form();
    				echo '</div>';
    			} ?>
    
    		</div>
    	</div>
    
    <!-- Title area -->
    	<?php echo '<div id="title-wrapper"><div class="header-shadow"></div>
    		<div class="page-title size-wrap"><h1>';
    			if ( is_home() ) {
    				wp_title ('', true);
    			} elseif ( is_search() ) {
    				printf( __( 'Search Results for %s', 'kickstart' ), '<span>' . get_search_query() . '</span>' );
    			} elseif ( is_category() || is_tax() ){
    				single_cat_title();
    			} elseif ( is_tag() ){
    				single_tag_title(__('Posts Tagged: ', 'kickstart'));
    			} elseif ( is_archive() ){
    				if ( is_day() ) {
    					printf( __( 'Archive for <span>%s</span>', 'kickstart' ), get_the_date());
    				} elseif ( is_month() ) {
    					printf( __( 'Archive for <span>%s</span>', 'kickstart' ), get_the_date( 'F, Y' ));
    				} elseif ( is_year() ) {
    					printf( __( 'Archive for <span>%s</span>', 'kickstart' ), get_the_date( 'Y' ));
    				} elseif ( is_author() ) {
    					printf( __( 'Archives by: <span>%s</span>', 'kickstart' ), get_the_author_meta( 'display_name', $wp_query->post->post_author ));
    				} elseif ( is_post_type_archive() ) {
    					post_type_archive_title();
    				} else {
    					_e( 'Archives', 'kickstart' );
    				}
    			} elseif( is_404() ) {
    				_e('Error 404', 'kickstart');
    			} else {
    				the_title();
    			}
    	echo '</h1>';
    	if (!ot_get_option('disable_breadcrumbs')){ mnky_breadcrumb(); }
    	echo '<div class="clear"></div></div></div>'; ?>
    
    <!-- Content wrapper -->
    	<div id="wrapper" class="size-wrap">

    @mrcanning: As per the Forum Welcome, please post your own topic. Added to which, your problem – despite any similarity in symptoms – is likely to be completely different.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove duplicate meta descriptions from header’ is closed to new replies.