[Plugin: Just Custom Fields] Adding Custom Field to Plugin
-
Hello,
I’d like to display a custom field in a slider plugin…underneath the thumbnail pagination.
Is this possible? I’ve attached a large portion of the plugin code.
I thought I could add it like this: <p>.<?php echo $small; ?></p>
and just add
$small = get_post_meta($post->ID, ‘small’, true); // we get value for input text
above. I’m just not sure where. Here is the code that I am editing (I was adding the echo before the anchor in the STRONG section):
What am I doing wrong? Where do I put:
$small = get_post_meta($post->ID, ‘small’, true); // we get value for input text
?
Thanks.
if ($options['source'] == '_featured') { $filter = array('numberposts' => $options['limit'], 'meta_key' => '_fps_featured', 'meta_value' => 1, 'order' => 'DESC', 'post_type' => $types); } elseif (substr($options['source'], 0, 1) != '|') { $filter = array('numberposts' => $options['limit'], 'post_type' => $options['source'], 'order' => 'DESC',); } else { $source = explode('|', $options['source']); if ($source[1] == 'category') { $category = 'category'; } else { $category = $source[1] . '_category'; } $filter = array('numberposts' => $options['limit'], 'post_type' => $types, $category => $source[2], 'order' => 'DESC',); } if ($options['randomize']) { $filter['orderby'] = 'rand'; } else { $filter['orderby'] = 'post_date'; } $featured_posts = get_posts($filter); $small = get_post_custom($post->ID, 'small', true); // we get value for input text require('slider-layout-templates.php'); $out .= '<div id="fps-container" style="width: ' . $options['width'] . '">'; $out .= '<div class="fps-slides-container">'; $slide_nb = 1; $pagination = ''; <strong> foreach($featured_posts as $featured) { $pagination .= '<li><a href="">' . get_the_post_thumbnail($featured->ID, 'FPS pagination thumbnail', array('class' => 'fps-thumbnail-mini')) . '</a></li>';</strong> // $featured "is" $post // get per-post or global layout if (get_post_meta($featured->ID, '_fps_layout', true)) { $layout = get_post_meta($featured->ID, '_fps_layout', true); } else { $layout = $options['layout']; } if ($layout == 'custom') { $template = $options['custom-layout']; } else { $template = $layouts[$layout]; } // get per-post or global thumbnail size if (get_post_meta($featured->ID, '_fps_thumbnail', true)) { $thumbnail_size = get_post_meta($featured->ID, '_fps_thumbnail', true); } else { $thumbnail_size = $options['thumbnail']; } $tags = get_the_tags($featured->ID); $tags2 = ''; if ($tags) foreach($tags as $tag) { $tags2 .= '<a href="/tag/' . $tag->slug . '">' . $tag->name . '</a>, '; } $tags2 = trim($tags2, ', '); $content = $featured->post_content; if (strpos($content, '<!--more-->')) { $content = substr($content, 0, strpos($content, '<!--more-->')) . ' <a href="' . get_permalink($featured->ID) . '">(more...)</a>'; } $content = apply_filters('the_content', $content); $thumbnail = get_post_thumbnail_id($featured->ID); $thumbnail = wp_get_attachment_image_src($thumbnail, $thumbnail_size);
The topic ‘[Plugin: Just Custom Fields] Adding Custom Field to Plugin’ is closed to new replies.