Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8229317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:45:32+00:00 2026-06-07T16:45:32+00:00

Although I have experience with PHP, WordPress is pretty new to me and I

  • 0

Although I have experience with PHP, WordPress is pretty new to me and I am struggling here.

I am trying to help a friend complete a theme. He works with several artists and each artist has a WP page named after the artist (i.e., Tom Jones) on which he wants to display only the posts about that artist. We define a tag for each artist ( Tom Jones ) with a slug like ( tom-jones )

Following the Codex, I am prepping the Loop in the template as follows:

$tags = get_tags();
//query_posts( array( 'tag' => $tag->slug ) );
query_posts( array( 'tag' => 'tom-jones' ) );

if( have_posts()) : while( have_posts() ) : the_post();
  echo '<li id="feed<?php theID(); ?>" style="border-bottom:1px solid #404040;">';
  echo '<table><tr><td width="40">';
  echo '<img src="<?php echo get_post_meta($post->ID, 'image_path', true); ?>" />';
  echo '</td><td><a href="';
  the_permalink(); 
  echo '">';
  the_title();                            
  echo '</a><br><span class="smTxt">Posted by ';
  the_author();
  echo ' on <em>';
  the_time('F jS, Y');
  echo '</em></span><br>';
  the_excerpt();
  echo '</td></tr></table></li>';
  endwhile;
else:
  echo '<h3>There are no posts.</h3>';
endif;

I would have thought that the query_post that is commented out would have grabbed the particular slug of the artist but it returns “No Posts”. When I hard code as it is now, it works as expected.

Any help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:45:34+00:00Added an answer on June 7, 2026 at 4:45 pm

    Try this

    query_posts( array( 'tag' => get_query_var('tag') ) );
    

    This post may help you.

    Update:

    As you said artist is a custom texonomy so try this

    $the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );
    query_posts( array( 'artist' => $the_tax->labels->name ) );
    

    Must use wp_reset_query() after the loop when you are using query_posts

    You may read this post.

    Update: (using WP_Query)

    $the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );
    $args = array(
    'tax_query' => array(
        array(
            'taxonomy' => 'artist',
            'field' => 'slug',
            'terms' => $the_tax->labels->name
        )
    )
    );
    $query = new WP_Query( $args );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm kind of new to WPF although I have some experience in Forms, and
I'm new to Python and web development (although I have development experience with Client/Server
Although I have experience with SQL and generating HTML reports with PHP, I'm a
I have substantial PHP experience, although I realize that PHP probably isn't the best
I am a total newbie in servers/hosting etc, although I have some experience in
Although I have my php validation doing this, thought I may as well pop
I have a pretty big problem with my TabHost. Although I have declared all
I am new to both Qt and Linux C++ development (although I have many
I have lots of experience of writing php scripts that are run in the
Although I have some experience in Android development, I don't have a lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.