Dynamic category id and tag slug in query_posts array (1 post)

  1. uncleslam9
    Posted 5 years ago #

    Hi there,

    We're working on a directory listing site and are having trouble with a piece of code.

    query_posts( array( 'category__and' => array(11), 'surrounding_suburbs' => 'abbotsford-s', 'posts_per_page' => 5 ) );

    This is to be displayed on a results page determined by category and tag, eg. http://www.whatever.com/category/automotive/?tag=collingwood

    ('surrounding_suburbs' is a the custom taxonomy).

    What we need to happen:

    - The category needs to be loaded in to the query dynamically: tried using <?php echo get_category_link( $category_id ); ?> but then that seemed to stop the 'surrounding_suburbs' part working at all

    - The surrounding_suburbs part needs to dynamically load the tag slug, then add an extra '-s' on the end. eg. the tag slug is 'abbotsford', and the custom taxonomy slug would be 'abbotsford-s'.

    This might all be a bit confusing and I might not have explained it properly, but any assistance would be greatly appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic