Articles of categories

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

Home Page Template – Specific Category

I cannot find a specific solution to my situation. I’m sure this is an easy one though. I have my homepage set to display posts. How can I narrow the posts to a single category? I’ve looked elsewhere without much luck figuring it out as the homepage is using post_formats. Thank you!

How to choose the content from a post which is in the right category?

I have a shortcode, which contains the post title. This shortcode loads in the frontend the content from a post. Thats works fine: function title_content($atts, $content = null ) { global $wpdb; $post_id = $wpdb->get_var($wpdb->prepare(“SELECT ID FROM {$wpdb->posts} WHERE post_title = %s”,$content)); $getpost = get_post($post_id); return $getpost->post_content; } add_shortcode( ‘content’, ‘title_content’); But I have in […]