How to query different categories on index?

You could get the categories and for each of them, you use the list category posts plugin shortcode to echo the relevant posts into a div: $categories = get_categories(); foreach ($categories as $category) { echo ‘<div>’; $cat=$category->cat_name; echo do_shortcode( ‘[catlist id=’.$cat.’ numberposts=5 ]’); echo ‘</div>’; } This goes in the ‘latest posts’ part of your … Read more

Rewrite Query_Var URL Parameter with Slug

Your rewrite rule and query vars filter is wrong. Below is an example based on your query var my_taxoqueryvar function add_query_vars_filter( $vars ){ $vars[] = “my_taxoqueryvar”; return $vars; } add_filter( ‘query_vars’, ‘add_query_vars_filter’ ); add_action(‘init’, ‘myplugin_rewrite_rule’ ); function myplugin_rewrite_rule() { add_rewrite_rule( ‘results/([a-z]+)/?$’, ‘index.php?pagename=results&my_taxoqueryvar=$matches[1]’, ‘top’ ); }

Using wp config to connect to a DB from a plugin

I’m guessing this is a custom “plugin” where you are wanting to run a file externally that connects to the WordPress database, not really as a standard plugin which loads within WordPress environment, as in that case as @belinus says you can just use $wpdb class. Anyway, since ABSPATH is defined IN wp-config.php, you can’t … Read more

Custom product loop avoiding duplicates

Using the developers’ reference example, you are referencing $loop redundantly. Drop the $loop-> before the_post() and have_posts(): if ( have_posts() ) { $term_names = array(); while ( have_posts() ) { the_post(); $myPostID = get_the_ID(); //Uncomment next 3 lines to debug using your error log //ob_start(); //var_dump($myPostID); //error_log(‘myPostID = ‘ . ob_get_clean(),0); $arrProductTerms = wc_get_product_terms( $myPostID, … Read more