i have an artists page. i am retrieving a bunch of info by echo of custom fields. at the bottom of this page – i wanted to query posts only of this artists name. (recent news column… and recent events column)//// (below custom field is ‘artist’)(artist name is ‘san gabriel’)
<?php query_posts(array('artist' => 'san-gabriel', 'showposts' => 3)); ?>
so this works… but the key thing i’m trying to do – is keep this template ready – so that i don’t have to make separate pages for each artist… so- i’ve been trying to insert echo or the page title… (as they would be the same) to retrieve page name – that i would use to query the proper posts…
<?php echo get ('artists_name') ?> <?php wp_title("",true); ?>
both of these return the name i want (san gabriel)
but this doesn’t work…
<?php query_posts(array('artist' => 'wp_title("",true);', 'showposts' => 3)); ?>
and about 10 other approaches all break the page…
basically… i feel like if i can echo the artist name… (outside of the loop… and query posts is outside the loop… then why can’t i replace “san-gabriel” with something dynamic that is responsive to either the page title… (which is always the artist’s name) or with an echo of a custom field that is also the artist’s name????
am i going about this all the wrong way ?
i’ve spent at least 12 hours reading about this … i read digging into wordpress and i’ve been scouring the codex. i just want my client to be able to make pages themselves. otherwise this would be easy if i made a page for every artist…
any ideas ?
thank you for your time.
- The topic ‘query by a custom field echo or page title’ is closed to new replies.