Articles of categories

query_posts by category_name and custom taxonomy

I want to display posts filtered by category_name and custom taxonomy-term: I have function channel_init() { // create a new taxonomy register_taxonomy( ‘channel’, ‘post’, array( ‘label’ => __( ‘Channel’ ), ‘rewrite’ => array( ‘slug’ => ‘channel’ ), ‘hierarchical’ => true, ‘capabilities’ => array( ‘manage__terms’ => ‘edit_posts’, ‘edit_terms’ => ‘manage_categories’, ‘delete_terms’ => ‘manage_categories’, ‘assign_terms’ => ‘edit_posts’ […]

How order posts from category by date and comment count?

Just like in topic I try to order posts from category by date and comment_count but code below doesn’t work: <?php //get post from current category $category = get_the_category(); $category_ID = $category[0]->term_id; $args = array( ‘cat’ => $category_ID, //limit posts to 3 ‘posts_per_page’ => 3, ‘ignore_sticky_posts’ => true, //order post by date and comments ‘orderby’ […]

woocommerce related products by specific categories

I am looking for a way to alter the related products functionality to relate one category of products with another. For example: I have 4 categories: Spoons, Cups, Bowls, Straws. When you select a product in spoons, I want the related products to only display things from the Bowls Categories. And when you select Cups […]

Showing Categories for Page Edit – without plugin

I am building a theme without any extra plugins. Does anyone know the code needed to show the Categories in page Edit – without using a plugin?

Show different menu on each woocommerce category page

I have created several custom menus that appear under the main menu on the shop page. Each category (and its subcategories) should display a different custom menu like below: custom menu: category1 shows menu1, category2 shows menu2… and so on. I tried to achieve this by renaming the taxonomy-product_cat.php file to each category name in […]

Having pages after specifying post_type post

I want to loop through all posts in category 4,but why is there still pages in the result after specifying post_type post? $homeNeWs = new WP_Query(array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 6, ‘cat’ => 4 )); while ($homeNeWs->have_posts()) : $homeNeWs->the_post(); <h3><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h3> <?php endwhile; wp_reset_postdata(); ?> I did add a function […]

Loop categories by recent post

Im looking for a way to loop through categories and then display the recent posts for each one in a container but I need a way to sort the categories by which ones have the most recent posts So if Category C has a more recent post then it’ll appear first before Category A $args […]

Prevent function from triggering again when post in specific category gets another category?

I have created a function to send out an email to authors when there post is added in the popular category for custom post type. IT WORKS but there is 1 major issue. If the post that is in the popular category gets added to a new category while still in the popular category it […]

Remove Archive | from Categories

Can Archive | be removed from the title of each category, either by CSS or core code change? At the moment it shows as “Archive | My Category Name”, I just wish it to show as “My Category Name” I have tried with CSS, but no joy with .archive_header [“Archive |”] { display:none; }

How do I add a category to my post_type

I have a section in my dashboard called “services”. I have 4 services I have 2 categories for these services: residential and commercial 2 of the 4 services have the category “residential”, and the other 2 “commercial” As it is now my services page is pulling up all 4 services. Question: What code do I […]