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 7650159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:10:50+00:00 2026-05-31T11:10:50+00:00

this is what i would like to do… In my site,each post can have

  • 0

this is what i would like to do…
In my site,each post can have several pictures, but also each post has an attached picture called: thumbnail {name of my post}, this specific picture was attached to the post with the multimedia gallery, and the objective of this picture is to appear in the category list.

<article>
    <p class="the-picture"><img src="url-of-the-picture" /></a>
    <p class="the-post-title"><a href="url-of-the-post">The post title</a></p>
    <p class="the-post-excerpt">The post excerpt</p>
</article>

So basically that’s what i want to do, Maybe using get_post() but i can’t figure out how to do it from outside the post.
Thanks for your help

  • 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-05-31T11:10:52+00:00Added an answer on May 31, 2026 at 11:10 am

    Ok… here is what I found so far:
    The following code will get me the category i’m on:

    global $wp_query;
    global $wpdb;
    $cat = get_category( get_query_var( 'cat' ) );
    

    So, now with the category i can list all the posts:

    $posts = get_posts( array( 'category' => $_GET[ 'cat' ] ) );
    

    And for each post i can do this:

    $attachment_id = $wpdb->get_var('
        SELECT ID 
        FROM ' . $wpdb->posts . ' 
        WHERE post_parent = "' . $record->ID . '" AND post_status = "inherit" AND post_type="attachment" AND post_title LIKE "thumb%" 
        ORDER BY post_date DESC 
        LIMIT 1');
    $thumb = wp_get_attachment_image_src( $attachment_id, array( 90, 117 ) );
    $the_icon = '<img src="' . $thumb[0] . '" width="' . $thumb[1] . '" height="' . $thumb[2] . '" />';
    

    So, basically what i’m doing is looking for the ID of the child post which is marked as the thumbnail of the post and retrieving its information into $thumb. The answer that moraleida gave me was a nice start for my research. Thanks a lot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to save several records for one model. This would have been
This has always confused me. It seems like this would be nicer: ["Hello", "world"].join("-")
I have an application that used Macro. In this macro I would like to
I have a pure C++ application developed using VC 6.0. I would like this
I would like to have questions marked as Edited, but I dont know what
I would like to get some feedback on this idea, as I can see
I have this application with which I would like to store about 50MB of
i have a string which looks like this: .a,.b,.c,.d i would like to add
I have this table that I would like to select values from. The thing
I have an NSData that I would like to read as an NSInputStream. This

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.