Connect with us

Articles

Echo Images inside a Post into the Loop

Published

on

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..

Continue Reading
7 Comments

7 Comments

  1. 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; ?>

  2. frosty

    December 8, 2008 at 10:59 am

    Thanks for that one!

  3. 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.

  4. Nick

    January 15, 2009 at 12:38 pm

    That can be useful

    Nick’s last blog post..Montana Library

  5. 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

  6. Maor

    September 5, 2009 at 5:33 pm

    Thanks for the tip, liked it!
    .-= Maor´s last blog ..‫וורדפרס 2.8+: איך לא להציג קטגוריות מסוימות בתפריט הצדדי?‬ =-.

You must be logged in to post a comment Login

Leave a Reply

Articles

Post this to Twitter

Published

on

Hey, do you have a list a social bookmark links? Does it have a Twitter link?
Well here is a way you can link a post to your Twitter.

<a href="http://twitter.com/home?status=Blog Post: <?php the_permalink(); ?>" class="external" title="Click to send this post to Twitter!">Twitter</a>

Pretty useful I might say 🙂

Continue Reading

Guest Post

Top 8 popular WordPress plugins of all the time

The WordPress plugin repository has over 54,000 plugins that enhance user experience by filling gaps in WordPress’s core functionality. Eight prominent plugins include Yoast SEO for optimizing SEO and readability, Akismet for spam filtration, Jetpack for multiple functionalities, WooCommerce for e-commerce, WPForms for form creation, WP Rocket for speeding up page load times, Elementor for complex designs without coding, and Migrate Guru for WordPress migration. They contribute to the website’s security, user-friendliness, and speed.

Published

on

By

Top 8 popular WordPress plugins of all the time 9

The WordPress plugin repository has 54,000+ plugins. That’s like a lot. These plugins are used to complement the core WP installation. In other words, it improves a user’s experience on WordPress. They handle certain features and functionalities that WP cannot do by itself.

Choosing the correct plugin is vital for your website’s security, user-friendliness, and speed. Else you can take WordPress support from a good team.

 We have listed down the top 8 popular WordPress plugins. Let’s discuss first what WP Plugin is.

Top 8 popular WordPress plugins of all the time 10

WordPress Plugin

WP plugin is defined as a software tool that is scripted in the PHP language. It includes additional features on your WP website. The plugin provides a simple process to add features to your website without writing a single code.

The API of the plugin provides an effective hooks’ and filters set. This robust set enables developers to modify or add new functions with WordPress. 

8 Popular WordPress plugins

Yoast SEO

Search Engine Optimization is necessary to boost traffic to your website. Without any doubt, Yoast SEO is the best WordPress SEO plugin. It supports you to add Meta tags, connect your website with Google Search Console, etc. 

The plugins provide you with a complete solution to improve on-page SEO. The features of Yoast SEO are as follows:

  • Readability check
  • Internal linking suggestion
  • Access to create custom Description/Mets Header
  • XML News Sitemaps
  • Quickly build 301 directs with the Redirect feature
  • Optimize for synonyms, keywords
  • Update as per Google’s algorithm

The plugin makes sure that your site meets the top-most SEO principle. It provides the tools to optimize your content for overall readability and SEO.

Akismet

Every day it is not easy to filter out spam that is either irrelevant stories or promotional links. Automattic developed a tool called Akismet.

It is known as the godfather of comment spam reduction plugins. The plugin works great to track back spam and filter out most comments. It reviews all your contact form submissions against their global spam database. This WordPress Premium plugin provides advanced security solutions along with spam protection.

To use the plugin, you will need an API key that is free for non-commercial use. It is beneficial if you receive at least ten comments daily.

Jetpack

The Automattic company built another top-most WordPress plugin called Jetpack. It is a versatile tool with numerous features. The plugin supports you with design, marketing, and security. Among its multiple features, you can perform the following-

  • Spam filtration
  • Malware scanning
  • Find site analytics
  • Login security
  • CDN
  • Automatic social media posting
  • Slow image loading
  • Multiple WordPress themes and more.

WooCommerce

How can we miss WooCommerce among the list of popular WordPress plugins? An e-commerce plugin enables you to sell anything on the web simply. 

The plugin has an abundance of themes, easy customization options, and much more. Therefore, it stands unique among the list of WordPress plugins. 

Wondering why WooCommerce is best for you? The plugin provides features such as adding product variation, extensive payment methods, etc. The developer community creates extensions to make online selling as smooth as possible.

WPForms

WPForms is a fantastic plugin that allows people to create popular forms with simple and easy steps. The form is created by using a simple interface of drag-and-drop. This plugin enables you to create contact, subscription, payment, survey, and other forms. It doesn’t require you to put in a great effort, as you can create forms with just a few clicks. 

Note that this plugin can integrate with all the primary payment and marketing platforms. 

WP Rocket

Every business requires quick page load times and to accomplish this caching solution is the most effective way. The WordPress repository has a Premium caching plugin called WP Rocket. It helps to escalate the loading time of a site. The plugin works with the cached copies and reduces the servers’ workload. It also aids in lowering the HTML, JavaScript, and CSS file weight through minimization. The features of the plugin include-

  • Compatible with cloud flare
  • Improve user-end browser caching
  • Quick Load images while scrolling down
  • Support WordPress Multi website
  • Incorporate caching solution along with a CDN
  • Load images on request
  • Facilitate slow loading to boost page load time. 

Elemetor

Page builder aids you in creating more complex designs as you don’t need to use coding. The most popular page builder plugin as per WordPress.org is Elementor. The plugin has quickly shot up the rank with over 1.2 million active installs. It offers a free package to build complex designs with a drag-and-drop interface. 

You must think of installing this plugin on your website. This will support you to have full control over your design.

Migrate Guru

Migrate Guru is a specifically designed, fully automated plugin for WP migration. It offers you the fastest, easiest, and most reliable method to migrate your WordPress website. The plugin runs on an external server named BlogVault’s server. You can quickly transfer large sites without any issues. 

There is a choice to save the migration setting and remove the unnecessary files during the migration process. This allows you to repeat the migration with a single click in the future. 

The plugin has the following feature:

  • No overload on the website
  • No requirement for storage space
  • Easy to use
  • Build for large websites
  • One-click migration
  • Fully automatic, replace & built-in-search

Smush 

Large images slow down the loading of websites. Therefore, it is crucial to optimize every file image to improve speed. Optimizing every image manually can be a tedious task. 

For this, you can apply the Smush plugin. It is a simple way to compress and optimize your WP website images. The plugin compresses images all over your website automatically. You will need to upload images to your WP website media folder. 

The plugin provides no interruption in your workflow and improves website performance.

Conclusion

A WordPress plugin helps you to quickly and smoothly run your website. It improves user experience and supports websites to reach a wider audience. 

No need to get confused about which plugin is best for your website. We have mentioned 8 of the pre-eminent WP plugins of all time. These plugins are accessible in free as well as paid forms.

Author’s Bio

Jinny Sarah Jacob is a Sr. Technical content writer at 24×7 WP Support, a leading WordPress development company that supports WordPress themes, plugins, and errors. She is a passionate technology geek and loves to write blogs on marketing, technology, B2B, big data/analytics, business strategizing, etc.

Continue Reading

Guest Post

Increase Traffic with Comments

Published

on

By

Increase Traffic with Comments 12

We all want to read comments, especially if these comments praise us or show that many people value our posts on our blog. Therefore, those valuable comments you can have on your blog can generate a lot of qualified visitors in your blog traffic.

Your website, more significantly, your blog posts can generate traffic. if you can improve the search traffic, you have the help of the things below.

Learn ways – How to Increase Blog Traffic with Comments

  • Ask or Request Open-Ended Questions

Open-ended questions tend to prompt a lot of engagement that includes comments. However, it only means that when you allow the recipients to express themselves, they will provide you with complete and meaningful answers.

One of the main reasons there are a lot of blog posts that are not generating loads of traffic with comments is because the questions they have are close-ended. These close-ended questions can only be answered by a yes or a no or with a direct answer that does not leave anything else that will run for longer and more comments.

  • Write A Post On the Top List

If you wish to improve your search traffic and generate powerful comments about the user experience on your blog posts, you should consider writing a post that falls on the top list. Unfortunately, many people struggle to gain online transactions from when they first opened their blog until they have discovered the importance of having a content marketing strategy.

To gain comments, you should add keywords wherein people are searching for the headline that you have. It would be best if you did not try to sound like an English professor to have one. The things that you need to do are to make your headline appear relevant for it to attract attention, comments as well as a load of traffic.

  • Do Some Influencer and Expert Name Dropping

Name-dropping is a term that refers to the practice of attributing names of famous experts as well as bloggers to your content. Using this strategy, your blog posts can generate a lot of comments that would, later on, create loads of traffic for your website.

Generating comments for each blog post is one of the best ways to get a lot of traffic to your website. This way, you can make your content more valuable because some people seem to appreciate the things you have written. Therefore, if you wish to gain loads of traffic for your website, you should first work on generating comments with the help of the tips stated above that are very easy to do for your content. This, in turn, will increase Blog Traffic.

Continue Reading

Random Search Terms

Title

Recent Posts: Fully Net Worth . com

Nancy Pelosi net worth.

Nancy Pelosi net worth.

What is Nancy Pelosi’s net worth? Nancy Pelosi is an American politician who has a net worth close to 120 million dollars. In one of her recent disclosure of wealth, Nancy and Paul Pelosi, who is her husband, estimated that their total personal wealth falls somewhere in the range of $43 million to $202 million. […]

Pua Magasiva Net Worth: How Rich was Pua Magasiva Actually?

Pua Magasiva Net Worth: How Rich was Pua Magasiva Actually?

Pua Magasiva was a New Zealand actor best known for his role as Shane Clarke, the Red Ranger from Power Rangers Ninja Storm. Pua Magasiva net worth before his death is estimated to be $600,000. Magasiva was born on August 10, 1980, in Apia, Samoa, but was raised in Wellington, New Zealand, since he was […]

Faze banks Net Worth: How Rich is Faze Banks Actually?

Faze banks Net Worth: How Rich is Faze Banks Actually?

Ricky Banks, who is better known as Faze Banks, is an American Youtuber and the co-owner of the most subscribed gaming group of Call of Duty called Faze Clan which has more than 7 million subscribers. Moreover, his own channel has close to 5.5 million subscribers. Moreover, he is also credited for the formation of […]

Inside Elon Musk’s Net Worth.

Inside Elon Musk’s Net Worth.

Elon Musk’s Billionaire Lifestyle: A Comprehensive Look at the Tech Mogul’s Empire In the realm of modern entrepreneurship and technological innovation, few names shine as brightly as Elon Musk. As one of the wealthiest individuals on Earth, Musk has built an empire that spans multiple industries, from digital payments to electric vehicles and space exploration. […]

Trending