Tag Info

Hot answers tagged

2

Because the credit data is saved in the attachment's post meta, not the main post: $credit = get_post_meta( $post->ID /* Wrong ID! */, 'credit', true ); Instead you need to catch the ID of the inserted image: function attach_image_credit( $images ) { $return = $images[0]; // Get the image ID from the unique class added by insert to editor: ...


1

You don't get any ordering, because you are making multiple get_posts() calls and only retrieve a single post in each of them. You cannot order a single post. :) You need to get rid of outermost loop and just pass a set of IDs (that would be your $instance['data']) to retrieve via single get_posts() call.


1

Taxonomies don't by default have thumbnail images. Without knowing how those are set I can't say exactly how to get the thumbnails, but as for "what am I doing wrong?" get_post_thumbnail_id accepts a post ID or lacking that assumes the current post in the Loop. You are passing it a term_id, which isn't going to work. You can see that in the source: 32 ...


1

(Posting this answer because this question shows up on Google and I couldn't find what I wanted through Google.) Brief Explanation and Example After retrieving the post from the data base, this will put all of the specified classes into the anchor tag whenever there is an anchor tag with only an image tag inside of it. It works with many image tags in ...


1

The WP_Query documentation on the codex specifically says: 'attachment' - an attachment. Whilst the default WP_Query post_status is 'publish', attachments have a default post_status of 'inherit'. This means no attachments will be returned unless you also explicitly set post_status to 'inherit' or 'any'. I am not sure why it was working before ...



Only top voted, non community-wiki answers of a minimum length are eligible