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

  • Home
  • SEARCH
  • 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 9213963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:52:14+00:00 2026-06-18T01:52:14+00:00

I am trying to fetch and show all posts in a featured listing style

  • 0

I am trying to fetch and show all posts in a featured listing style for tag my-guide

<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="thumbnail">
    <a href="<?php the_permalink(); ?>">
    <?php the_post_thumbnail(); ?>
    </a>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>

This code fetch all featured image from posts, however I am trying to fetch it via particular tag, I tried this also but its not working for tag query_posts('tag=my-guide'); –

    <?php query_posts('tag=my-guide'); 
  while (have_posts()) : the_post();  
?>  
<div class="breaking">  
    <img src="<?php echo get_post_meta($post->ID, 'thumbnail',true) ?>" alt="Post Image" class="postimg" />  
    <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>  
    <p class="datetime"><?php the_time('l, F j, Y G:i'); ?></p>  
    <?php the_content('Continue...'); ?>  
    <div class="postmeta">  
        <p><?php the_category(', '); ?> - <a href="<?php the_permalink() ?>#commenting" title="View Comments">  
    <span class="comm"><?php comments_number('0 Comments','1 Comment','% Comments'); ?></span></a></p>  
    </div><!--/postmeta-->  
</div><!--/breaking-->  
<?php endwhile; ?>  

Source of this -> http://net.tutsplus.com/tutorials/wordpress/build-a-featured-posts-section-for-wordpress/

  • 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-18T01:52:15+00:00Added an answer on June 18, 2026 at 1:52 am

    I fixed the code on my own –

    The problem with the second code block is that, no value is pouring in for this – $post->ID

    So this method call is not doing any good in the code –

    <?php echo get_post_meta($post->ID, 'thumbnail',true) ?>
    

    To fix this, simply call, <?php the_post_thumbnail(); ?> instead of <img src="<?php echo get_post_meta($post->ID, 'thumbnail',true) ?>" alt="Post Image" class="postimg" />

    So this is the working code in general for a particular tag post display –

    <?php query_posts('tag=your-tag'); ?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="thumbnail">  
            <?php the_post_thumbnail(); ?>
            <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>  
            <p class="datetime"><?php the_time('l, F j, Y G:i'); ?></p>  
            <?php the_content('Continue...'); ?>  
            <div class="postmeta">  
                <p><?php the_category(', '); ?> - <a href="<?php the_permalink() ?>#commenting" title="View Comments">  
            <span class="comm"><?php comments_number('0 Comments','1 Comment','% Comments'); ?></span></a></p>  
            </div>
        </div>  
    <?php endwhile; endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to fetch data from internet, parse it and then show the
I am trying to fetch all jobs registered with the Quartz scheduler for a
I am trying to show all of the data in the 'status' column of
I'm new to programming, trying to make simple cms: A index.php display all article
Why doesn't my dynamic sql procedure work? All I'm trying to do is show
Hello guys i am trying to show all the users pokemon were the table
I'm trying to fetch HTML/Text from a DIV and place it as-is (newlines and
I am trying to fetch a PHP script using AJAX and return the values
I'm trying to fetch associations of a model dynamically. For ex; model1 has_many model2s
I'm trying to fetch data from a page that resides on an intranet. The

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.