Related posts in all categories of current post (custom post types)

This is the code that was needed in order to make it show only the posts (that were of a specific custom post type) that matched the same child category (therefore matching all the other categories): <!– other posts –> <?php //this gets the lowest hierarchical child term for current post $categories = get_the_category($post->ID); foreach($categories … Read more

How can I add another option to this custom post function?

You just need to add a static <option> element before you start your loop. <select style=”width: 100px” name=”games_database_rating”> <option value=”none”>No Rating</option> <?php // Generate all items of drop-down list for ( $rating = 10; $rating >= 1; $rating — ) { ?> <option value=”<?php echo $rating; ?>” <?php echo selected( $rating, $game_rating ); ?>> <?php … Read more

WooCommerce product search titles only

This is an 9 months question, but since I had the same issue and found a solution, I came here to post it. On file wp-content/plugins/woocommerce/classes/class-wc-query.php, function pre_get_posts( $q ), WooCommerce defines at line 114: add_filter( ‘posts_where’, array( $this, ‘search_post_excerpt’ ) ); This is the point when WooCommerce mess up your query! The function search_post_excerpt … Read more

WordPress Ignoring My Custom Post Type Templates?

Got it. I had tried to use flush_rewrite_rules() on plugin activation/deactivation, as so: function creativeworks_activate() { // register taxonomies/post types here flush_rewrite_rules(); } function creativeworks_deactivate() { flush_rewrite_rules(); } register_activation_hook( __FILE__, ‘creativeworks_activate’ ); register_deactivation_hook( __FILE__, ‘creativeworks_deactivate’ ); …but that didn’t seem to do anything. However, when I changed the site-wide permalink options arbitrarily and saved them, … Read more

Custom Post Types and independent Categories – complex Taxonomy

In wordpress, the slug (post name) is unique per post type. So, an url like /company-1/items/item-type-1/product-1 and one like /company-2/items/item-type-1/product-1 where product-1 is the post name, cannot address to 2 different products. If you create 2 products with same title WordPress on saving will set an unique slug. Same thing is for articles. For this … Read more