![]() |
PHP question
I'm trying to change some code to get ONLY the featured images from the media library in wordpress. I'm losing my mind, any ideas? Here's some of the code.
Code:
{ |
Quote:
Code:
{ The above of course assuming that you only want posts with a featured image... if not then http://codex.wordpress.org/Function_...post_thumbnail |
This should get the URL of only the featured image:
<?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <stuff><img src='<?php echo $image[0]; ?>'/></stuff> <?php endif; ?> Edit: Might not be what you're looking for. Look at the reply above. :) |
Quote:
|
Quote:
If, however, you want to discard all other post data except for the featured image info, then you'll have to do a more advanced query with wpdb, join some tables and such... I could give you an example if this is what you want to do, but to be honest, the savings in overhead won't be that great compared to just running a normal query like I gave you above. |
I'm always surprised by the amount of people on GFY that are PHP experts.
It's like the 2013 average webmaster knows about everything, programming, marketing, design, blogging, tubes, etc etc... They are true geniuses when you compare them with webmasters from year 2005. |
Quote:
|
Quote:
The following works as intended for me: Code:
$args = array( |
Quote:
I'm always surprised at how many more trolls than non-trolls there are on gfy... It's like the 2013 average GFY member is nothing but a waste of space, offers nothing but garbage in their posts and serves no other purpose than to disrupt the few of us who are actually trying to get shit done. |
What you posted above should work but it's not. There's something else I'm missing, I didn't post all the code. I'll screw around with it tomorrow when I'm not tired. Thanks for helping though!
|
All times are GMT -7. The time now is 11:08 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc