Limit the Number of Text of each Post in Oxwall Blog List

In my recent post, I told you why and how to , today I’m going to explain to you how to truncate the items on your blog list to have a read more link placed under each blog blog post.
Why you need to truncate the items on your blog list

When a person visit the blog page of your oxwall powered website, by default, the persons sees a long list of full blog posts, believe me, people don’t need to see all that. You can limit what they see by truncating the blog items, this means that instead of seeing the full blog post (default), people will now see only the post details (post details include: title, author name, author picture and date) and a short preview (possible the first paragraph of each post) of the blog index items, they will now have to click on the read more buttons to view the full blog content.

This also means that you wouldn’t need to truncate your blog post manually when you or your users are publishing a new blog post as this apply automatically to every blog post.

How to Truncate your Blog Items

  • Logon to ftp/cpanel
  • Download and edit this file /ow_plugins/blogs/controllers/blog.php
  • Using a code editor, edit /ow_plugins/blogs/controllers/blog.php
  • Find this code:
$text = explode("<!--more-->", $dto->getPost());

  • and replace it with:
$text = explode("<!--more-->", UTIL_String::truncate( strip_tags($dto->getpost()), 539, "<!--more-->" ) );

  • Save your changes.

Clear your Cache

As usual, you need to clear your cache for your changes to be effective. Follow the steps here to clear your cache.

Did you get the answer you were searching for?

Save hours of searching online or wasting money testing unnecessary plugins, get in touch with me and let's discuss a suitable plan for your project. Best thing about this service is that you are never placed on hold and get to talk to an expereinced Oxwall/Skadate developer.

Get Answers for Free!

Ask a question related to this topic and get immediate answers from other community members in 48hrs or less. Contribute by answering members questions.

Ask Question
Premium Service

Whether it's a custom plugin, theme or dedicated support needed to get you started on your project, get professional 24/7 support tailored to your need.

Get in Touch

Or just leave a comment...

A Little Twist and Turn

You can increase the number of of characters to show on each post by tweaking our code a bit. Simple change 539 to any value of your choice to display an equivalent amount of characters to that value.

Leave a Reply