More posts shown on "Latest News" Widget

Hello,

I was wondering if it was possible to show more than 3 posts at a time using the Latest News widget? I wanted to add another slot on the front page, which is http://thehoopandtheharm.com/, to show a 4th post (and eventually more than 4 posts).

Thank you!

Hi
as default, the latest news widget displaying 3 posts only. But if you want to display more, you have to create a child theme first then start to modifying fp-latest-news.php file.

Here is the steps:

  1. create a child theme

  2. duplicate “widgets/fp-latest-news.php” from your parent theme to your child theme

  3. open and edit fp-latest-news.php within your child theme change this line 'posts_per_page' => 3, to 'posts_per_page' => 4,
    and this line:
    <div class="blog-post col-md-4 col-sm-6 col-xs-12">
    to:
    <div class="blog-post col-md-3 col-sm-6 col-xs-12">

  4. open and edit functions.php within your child theme then add this line:

if ( function_exists('siteorigin_panels_activate') ) {
	require_once get_template_directory() . "-child/widgets/fp-latest-news.php";
}
  1. activate your child theme, it will display an error message or your site will blank.
  2. To fix point 5, open and edit functions.php within your parent theme then change this line:
    require_once get_template_directory()."/widgets/fp-latest-news.php";
    to
    // require_once get_template_directory()."/widgets/fp-latest-news.php";

Let me know how it goes.

Regards,
Awan

Hi! Sorry I responded late.

It didn’t work. I already had a child theme, so I copied the widgets folder (with the latest news file in it) to my child theme. Then I did your steps 3 and 4 to the appropriate files. I never “activated” my child theme since I was already using it on my site. It never displayed an error message or otherwise broke. I still did step 6, which unfortunately didn’t do it either.

I did everything but ended up with everything the same :\ I’ll try again, but is there anything else I can do?

Hi,

Could you tell me what is the directory name of your child theme?

It’s sydney-child.

public_html/wp-content/themes/sydney-child is what it looks like in my file manager.

Okay, could you please to paste the content of the fp-latest-news.php and functions.php to the pastebin.com and share the link here? Let me check your code.

Sydney Functions (NOT Child theme): http://pastebin.com/dFtie7bh

fp-latest-news (from Child theme): http://pastebin.com/adimawcN

Syndey-child Functions: http://pastebin.com/RBHbbHnL

Thanks :smiley:

Hi,

Thank you for providing your custom code to here. I’ve just checked it and your custom code is correct and it should work.

Did you mind if you change directly the original code in the parent theme? but when you update your theme, you have to change it again manually. I am not sure why its not working in your site.

I’ll do that and try this method at a later date. Not sure why it’s not working.

Thank you so much for your help!