New Post has been published on Devtoolsplus
New Post has been published on http://www.devtoolsplus.com/best-way-to-add-meta-descriptions-without-plugin/
Best way to add meta descriptions without Plugin
Hello learners, How are You? If you want to avoid plugin to add meta descriptions of your WordPress site, You are in right place. In this web developers resources we will Try to inform you “How to add meta descriptions without plugin” We don’t need no stinkin’ plugin for custom meta descriptions. All you need a custom field named “metadescription” with the desired meta description for each post. Once you have that going, include the following function to your theme’s header.php file (within the <head> section:
<meta name="description" content=" <?php if ((is_home()) || (is_front_page())) { echo ('Your main description goes here'); } elseif(is_category()) { echo category_description(); } elseif(is_tag()) { echo 'Tag archive page for this blog - ' . single_tag_title(); } elseif(is_month()) { echo 'Archive page for this blog - ' . the_time('F, Y'); } else { echo get_post_meta($post->ID, 'metadescription', true); } ?>" />
This function enables you to customize the descriptions for various types of pages, such as the home page, category pages, tag archives, and so on. For single post-view pages, this function will display the value of the metadescription custom field.