Unable to create pagination for Category.php

Check up the wordpress templating hierarchy The graphics reads from left to right. You have custom post type products so you can override this file and your code should be in category-products.php, since you are limiting your WP queury for products posts. Category.php is similar but without this limitation. // Your category-products.php loop should be … Read more

front end add category to new post

It looks like you’re trying to use the default Post post type’s Category taxonomy with your custom post type movies. $post_info = array( ‘post_type’ => ‘movies’, // custom post type here ‘post_status’ => ‘pending’, ‘post_title’ => esc_attr(strip_tags($_POST[‘title’])), ‘post_content’ => esc_attr(strip_tags($_POST[‘overview’])), ‘post_category’ => $category, // categories are by default only for Post post type ); Have … Read more

Post List by category and under custom taxonomy

Your post list is repeating because in your WP_Query args you are fetching posts just from the category with ID “2”. In order to get posts from custom taxonomies you need to use a tax_query inside your WP_Query. You can read more about tax_query here: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters I would do the following: $args = array( ‘post_type’ … Read more

How to create Child Category page from scratch at wordpress?

I don’t fully understand what you’re asking but here’s my guess… Say you have hierarchical taxonomy (e.g. category) with the following term tree: News (ID: 1) World (ID: 2) Africa (ID: 5) Asia (ID: 6) Europe (ID: 7) Business (ID: 3) Science (ID: 4) Now you visit /category/news/world/africa/ WordPress will look for the following templates: … Read more

Get WooCommerce product category list in functions.php

You need to use action to get categories. in init action you can get product categories. add_action(‘init’, ‘my_product_cat’); function my_product_cat() { $woo_cat_args = array( ‘taxonomy’ => ‘product_cat’, ‘orderby’ => ‘name’, ‘hide_empty’ => 0, ); $woo_categories = get_categories( $woo_cat_args ); echo “<pre>”; print_r($woo_categories); echo “</pre>”; }