query posts only works on the first page

I’m using Jetpack’s infinite scroll function on the homepage and I only want to display posts from the category with ID 1. The problem is that my query works correctly only on the first page. On the other pages it displays posts from all categories. Here you have my code <?php $paged = (get_query_var(‘paged’)) ? … Read more

Add a class to a menu item depending on a body class

I need to have a class of current-menu-item added to a li with the id of #menu-item-127 if the body class is post-type-archive-team I can do this with jQuery – $(function(){ if ($(‘body’).hasClass(‘post-type-archive-team’)) { $(‘#menu-item-127’).addClass(‘current-menu-item’); } }); But it’s needed before jQuery loads to make something else work. Any ideas if I can do this … Read more

How to display search query as formatted text?

I am trying to display a site vistors search query on the search page. The form has custom fields so is not showing if it’s “Search” and it doesnt show none of my custom fields. My search form – <!– Search Form –> <section class=”searchMain sm2″> <form method=”get” id=”searchform2″ action=”<?php echo home_url(); ?>/”> <input type=”hidden” … Read more

Hide empty categories from get_categories

I’m trying to hide the empty categories (with no posts associated) from a list in an archive page. I’m using hide_empty as suggested on WordPress codex but it’s not working, the code outputs all categories: <ul class=”filter-menu”> <?php $cat = get_query_var(‘cat’); foreach(get_categories(‘parent=0&hide_empty=1’) as $category) { echo ‘<li><a href=”#” data-filter=”.’. $category->slug.'” >’ . $category->name.'</a></li>’; } ?> … Read more

List of buyers for each product

I would like to know if it’s possible to get the complete name of each buyers for a specific product or the orders list of a specific product ? Answer Goto your wordpress phpmyadmin open database 1.All Woocommerce orders save in table-prefix_posts table 2.and Woocommerce order’s meta info like :billing-addres,customer-name store in table-prefix_postmeta table run … Read more

WordPress Admin Page Slow. Customer Post Type is the slowest

The admin page loads slowly ever since adding Custom Post types. I’ve added them using CPT UI and Custom Fields plugins in WordPress. Whenever you click on the Custom post type from the sidebar it takes 8.74s to load. With one of the queries showing as “slow” according to debug bar plugin. See screenshot. Context: … Read more

Delete query won’t run

This is the set up: <form method=”post” action=””> <input type=”hidden” name=”delete_app_id” id=”delete_app_id” value='<?php echo $adoptee->app_id; ?>’ /> <input type=”submit” name=”delete” value=”delete” /> </form> <?php if ( isset( $_POST[‘delete’] ) ) { $delete_id=$_POST[‘delete_app_id’]; $adoptees_delete=$wpdb->query( “DELETE FROM $wpdb->rc_vol_adopt_apps WHERE app_id =’$delete_id'” ); if ( $adoptees_delete ) { echo ‘Record Deleted’; } else{ echo ‘Have a ham sandwich … Read more