WordPress Ridizain Theme Featured Post Bug Fix

Ridizain is one of the easiest, feature-filled, free-of-charge “base” theme available for WordPress. However, there was one particular bug that only shows up when using a Ridizain child theme — the Featured Post shows 5 posts regardless of the custom setting.

It has been more than four months since this was reported but it was only today that I took time to read the theme’s files and debug it. I am happy to report that I found the bug and squashed it.

The bug fix is simple, all you have to do is open up the “functions.php” file of your parent Ridizain theme, copy all of the code here, then replace your version. Or, download and replace your “functions.php” file. This is, assuming, you never changed anything in your parent Ridizain theme functions.php file. If you did, skip this one.

Here are where the changes were:
Line 126

	// Add support for featured content.
	$layout = get_theme_mod( 'featured_content_layout' );
    $max_posts = get_theme_mod( 'num_posts_grid' . $layout );
	add_theme_support( 'featured-content', array(
		'featured_content_filter' => 'ridizain_get_featured_posts',
		'max_posts' => $max_posts,
	) );

Line 163

// At this point in the filter we are recalling the layout and content count.
$layout = get_theme_mod( 'featured_content_layout' );
$max_posts = get_theme_mod( 'num_posts_grid' . $layout );
$orderby = get_theme_mod( 'ridizain_featured_orderby' );
$order = get_theme_mod( 'ridizain_featured_order' );
// Here we determine what content type we are going to feature - Posts, Pages or a Custom Post Type.
$content_type = get_theme_mod( 'featured_content_custom_type' );

Changes

It’s simple actually, follow these steps if you need to do this manually.

  1. Open your parent Ridizain theme’s “functions.php” file
  2. Look for “num_posts_” (without the quotation marks), there are two
  3. Replace both instances with: num_posts_grid
  4. Save the file

That’s it. Your child Ridizain theme’s number of Features Post to display setting will now work correctly.

An important note

Since we edited the parent Ridizain theme’s functions.php file, if the theme author pushed an update without the fix above, we have to repeat the same steps again. Unfortunately, I can not find where the source of the theme is hosted so I can submit the fix. The instruction above will have to do for now.

Bug Reports


Photo: Bug by Nguyen Vu Hung (vuhung) is licensed under CC BY-SA 2.0.

    Is a self-confessed bibliophile and technophile other than being an early adopter, an avid gamer, a geek, nerd, role-player, anime otaku, and trekker.

    His first online project was in 1998 when he launched the unofficial website for Ansalon MUD and his own community forums Laibcoms.Community. By 2003 he created his work blog GM-Yukino which grew into gameshogun™, Snoworld™, and techmagus™.

    His website is jcsesecuneta.com and 1way.faith. He also owns Clean Real Food, YourOnly.One, Adorable & Beautiful, and other online properties.

    CC BY-SA 4.0 WordPress Ridizain Theme Featured Post Bug Fix by Yuki is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Permissions beyond the scope of this license may be available at Legal Notice.

    Comment(s) via

    Loading Facebook Comments ...
    Loading Disqus Comments ...
    Skip to toolbar