Wordpress meta tag challenge Wordpress meta tag challenge wordpress wordpress

Wordpress meta tag challenge


from what I understand of your question, you are looking for a simple solution to automate the input process. I have a general idea of what it is you nee to achieve as I have had to do something similar on a brochure type of website.

I have tried answering your question using Jquery, but I find it to increase the amount of text input required when creating your post, there is unfortunately no completely automated method of doing it, but hopefully below would provide you with a solution.

first I found the following plugin: Types - Complete Solution for Custom Fields and Types here: http://wordpress.org/extend/plugins/types/

This allows you to create custom meta feilds when creating a new post/page. The custom feilds are brought added with a perfix of "wpcf-" and then the name of the field, e.g. "Episode Name" becomes "wpcf-episode-name" in the database.

The following is an edit of wordpress's get_meta function:

function get_specifications(){    if ( $keys = get_post_custom_keys() ) {    echo '<div class="entry_specifications">';    foreach ( (array) $keys as $key ) {        $keyt = trim($key);            if ( '_' == $keyt[0] )            continue;            $values = array_map('trim', get_post_custom_values($key));            $value = implode($values,', ');            //remove "wpcf-"            $key = str_replace('wpcf-','',$key);            //convert "-" to a space " "            $key = str_replace('-',' ',$key);            //check if it has a value, continue if it does, skip if it doesn't:            if ($value <> ''){                echo apply_filters('the_meta_key', "                <div class='meta_wrapper'>                    <div class='meta_title'>$key</div>                    <div class='meta_value'>$value</div>                </div>\n", $key, $value);            };        }   }   // echo '</div>'; comment out and remove the line below if you are not using floats in your css   echo '</div><div class="clear"></div>';}

In my page.php (or your template-page.php) I have added the following code when/where I want the meta to be produced:

<?php//check to see if there is meta data, as you only want the meta data on TV Program pages$met_check = get_post_meta($post->ID, 'wpcf-features', true);if ($met_check <> ''){ //if it has a value, spit out "About EpisodeName" ?>      <h2 class="post-title clear">About <?php echo $title ?></h2>    <?php //perform the function from functions.php and return results:    echo get_specifications();}?>

I've styled the result with the following CSS:

.meta_entry {    clear:both;}.meta_title {    float:left;    text-transform:capitalize;    width:200px;}.meta_value {    float:left;    width:480px;}

Hope this helps mate!


There is a wonderful plugin for wordpress called Pods which might be a viable solution.