Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End List posts from current category WITH specific tag

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30785
    infocentre
    Member

    Hello!

    Using the WordPress platform, i want to create a list of links to other posts within the current category that have a specific tag.

    The code below lists all the posts in the current category, so should be able to be adapted to my needs – but i am no PHP expert!

    					
    $IDOutsideLoop = $post->ID;
    while( have_posts() ) {
    the_post();
    foreach( ( get_the_category() ) as $category )
    $my_query = new WP_Query('category_name=' . $category->category_nicename . '&orderby=date&order=desc&showposts=100');
    if( $my_query ) {
    while ( $my_query->have_posts() ) {
    $my_query->the_post(); ?>
    ID ) ? ' class="current-page"' : ''; ?>>
    " title="">

    }
    }
    }
    ?>

    Thanks for your help!

    #72525
    infocentre
    Member

    So I am pretty much retarded. Upon closer inspection, all i need to do is add

    &tag=tag-name

    to the query. Might be useful for someone!

    #72488
    Rob MacKay
    Participant

    hehe nice :)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.