WordPress Ridizain Theme Featured Post Bug Fix

Development How-To

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.

    Donations for the magus

    • XLM (Stellar Lumens) 🚀🪐17: yukino*keybase.io XLM (Stellar Lumens) 🚀🪐17: yukino*keybase.io
      • XLM memo/tag (optional): for techmagus.icu
      • Highly preferred
    • ZEC (Zcash) Z0.03: t1W7HusjBAXgquM7YHu6xDUEBejmYPKU2HC ZEC (Zcash) Z0.03: t1W7HusjBAXgquM7YHu6xDUEBejmYPKU2HC
    • XRP (Ripple) X5: rU2mEJSLqBRkYLVTv55rFTgQajkLTnT6mA XRP (Ripple) X5: rU2mEJSLqBRkYLVTv55rFTgQajkLTnT6mA
      • XRP memo/tag (required): 246013
    • STEEM: yahananxie STEEM: yahananxie
    • ETH_smartcontract (Etherium) Ξ0.007: 0x739d2aae2a5b7a4e1d64c58d121c9d908d706c83 ETH_smartcontract (Etherium) Ξ0.007: 0x739d2aae2a5b7a4e1d64c58d121c9d908d706c83
      • Gas: please use at least 35,000
      • Do not send non-smartcontract ΞTH and ERC20 tokens to this address.
    • ETH_ERC20 (Etherium) Ξ0.007: 0xB127362Dc268B63cE22E697344D2c51e673f18B6 ETH_ERC20 (Etherium) Ξ0.007: 0xB127362Dc268B63cE22E697344D2c51e673f18B6
      • Accepts non-smartcontract transactions and ERC20 tokens (in particular: AWC, ENJ, PAX, TUSD, USDC)
    • BCH (Bitcoin cash) ₿CH0.004: pp8fkmchlu6a7c53a2s682jd70mncrzemsthca6ftl BCH (Bitcoin cash) ₿CH0.004: pp8fkmchlu6a7c53a2s682jd70mncrzemsthca6ftl
    • XBT (Bitcoin core) ₿0.0002: 32w1De4wvr5jEzC4g5P4rkjvqg2bvMR8Vk XBT (Bitcoin core) ₿0.0002: 32w1De4wvr5jEzC4g5P4rkjvqg2bvMR8Vk

    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.

    Leave a Reply

    labox