Articles of categories

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 […]

WP_Query Custom Post Type if Category ID Equals

I’ve setup a custom post type “slides” and I’ve created two categories for the slides custom post type: “slides-testimonial” (id = 7) and “slides-regular” (id=8). I would like to run a single loop, but use a conditional statement to compare the categories. The following code is not working with is_category. What am I doing wrong? […]

List all categories but exclude current post category on single post page

I want to display a list of categories excluding the category of the current single post that the user is navigating on. The list is displayed on the single.php template. I’m using this code to display all categories and is working well but I can’t find a way to exclude the current post category: <ul […]

Category page returns 404 error

I’m developing custom theme that should show all categories on a single page in /category path. When i navigate to /category/some-category, i can see all posts that belong to that category, but when i go to /category, i get 404 error. I have category.php file with following loop: <?php define( ‘WP_USE_THEMES’, false ); get_header(); ?> […]

How to show Sub Categories on Categories page?

I have a product page which is assigned as category.php. Now i want to show Sub Categories as Sub Menu on the Category page. But even after searching alot i couldn’t show all sub categories yet. I found one code which is : <?php if (is_category()) { $this_category = get_category($cat); } ?> <?php if($this_category->category_parent) $this_category […]