Show numbers of related post based on sub category and HIDE parent category

<?php $categories = get_the_category(); $child_cat = null; foreach ($categories as $category) { if ($category->parent != 0) { $child_cat = $category; break; // Stop after finding the first subcategory } } if ($child_cat) { $args = array( ‘cat’ => $child_cat->term_id, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 7, // Correct parameter ‘post__not_in’ => array(get_the_ID()) ); $related = new … Read more

How to create new title and its description inside a section in WP Customizer?

To add a new title and its description inside a section in the WordPress Customizer, you’ll need to add a custom_control for this purpose. You can create a custom control class for displaying the title and description, and then add an instance of this control to your section. Here’s how you can do it: Create … Read more

How to run wp_remote_get() for SPA page?

The problem with SPAs is a lot of the content is rendered by Javascript, so it will only have the full DOM if it’s requested by something that executes Javascript. wp_remote_get() is not the tool for that job, you’d have to script visiting the page with a headless browser.