WP_QUERY wrong ammount of posts

But all of them get obtained from the database. The problem is that you’re ignoring half of them. Or rather merging two of them and displaying as one. Let’s take a look at your code: while ( $query->have_posts() ) { $query->the_post(); // <- here you call the_post() first time $output.='<div class=”entry filter_product”>’; // and in … Read more

How to code custom special page

Because you asked “How to Code”, here is my guide to get you started. Create a menu page in the administration area using add_menu_page Create the form using html select form-element Populate the form-element with all pages. To get all pages you can use get_posts() Save the form using admin_post action Save the selected-item of … Read more

wp_nav_menu not working correctly in my underscores theme

If found out that this is removing my menu: function add_menu_icon ( $items, $args ) { if ( $args->theme_location == ‘primary’ ) { $elements=”<li class=”custom-logo”>” . get_custom_logo() . ‘</li>’; $elements .= $items; $items = $elements; return $items; } } add_filter( ‘wp_nav_menu_items’, ‘add_menu_icon’, 10, 2 ); I still haven’t figured out why.

Include Minit plugin in theme [closed]

Well, Minit for WordPress is hooked into the plugins_loaded action hook (you can see that checking the file minit.php). And the thing is you are requiring the file minit.php in your functions.php, which is a file loaded after the hook plugins_loaded is called. This means that Minit is not being initialized the proper way. So, … Read more

is_rtl returns false while it should return true

Case 1 – is_rtl() is not working because it has been called directly. To use such contditional tags in WordPress, query should already be run. So such function should be used inside the function hooked to appropriate hook. Since it is called directly, its value will be always false. See https://developer.wordpress.org/themes/basics/conditional-tags/#where-to-use-conditional-tags Case 2 – It … Read more

Get post categories

You’ll need to echo back your results in PHP. foreach($category_detail as $cd){ echo $cd->cat_name; } Also you might want to consider putting something between each category. If you have categories/terms like Blue, Red, Green. Then how you are currently looping over them, it will print it back as: data-category=”BlueRedGreen” Hope that helps!!