Articles of categories

Custom Post Type Archive Page Filtering

I have a custom post type with a hierarchical custom taxonomy. The taxonomy has several parent terms and each parent term has several child terms. The posts are assigned to one parent and (mostly) one child. I want that my archive page example.com/{cpt_slug} only displays the parent terms. After a first selection, the user will […]

How do order product categories – on a parent category page – in Woocommerce?

I am using Woocommerce with WordPress. Woocommerce allows you to create product categories. In addition You can set all those categories to have a specific parent category. That way you can go to the parent category page and display all the categories with an image and title. I have done this. But the order of […]

category hierarchy level as a body class – parent cat =1, child cat=2, grandchild=3

I’m finding this next to impossible to find any info on. I’m looking for a way to assign each category level a number and then add that number to the body class. e.g. the parent category archive would show the class .catlevel-1, whereas the child category archive would show class .catlevel-2 … and so on.

Get next post in same category not working WP 4.7.4

I have posts which assigned 1 of 2 different categories. On the single post view i want to show a next and previous link of posts with the SAME category. This should be straightforward, i’ve tried using get_previous_post etc but i cannot exclude posts assigned to the other category. I’ve tried $prevPost = get_adjacent_post(TRUE,’129′,TRUE); where […]

MySQL Query to Retrieve Category from wp_posts

Using this query to retrieve all of my posts with a specific post_type SELECT * FROM wp_posts WHERE post_type = ‘product’; As described here the category is not in the wp_posts table but in term tables wp_terms wp_term_relationships wp_term_taxonomy Searching through all the tables for a category I had in mind, the only instance of […]

Specify multiple categories for custom post template – FATAL ERROR

I am using this code below to specify a post template for a specific category in my functions.php file. function get_custom_cat_template($single_template) { global $post; if ( in_category( ‘ms-conversations’ )) { $single_template = dirname( __FILE__ ) . ‘/CUSTOM-POST-BLOG-POST.php’; } return $single_template; } add_filter( “single_template”, “get_custom_cat_template” ) ; The code technically works, however I need to specify […]

Category page not showing

I installed wordpress 4.7.3. After that I created one “Test” category. After that I created one post and assigned to that “Test” category. Then I go to front end, in the right menu and clicked on “Test” category. Then it shows page with text “OOPS! THAT PAGE CAN’T BE FOUND.” “It looks like nothing was […]

Custom Post Type posts not showing in category

I created several Custom Post Types and I also created a category too. I assigned several custom posts to that category and I tried to call it to display the posts in home page, but it’s not displaying anything even though it’s displaying posts from the Posts in wp dashboard menu. Here’s my code in […]

Notice: Undefined variable: category_id

Here is my category.php code <?php remove_action( ‘genesis_before_loop’, ‘genesis_do_taxonomy_title_description’, 15 ); add_action( ‘genesis_before_loop’, ‘prettycreative_do_taxonomy_title_description’, 15 ); function prettycreative_do_taxonomy_title_description() { global $wp_query; if ( get_query_var( ‘paged’ ) >= 2 ) { return; } $term = $wp_query->get_queried_object(); if ( ! $term || ! isset( $term->meta ) ) { return; } $headline = $intro_text = ”; if ($term->meta[‘headline’] […]

Custom page category taxonomy 404

product/office/ return 404 error.How is that even possible? should it not go down to index if page is not found ? This is my archive.php file: <?php get_header(); ?> <div id=”wrapper”> <main id=”main” class=”site-main” role=”main”> <div class=”container”> <?php get_header(); if(have_posts()) : while(have_posts()) : the_post(); echo ‘<a class=”a-product” href=”‘.get_permalink().'”>’; echo ‘<div class=”col col-s-1 col-m-4″>’; the_post_thumbnail( ‘large’, […]