Optimise custom post type queries

It’s not clear if you mean 800ms for total page load with assets and network overhead (which is quite good) or for page generation time alone (much less good). In any case you are making a large mistake of guessing that query is your performance bottleneck. That’s not how performance optimization works. You need to … Read more

how to exclude store in clipper theme wordpress code php

Put your category id’s in an array format. Like the below one. $cat_related = query_posts( array( ‘post_type’ => APP_POST_TYPE, ‘post_status’ => ‘publish’, APP_TAX_CAT => $string_array, ‘ignore_sticky_posts’ => 1, ‘paged’ => $paged, ‘post__not_in’ => array($post->ID), ‘category__not_in’ => array ( $store_id )// this is STORE ID ) );

how to repeat taxonomy in different places on wordpress

register_taxonomy( ‘taxonomy’, array( ‘post’, ‘coupons’ ), $args ); https://generatewp.com/taxonomy/ can help you. // new code taxonomias function clrp_taxonomy_post(){ global $wpdb, $app_abbr; //need $wpdb!! if(get_option($app_abbr.’_coupon_store_tax_permalink’)) $store_tax_base_url = get_option($app_abbr.’_coupon_store_tax_permalink’); else $store_tax_base_url=”store”; register_taxonomy( APP_TAX_STORE, // taxonomy stores array( APP_POST_TYPE_POST, APP_POST_TYPE ), // type POST + APP_POST_TYPE array( ‘hierarchical’ => true, ‘labels’ => array( ‘name’ => __( ‘Stores’, ‘appthemes’), … Read more

How to order by datediff in WP loop?

You can handle this by define DATEDIFF() in SELECT For example: SELECT RECID, DATEDIFF(t1.qr_enddate, NOW()) AS diffORD FROM `mytablw` t1 ORDER BY diffORD ASC; This should work but in your case I strongly recommend to use wordpress default Filter API posts orderby. This filter is applied before a post-retrieving SQL statement is executed. Use it … Read more

Create a hierarchical loop at predefined markup requirements

I was able to figure it out myself, here is the code: <div id=”fullpage”> <?php //for each category, show 5 posts $cat_args=array( ‘orderby’ => ‘name’, ‘order’ => ‘desc’ ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( ‘showposts’ => 5, ‘category__in’ => array($category->term_id), ); $posts=get_posts($args); if ($posts) { echo ‘<section class=”vertical-scrolling” data-anchor=”‘ . $category->name.'”>’; foreach($posts as $post) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)