{"id":391,"date":"2010-05-27T17:14:43","date_gmt":"2010-05-27T17:14:43","guid":{"rendered":"https://www.divydovy.com/?p=391"},"modified":"2020-01-23T10:30:14","modified_gmt":"2020-01-23T10:30:14","slug":"thematic-custom-meta-descriptions-without-a-plugin","status":"publish","type":"post","link":"https://www.divydovy.com/2010/05/thematic-custom-meta-descriptions-without-a-plugin/","title":{"rendered":"Thematic: Custom Meta Descriptions without a Plugin"},"content":{"rendered":"<p>I&#8217;m really getting into developing child themes for <a title=\"Thematic Theme Framework\" href=\"http://wordpress.org/extend/themes/thematic\">Thematic</a>. It&#8217;s a really powerful theme framework.</p>\n<p>I&#8217;ll try to post some of the more interesting bits of code I write to help the Thematic community at large.</p>\n<p>Here, I&#8217;ve used a nice little meta-description function from <a title=\"WordPress SEO 101\" href=\"http://www.lifeonlars.com/wordpress/wordpress-seo-101-5-easy-steps-for-better-wp-seo\">Life On Mars&#8217;s WordPress SEO 101 article</a> and turned it into a function that you can simply add to your childtheme&#8217;s functions.php file:</p>\n<p><code>// Add a custom meta-description<br />\nfunction childtheme_meta_description() { //divydovy: put the Life On Mars code in a wrapper function ?&gt;<br />\nID, \"MetaDescription\", true);<br />\n// checks to see if the custom field MetaDescription is not empty<br />\nif ($custommeta !=='') {echo $custommeta;}<br />\n// check if excerpt exists for the post and output it if it does<br />\nelseif (!empty($post-&gt;post_excerpt)) {the_excerpt();}<br />\n// if there's no custom field or excerpt output the post title<br />\nelse {single_post_title('', true);}<br />\n}<br />\n// if category page output the category description<br />\nelseif (is_category()) {echo category_description();}</code></p>\n<p><code> </code></p>\n<p><code> // if it's any other page display this generic description<br />\nelse { echo 'add your generic description here';}<br />\n?&gt;\"<br />\n/&gt;<br />\nadd_action('wp_head', 'childtheme_meta_description'); //divydovy: add this function to the wp_head hook<br />\n</code></p>\n<p>Hey presto! A customisable meta-description facility with redundancy for your Thematic child theme 🙂</p>\n<p>Props to <a href=\"http://www.lifeonlars.com/\">Life On Mars</a>.</p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m really getting into developing child themes for Thematic. It&#8217;s a really powerful theme framework. I&#8217;ll try to post some of the more interesting bits of code I write to help the Thematic community at large. Here, I&#8217;ve used a nice little meta-description function from Life On Mars&#8217;s WordPress SEO 101 article and turned it into a function that you can simply add to your childtheme&#8217;s functions.php file: // Add a custom meta-description function childtheme_meta_description() { //divydovy: put the Life On Mars code in a wrapper function ?&gt; ID, &#8220;MetaDescription&#8221;, true); // checks to see if the custom field MetaDescription [&hellip;]</p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","clkt_auto_upload":"0","_clkt_publish_and_upload":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wordproof_timestamp":false},"categories":[7],"tags":[151,162,94,140,144],"my_content_publications":[],"class_list":["post-391","type-post","status-publish","format-standard","hentry","category-web","tag-child-theme","tag-meta-description","tag-seo","tag-thematic","tag-theme"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"clkt_attachments":{"featured_image":null,"inline_attachments":[],"upload_candidates":[],"max_free_size":102400,"max_allowed_size":104857600},"_clkt_upload_mode":"new_only","clkt_content_hash":"d88295c6bf2be9707d4ddc9527daf4661367a64bf97358ca2349599566448e87","customFields":{"clkt_auto_upload":"0","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"processed_attachments":{"total_attachments":0,"uploaded_to_arweave":0,"kept_original_urls":0,"upload_summary":{"total":0,"uploaded":0,"failed":0,"too_large":0,"reused":0}}},"paymentAddress":"8_-tV4d15kVVq9Gd-Al2MAIC3LqNtJ_KgFol71TzxPw"}