Display Custom Meta with Filter
-
I am using a theme with a custom post type. I have added an additional meta field to the post and the data is saving. I need help creating a filter to add “something”+$mymetafield+”something” to the content. I included my code to add the meta box, but I’m totally lost on using that information. Thanks
add_action('add_meta_boxes', function() { //css id, title, cb func, page, priority, cb func args add_meta_box('ftt_fanpage_url', 'Facebook Fan Page URL', 'fanpage_url', 'ait-dir-item'); }); function fanpage_url($post) { $fanpage = get_post_meta($post->ID, 'ftt_fanpage_url', true); ?> <p> <label for="ftt_fanpage_url"> Full URL to Facebook Fan Page: </label> <input type="text" class="widefat" name="ftt_fanpage_url" id="ftt_fanpage_url" value="<?php echo esc_attr($fanpage); ?>" /> </p> <?php } add_action('save_post', function($id) { if ( isset($_POST['ftt_fanpage_url']) ) { update_post_meta( $id, 'ftt_fanpage_url', ($_POST['ftt_fanpage_url']) ); } });[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
The topic ‘Display Custom Meta with Filter’ is closed to new replies.