Exclude a Woocommerce product from WP_Query

You can use “post__not_in” Parameter. add your products id in array which you want to exclude. $default = array( ‘post_type’ => ‘product’, ‘post__not_in’ => array(2024), ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_status’ => ‘publish’, ‘showposts’ => $numberposts ); if( $category != ” ){ $term = get_term_by( ‘slug’, $category, ‘product_cat’ ); if( $term ) : $term_name … Read more

Yoast taking over my WordPress title tag [closed]

That’s not what the SEO title does/is for. It appears that you’ve used the wp_title() function in your template by mistake. wp_title() is intended for use in the <title> tag in the <head> for setting the browser tab/document title. However, since WordPress 4.1 this has been superseded (but not officially deprecated, yet) by add_theme_support( ‘title-tag’ … Read more

Loop is crazy – one row displays wrong count of posts [closed]

For your clearfix wrapper you are doing it wrong. You have this: $counter = 0; while ( $loop->have_posts() ) : $loop->the_post(); if ($counter % 4 == 0) : echo $counter > 0 ? “</div>” : “”; // close div if it’s not the first echo “<div class=”clearfix”>”; endif; // BUILDS INTERNAL DIVS $counter++; endwhile; So … Read more

Why my loop isn’t working? [closed]

I’m not 100% sure what you’re trying to do with this. Out of the Box, WordPres allows you to set your home page as either a static page, or a blog. If you choose blog, it will automatically output title and content for you. If you’re trying to customize a static home page, then you’ll … Read more

Get data from PHP to JavaScript to set position of each post on front page

You could output them as inline CSS custom properties instead of left/top, and then use those to set the position in either CSS or Javascript. PHP: <a class=”project” href=”https://wordpress.stackexchange.com/questions/345335/<?php the_permalink(); ?>” style=”—-x-position: <?php the_field(‘x’); ?>; —-y-position: <?php the_field(‘y’); ?>;'”> <p><?php the_field(“title”); ?></p> </a> CSS: .project { top: var(—-x-position); left: var(—-y-position); /* or CSS grid: */ … Read more