Are you asking how to return a query of your posts, where the custom field value is equal to a value?
If so it would be something like:
query_posts('meta_key=mykey&meta_value=my-post-title-name');
No… I meant… the function is
query_posts('name=post-slug');
so name= should remain there, while post-slug should be defined by my custom field key that is equal to a value…
I am clueless on php… so forgive the raw example…
but it should be something like:
query_posts('name=$mypostslug');
where
$mypostslug =
<?php if ( get_post_meta($post->ID, 'mykeyslug', true) ) { ?>
<?php _e("My value: "); echo get_post_meta($post->ID, "mykeyslug", $single=true); } ?>
something like that… though I know the $ cannot be readable because of the single quotes…
Might review the available arguments for query_posts. See Template_Tags/query_posts
Already did… it was from there that I picked:
Post & Page Parameters
Retrieve a single post or page.
* ‘p’ => 27 – use the post ID to show that post
* ‘name’ => ‘about-my-life’ – query for a particular post that has this Post Slug
here: http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters
It works… I just need to find how to retrieve that value from a custom field…
Did too. I believe it’s a programming issue… I saw somewhere a code to store information in a variable that could be used later but can’t find it…
Found my way through it. It was easier than thought…
<?php $mydiscslug = get_post_meta($post->ID, "disc", $single=true); ?>
<?php query_posts('name=' . $mydiscslug); ?>
These two lines made the trick. Some conditionals… and it works like a charm: http://www.siamshade-everlasting.com/en/lyrics/binecks_lyrics/2009/kimi-ga-tooku-te/
Used to retrieve all the content in the “Song Info” stored in another post.
Hope it helps someone outhere!!!
Regards!
Hey could this be edited to work for the following. I dont know PHP that well so here is what i have.
I want to move the content from bosts which have a custom field of embed and put the data within description. I was going to do this in SQL but is there is a more simple way, this would be great.
So what i want to do. Post with meta_value = ’embed’ i want to move this the the description field within my post.
Any help would be great thanks.