diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


WordPress Plugin: Inline Ajax Posts

There are very few  plugins, which provides the functionality to dispaly Full Post on the same page rather than jumping or opening the post in new page, when “Read More” or “More” link is clicked on the post.

Demo: Click on “Click to show Full Post” Link under any of the post on this Blog.

Here is — “Inline Ajax Posts”, an AJAX based plugin, which displays the full contents of your posts in-line an AJAX-ified way, without reloading the page or navigating away from your home page. The plugin displays an excerpt of your post (the same way WordPress does when you use the_excerpt or a tag), but rather than making the user go to another page to read the remainder of the post, this plugin uses Ajax to download and display the rest of it when the user clicks a link to read more. After wards the post’s content can then be hidden and the user can continue reading your other posts.

Thus, saving the hassles of going back and forth.

Latest Changes:
This plugin now functions independently of the_excerpt() and the_content() so you can now use inap_excerpt and inap_content as replacements with no other configuration or code changes. inap_content now accepts the two the_content arguments: more_link_text and strip_teaser plus a third: link_hide. To use inap_content with a custom link_hide and more_link_text messages you can use the code

Please remember that the first and second argument changes the displayed text and the third is a strip_teaser. inap_excerpt accepts the more_link_text and link_hide arguments only.

Other than the changes in arguments inap_content and inap_excerpt function exactly as the_content and the_excerpt. You may use them interchangeably.

The plugin has also been updated to automatically jump back to the excerpt div when the content div is hidden. This will keep from stranding your user further down the page and making it difficult for the user to keep track of where they have been.

Another minor change is that when using inap_content if there is no tag in the post, the plugin will not show the read the rest of post.

How to implement:

  1. Download Inline Ajax Posts Plugin v1.0.
  2. Next unzip and upload the entire folder to your wp-content/plugins directory.
  3. Once uploaded, activate it in the admin panel. There are no options to configure.
  4. Open your templates index.php or post.php file.

Find where it says <?php the_content();?> or <?php the_excerpt();?> Now add the following Before this:

After <?php the_content();?> or <?php the_excerpt();?> add:

The code above will only try to se the plugin if it is activated so it doesn’t throw an error when it isn’t. If this isn’t a concern for you just replace the_excerpt() with inap_excerpt(). Re upload the index.php or post.php file to your theme’s directory.

Unfortunately because of the way the the_content function handles the <!–more–> tag I only use the_excerpt when showing the post. Although it technically possible to use the_content() it may confuse your reader by giving them two options to click at once. Because this may not be a problem for you I have included inap_content() just use this instead of inap_excerpt(). The function inap_content() accepts a string as an argument to allow you to customize the <!–more–> text.

Also, this plugin will function on ANY page that uses the loop on the index page. If you do not have a single.php you may want to use the line: 

< ?php if (function_exists(‘inap_excerpt’) && is_home()){?>

Rather than the first one given above.


WordPress Plugin, Inline Ajax Posts

Share This Story, Choose Your Platform!

Get Latest News

Subscribe to Digital News Hub

Get our daily newsletter about the latest news in the industry.
First Name
Last Name
Email address
Secure and Spam free...