I have added custom meta boxes in post and I want to put Tag slug name in the meta box text field, and want to display the text field's texts (Tag slug name) like following this.
<?php
$my_query = new WP_Query( 'showposts=4&tag=' . $CUSTOM_META_BOX_ID_VALUE );
while ( $my_query->have_posts( )) : $my_query->the_post();
//Post stuff.....
endwhile;
?>
Please can anybody help me?
I mean I'm trying to display related/recent posts by some specific tags for some specific posts. So I am trying it with Option Tree custom meta box code. Meta box register code is simply like this-
$my_meta_box = array(
'id' => 'tsi_mp3_meta_box',
'title' => __( 'Music Options', 'tsi' ),
'desc' => '',
'pages' => array( 'post' ),
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'label' => __( 'Tag Name <code>This is necessary for display Albums
contents & related posts</code>', 'tsi' ),
'id' => 'tsitg',
'type' => 'text',
'desc' => __( 'Type the TAG name you added for this post.', 'tsi' )
),
)
);
And it appears like this in single post -
bangerz_miley_cyrus is the tag slug name of the post. And I want to display related posts under this tag in certain posts. So I want to add the value of 'tsitg' as tag slug name in WP_Query object something like this-
$my_query = new WP_Query( 'showposts=4&tag=' .$tsitg );
while ( $my_query->have_posts( )) : $my_query->the_post();
So here I'm asking for help...
edit
link above ) and expand upon what you're trying to do? Sounds like you need to useget_post_meta()
or a meta_query instead but I'm unsure your goals.