Articles
Echo Images inside a Post into the Loop
Here is a useful trick. Want to call or echo an image into your blog post with our using the custom fields? Well this could be tricky, but I know of a way.
All you have to do is print these lines of code into your
index.php
or home.php
inside the loop:
<?php $id =$post->ID; $the_content =$wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id"); $home = get_option('home'); $pattern = '!<img.*?src="'.$home.'(.*?)"!'; preg_match_all($pattern, $the_content, $matches); $image_src = $matches['1'][0]; ?>
then after write:
<?php if($image_src != '') { ?> <a href="<?php echo the_permalink() ?>" rel="bookmark" title="Link to <?php the_title(); ?>"><?php the_title(); ?></a><br /> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo $image_src; ?>" alt="<?php the_title(); ?>" /></a> <?php } ?>
That’s all! This will look for the first image in your post and echo it in the loop, could be used to show off those pretty thumbnails for the post..
News
Possible photo tagging plugin update
Have you tried to download any of the community tagging plugins with no prevail?
I recently posted a comment in response to a post on Justin Tadlock’s WordPress site about custom taxonomies. Then was asked by a reader how I integrated my custom taxonomies with one of Matt Mullenwegs “tagging” plugin.
Anyway, I tried to install and use both plugins before with no luck. But decided to download Community Tags and try my luck again. With some hacking, I got it working. For a demo you can check out and tag (someone you know or recognize only, please) a picture over at my photography site, http://thefrosty.com.
Anyway, before I get carried away, I had a reader email me and ask how I integrated the plugin. And I thought I would ask you if you would be interedted in a re-re-release of the plugin.
At present time I do have some array
errors, but everything works just fine as is.
Your comment feedback would be great! Thanks!

When creating content that is going to be valuable in attracting a defined audience it is important to remember four key areas, all of which WPcult can assist you with. Your content should try and combine all of the following:
- Educate
Educational content conveys knowledge to the user. Insightful videos that answer a question can leave a lasting impression. This includes videos such as ‘how to’ tutorials across a spectrum of areas: how to tie a tie, how to start a business, how to draw, or even how to be a ninja. Educational content satisfies the consumer’s thirst for knowledge or answers a defined question. This will be content worth viewing and sharing with selective audiences.
WPcult can research what people are searching for around your brand and what consumers want to find out. This in turn will drive traffic to your content.
- Inform
Whereas educational content answers people’s questions, informational content can keep people up-to-date with news and events, as opposed to responding to questions they may have. Social media is now the go-to platform for the collection and distribution of this content, as opposed to old media channels. The challenge with this form of content is its time-limited nature with content becoming irrelevant when lacking context.
- Entertain
Telling stories is as old as the human condition itself. Evoking emotion through entertainment is a great trap for viewers. Video is the ideal tool for evoking empathy or extreme emotion, whether this is through humor or sadness. As one statistic claims that video is worth 1.8 million words, this is the optimum medium to showcase the marketing power of entertainment. Humour also works with text-based advertising and memes, but the humor in video-form is likely to achieve more views and shares than anything else.
- Inspire
One often overlooked goal in content strategy is to provide inspiration to viewers and consumers. Inspiring content can be anything that encourages people to try something new, challenge themselves, or push their limits. Showing the achievements of others, those who have overcome adversity or other challenges will often inspire people to do something featured in the video or to buy a product to help them do that. This can be particularly beneficial in charity campaigns.
Top 28 social marketing resources
Not on this list but we will go over at a later date are
Findable, Readable, Understandable, Actionable, Brandable, and last but not least Shareable. Also Essential are Awareness, Interest, Consideration, Decision, and how you get there Research, Planning, and Ideas, Execution/Creation, Optimization, Distribution and Analysis of the data, Retweak until you have the best results.
News
Think outside the box
Start to think outside the box. UnBox is a new WordPress theme for the willing. Using jQuery in fluidity.
Officially released today, this theme is a custom WordPress theme for those who want something different.
Built with loads a jQuery tricks and features. This theme is available for purchase. And dhould be up on ThemeForest as soon as they process the files.
For now, you can check out the working demo, and if you like the theme, use this link to [wp_eStore_buy_now:product_id:2:end].
[wp_eStore:product_id:2:end].
-
Tips & Tricks7 months ago
WordPress Security Hacks
-
Pages2 months ago
Write For Us – Guest Post
-
Showcase3 months ago
StylizedWeb.com
-
News2 months ago
How to: Show/Hide any div box with jQuery in WordPress
-
Tips & Tricks1 month ago
Remove the title attribute using jQuery
-
Tips & Tricks6 months ago
How to: show/hide a widget in WordPress with jQuery
-
Plugins6 months ago
Top Membership plugins
-
Tips & Tricks3 months ago
Limit the characters that display on the_title
Austin
December 8, 2008 at 3:54 am
Assuming the image has been added using the WP uploader, here’s a way of doing the same thing using the WP API, which might have a performance advantage:
<?php $attachments = (array) get_children(array(‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’));
if ( ! empty( $attachments ) ) :
$attmt = array_shift($attachments);
$image_thumb = wp_get_attachment_thumb_url($attmt->ID); ?>
<a href=”<?php echo the_permalink() ?>” rel=”bookmark” title=”Link to <?php the_title(); ?>”><?php the_title(); ?></a><br />
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title(); ?>”><img src=”<?php echo $image_thumb; ?>” alt=”<?php the_title(); ?>” /></a>
<?php endif; ?>
frosty
December 8, 2008 at 10:59 am
Thanks for that one!
Picsbuzz
January 7, 2009 at 9:57 pm
This is great script, it helps me a lots!!! Thank you so much!!
I wonder if this script can grab the first image in the post which hosted on share host like: flickr or imagesharkus?
frosty
January 7, 2009 at 10:05 pm
Your welcome, I am not sure. If we could find out details to their database it may be possible.
Nick
January 15, 2009 at 12:38 pm
That can be useful
Nick’s last blog post..Montana Library
Thomas
August 10, 2009 at 11:00 am
Hi all,
First of all, very nice script. I noticed that the output was in html (ie, img src and thumbnailing).
Does anyone know of any snippet to be able to echo the image via php, without having to name the actual individual image file (eg. tree.jpg), and instead using a variable from a database that names photos in a directory.?
thanks
tom
Maor
September 5, 2009 at 5:33 pm
Thanks for the tip, liked it!
.-= Maor´s last blog ..וורדפרס 2.8+: איך לא להציג קטגוריות מסוימות בתפריט הצדדי? =-.