WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can't Figure Out How to Put Meta Description on Actual Website (5 posts)

  1. rmarce
    Member
    Posted 3 years ago #

    Hi, I have meta descriptions on all the pages on my site, but the overall page (rmarcejaeger.com) seems not to have a description associated with it. Google only shows the http://www.rmarcejaeger.com in its search results, and website graders show that rmarcejaeger.com is missing its meta description data. All I can figure out is how to put the description on the individual pages. How can I put the description on the overarching website? Note that I do have a tagline set in the wordpress settings.

    I am using a child theme based on the parent theme Platform.

    Thanks for your help!

  2. kmessinger
    Volunteer Moderator
    Posted 3 years ago #

    I put my meta data in the header.php file and that seems to work fine.

  3. rmarce
    Member
    Posted 3 years ago #

    I did that, but it still is not registering it as meta data for the whole webpage.

  4. kmessinger
    Volunteer Moderator
    Posted 3 years ago #

    I have never worried about this as my sites are not really about making money like your is so I didn't even know about web graders :^)

    I went here, http://websitegrader.com/site/www.rmarcejaeger.com and it showed the meta description of your site.

    meta data for the whole webpage

    Don't understand that either. Maybe someone else (govpatel?)with SEO knowledge can jump in here.

  5. rmarce
    Member
    Posted 3 years ago #

    This is what I ended up doing. I think it takes care of all contingencies. I put it in the head part of my header

    <?php 
    
    	if ( is_singular() )
    	{
    
    		if ($seodescription = get_post_meta($post->ID, "my_description", true))
    		{
    			?>
    			<meta name="description" content="<?php echo $seodescription; ?>" />
    			<?php
    		}
    		else
    		{
    			?>
    			<meta name="description" content= "<?php echo get_bloginfo( 'description' ); ?>" />        <!-- THE TAGLINE OF YOUR BLOG -->
    			<?php
    		}
    	}
    
    	elseif ( is_home() )    // THE BLOG PAGE
    	{
                    ?>
    		<meta name="description" content= "Pens & PCs is blog featuring well-informed articles about writing and computers, among other topics."; /> <!-- THE TAGLINE OF YOUR BLOG -->
    		<?php
    	}
    
    	elseif ( is_category() )
    	{
    		if ( is_category("Other") )
    		{
    				?>
    				<meta name="description" content= "Pens & PCs blog posts about a variety of topics."; />
    				<?php
    		}
    
    		elseif ( is_category("Writing") )
    		{
    				?>
    				<meta name="description" content= "Articles about writing from the blog Pens & PCs."; />
    				<?php
    		}
    
    		elseif ( is_category("Computers") )
    		{
    				?>
    				<meta name="description" content= "Articles about computers from the blog Pens & PCs."; />
    				<?php
    		}
    	}
    
    	else
    	{
    		?>
    		<meta name="description" content= "<?php echo get_bloginfo( 'description' ); ?>" />	<!-- THE TAGLINE OF YOUR BLOG -->
    		<?php
    	}
    
    	?>

Topic Closed

This topic has been closed to new replies.

About this Topic