How do I edit how much of my posts appear on the home page?

A blogger asks,

How do I edit how much of my posts appear on the home page? Also the posts seem to have lost their punctuation and spacing when they appear on the home page but are fine when you click on them individually. How would I go about changing that?

Answer:
You are seeing this because in your Main Index Template (index.php) file the_excerpt() function is used to display the post content.  By default, the_excerpt() function displays the first 55 words of each post, and unfortunately it does not preserve the spacing and paragraph formatting.

Solution 1:
To get around this, you may simply enter a manual excerpt in your post edit page, in the Excerpt box.  Yes, this is a bit of a manual work, but it does seem to preserve the line spacing.

Solution 2:
The other alternative, which I recommend, is to use a teaser text.  You do this by inserting the <!–more–> quicktag (in the post editor, it is this icon ) in your post content where you want WordPress to cut off in the display.

This works great in getting people to read your entire blog post, because it gives you precise control as to how much of the entire blog content you want to show.  You can use this to your advantage.

As humans, we have a natural tendency to want to complete the sentence. We are also curious creatures. You can see great usage of the <!–more–> quicktag in my passive income blog, where I cut off the post content display in the middle of a sentence, and it just drives people nuts to want to read more.

Now, for this to work, you will need to replace the_excerpt function in your template file.

tip: If you are new to PHP (or don’t know what it is), make sure you make a copy of your theme file before making any changes to it.  That way if you screw up, you can revert back to your back-up copy.

Go to Appearance -> Editor menu link in your WordPress dashboard.  On the right hand side, find index.php file – this is the file you want to modify.

Then do a search for “the_excerpt” and replace that entire function with

<?php the_content(“Continue reading ” . the_title(”, ”, false)); ?>

What this does is it tells WordPress to display your post content until the <!–more–> tag that you place in your post content, and then show a “Continue reading [your post title]” link.

Now that you have modified your index.php template file, you will need to go back to your blog posts and insert the <!–more–> tag where you want it.

Last resort:
Until WordPress makes a modification to the_excerpt() core function in their future upgrades, you will have to rely on manual excerpt, or use the <!–more–> tag to show excerpt text with formatting preserved.

If you are absolutely disgusted with the above 2 alternatives, try the Advanced Excerpt plugin which claims to preserves formatting.

References:
http://codex.wordpress.org/Template_Tags/the_content – talks about the_content() function and teaser text.

http://codex.wordpress.org/Customizing_the_Read_More – more programming reference for customizing the “Read More” link when using teaser text.

“You do not have sufficient permissions to access this page” Solved

During a recent WordPress plugin development I came across a dreaded “You do not have sufficient permissions to access this page” message when I tried to access the menu item for the plugin:

After some digging around and Googling this seems to be an issue unresolved for many people.

Here is the background information – I’m using WordPress 3.0.1, and my plugin is named WPReferrer.php, located in a folder called “WP Referrer”

Here is the issue, the folder name has a space in between and WordPress code doesn’t seem to like that!

I renamed the plugin folder to “WPReferrer” and viola my options page shows up.

I have also tried renaming to “WP-Referrer” and that seems to work, too.  In summary, do not use spaces in your plugin folder or filename (tested)!

Let me know if this helps you.

line
Powered by Wordpress | Designed by Elegant-Themes