Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [categories]

Every Post in WordPress is filed under one or more Categories. Categories allow the classification of your Posts into groups and subgroups, thereby aiding viewers in the navigation and use of your site.

0
votes
0answers
3 views

How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?

I want to use Categorie and Tags everywhere in WP (Articles, Pages, Attachments and CPT like for example Jetpack-Portfolio) I have been able to show these 2 core taxonomies (category and post_tag) in ...
0
votes
0answers
10 views

Problem with categories

I have a problem with wordpress network. The website and the admin are working fine. My issue lies in the categories and the separation of the article across the network: I create a new article with ...
0
votes
1answer
15 views

How can I prevent users from creating new categories?

I've set up some categories. I don't want users to add new ones. How can I do this?
1
vote
1answer
36 views

Getting categories id for all products in cart

What I'm trying to do is to take the categories for products which are in the cart. Then check via some conditions what category id is and show different notice. So far I have this /** * Cart ...
0
votes
1answer
11 views

Dropdown select filter and categories list

I have recently visited this website and came to know that it is running on wordpress. I have been looking for dropdown select filter (Banks Filter) and categories list as same as on that website. ...
0
votes
0answers
8 views

Getting Subcategories of specific category and display subcategories in the li tag

I use this code to display the main categories of my woocommerce store Now, I want to display the subcategories of that category using the category name my code <?php function ...
0
votes
1answer
15 views

Exclude category and post from loop in custom category.php

So I created a custom category.php where I have the following loop: <div id="category__product-grid" class="row"> <?php // The Loop while ( have_posts() ) : the_post(); ?> <div class=...
0
votes
0answers
8 views

Need a Plugin for Sorting Specific Category Posts within a Static Page

I am NOT a strong PHP coder and mainly create sites using plugins and custom CSS which I am strong at. I have a page listing posts from a specific category. The page is built using Elementor Page ...
1
vote
2answers
124 views

If newest post of category is newest post in general, skip first post of category

currently I am working on some customized blog templating and was wondering if there is any way to find out if the newest post of a category is also the newest post of the whole blog, so I can skip ...
0
votes
0answers
15 views

Check the product in the cart from which category is and show message

I want to check the product in cart from which category is and if is from Category X to show some message. So far I've done this and I've placed it in checkout.php $categories = array('cat' => '...
0
votes
0answers
13 views

Excluding particular category from displaying in specified areas

Here's my site: http://tophistorie.pl/ I have one category that is responsible for displaying posts in slider (slider displays certain post if it has a specfic category assigned). The problem is that ...
0
votes
0answers
9 views

Add category to curent category filter - link

I want to place a link to a category (cat2) on the page MySite.com/category/cat1/ that takes you to MySite.com/category/cat1+cat2/ But if you already are on MySite.com/category/cat3+cat1/ I want it ...
0
votes
1answer
15 views

add_action pre_term_description vs. pre_category_description

I am trying to set a default tag and a (different) default category description in case there is none given on creation. I have found the action "pre_category_description", but no equivalent for the ...
0
votes
0answers
9 views

Categories hierarchy in url sends to 404

First of all, hope that you are all doing great. I am trying to set permalinks for custom post types as base/category/child-category/postname by using /%category%/%postname% with the help of the ...
0
votes
1answer
24 views

multiple custom post type on category page

Is it possible to have multiple custom post types appear on a category page? For example, I have a category Animals and I can assign it to both these custom post types: dog, cat Both cpts use a ...
1
vote
0answers
11 views

How do I retrieve then print the currently viewed sub categories?

I am building a 'course-like' WP site, without the use of any particular 'course plugins' and for this, I need to be able to show all the sub-categories in the sidebar for that particular course. ...
2
votes
1answer
17 views

What's the difference between “parent” and “category_parent” in a WP_Term object?

What's the difference between "parent" and "category_parent" in a WP_Term object? For example: [1] => WP_Term Object ( [term_id] => 24 [name] => Essential Oils [...
0
votes
0answers
17 views

In get_terms, orderby meta value not working with child_of

Here are my terms query and args. $termArgs = array( 'taxonomy' => 'category', 'hide_empty' => true, 'orderby' => 'meta_key_num', 'meta_key' => 'belCount', '...
0
votes
0answers
17 views

How to define a post category undeletable by other users?

I would define a post category and I would make it not editable e not deletable by other users? Is it possible in some way?
0
votes
0answers
15 views

Related posts by many fields with OR - WP Query

I would like to have related posts on my webpage. The idea is to show everything that is related to this post, so the author could be the same, tags or category(I assume that post have only one) - ...
0
votes
1answer
24 views

WP_Query showing all posts, except from category X, unless it's also in Y

I'm trying to show posts from categories A, B, C, D...and Y, except X, unless posts in X are also in Y, then show them with the rest. I can hide category X on it's own pretty simply: $args = array( ...
2
votes
1answer
21 views

Filtering by Category doesnt paginate correctly on the backend

Description of Issue Right now, on the Wordpress Admin Dashboard, we have 300 posts in our blog. 250 of those posts are in the category "Blog". We're trying to filter the posts to only show posts in ...
0
votes
0answers
15 views

Restrict specific user to manages posts in specific category

I explain this with an example. In my blog I have 2 users: John Paul that write posts. Posts have 2 categories (to be precise, it's a custom taxonomy): Cats Dogs John manages the Cats section of ...
0
votes
0answers
9 views

Create drop down menu with the child categories of a category

I'm trying to create a drop down that has the child categories of a specific category as options. This is my PHP: $args = array('child_of' => 88); $categories = get_categories( $args ); foreach($...
0
votes
0answers
19 views

Get Post Primary Category

I have troubles with getting the posts primary set category. How should I achieve this? My code: global $post; $terms = get_the_terms( $post->ID, 'event-categories'); if($terms) { foreach( $...
0
votes
0answers
21 views

Specific Sigle Template for regular category on custom post type

I have two different categories assigned to two different posts that belong to a custom post type. What I'm trying to do is display a different template for each of these categories. I already tried ...
0
votes
0answers
10 views

automatically assigns the product to those relevant categories in woocomerce [closed]

I looking for plugin that looks up post title, content, excerpt and tags, matches the keywords with I set in categories and automatically assigns the product to those relevant categories. I found ...
1
vote
1answer
19 views

Only one post is showing on category page, why?

My website categories are only showing one recent post, not all. category.php code looks like this: <?php get_header(); /** * The template for displaying Category pages */ quality_breadcrumbs()...
0
votes
0answers
13 views

Create a blog archive page on Shuttle Magazine [closed]

I am currently setting up a website with a blog. I know how to get my categories archive page (/blog/category/category-1) however I cannot seem to create the same page for all blog posts (/blog). The ...
0
votes
1answer
13 views

How to separate categories with commas?

I have this function that displays the specified hierarchy level category of a post. For example <?php display_cat_level(0,true); ?> will display the top/parent category, while <?php ...
0
votes
1answer
15 views

How to get the_category(', ') with link “title” attribute

In my theme I use <?php echo the_category(', '); ?> to get the categories, separates by comma, with links to them. But those links have no title attribute. Is there any way to get them?
0
votes
0answers
14 views

WooCommerce Category Page - How to display a single category under products?

In WP in the WooCommerce plugin, i've added my products to a main category (seating, tables, ceramics etc.) and another category for the designer who made it. On the product category page, I am trying ...
0
votes
0answers
20 views

Display different content on category.php for each custom post type

I created a custom post type TypeA and some new categories used by this new post type. When I go to mysite.com/category/some-category I need to display different content for normal posts and TypeA ...
0
votes
1answer
12 views

How to set featured image as background for a specific category?

I am currently trying to set the most recent post's featured image to be the background of my hero image. This is the code I'm using: <?php $backgroundImg = wp_get_attachment_image_src( ...
0
votes
0answers
14 views

Wordpress template_redirect Not working as requested

I found this code to redirect a whole category to a new domain add_action('template_redirect', 'post_redirect_by_custom_filters'); function post_redirect_by_custom_filters() { global $...
0
votes
0answers
11 views

How to display recent comments of a specific taxonomy?

I have a custom taxonomy, for example region. Under this I've added several sub terms, such as Europe, Aisa, America. How do I display the comments for posts aligned to Europe only? Edit: I found a ...
0
votes
1answer
14 views

Conditional IF current cat is the smallest/last/end child cat THEN

I'm trying to find a way to check if the current category (archive.php) is the lowest/end child cat in a hierarchical structure. Something like IF current cat is smallest child THEN do this
0
votes
0answers
15 views

Sage 9 Sort Blog by Category using Ajax

I'm using the Roots starter theme Sage 9. On my blog page, I have created a dropdown of all the categories with their URL as the value. I’m still learning how to use ajax but I am trying to load posts ...
0
votes
0answers
11 views

Subcategory permalink in a hierarchical way

I have a post whose category is Parent > Sub - Level One > Sub - Level Two and the permalink is http://test.wp_practice.local/parent/sub-level-one/sub-level-two/welcome-to-the-gutenberg-editor. ...
0
votes
1answer
33 views

Query post if has two of the categories

I'm banging my head here. I can't seem to figure out what's wrong with this it works although if a post has more than two categories is doesn't seem to show. What is wrong here? <div class="base-...
0
votes
0answers
20 views

Woocommerce Custom Search based on category not showing

Here i am explaining perfectly. I have created a custom search with category in woocommerce. It was working fine but has an issue. I am having a product which has two category. 1. Women 2. Accessory. ...
0
votes
2answers
36 views

Woocommerce Category Sort Dropdown

In Woocommerce Category page default sort dropdown has like below options. My question is what/how products sort by Popularity ? Not a code What is the measurement ? like if sort Price: Low to High,...
0
votes
1answer
21 views

How can I specify a category post on my home page

My home page displays all posts like below: I display in a grid that shows only 3 of them: <div class="Jobs"> <?php if(have_posts()) { $...
0
votes
0answers
10 views

How to list categories, subcategories and finally posts of selected subcategory

my goal is to create a page, on which I will list all parent categories, then after selecting parent category, it will list all subcategories of parent, and finally if there's no other subcategory ...
3
votes
1answer
89 views

How would I get a taxonomy/category list inside a Gutenberg block?

I would like to display a dropdown list of categories (or other taxonomy) inside of a Gutenberg block. I can only think of two ways to do this: Create an array of the taxonomy in php and use ...
0
votes
0answers
18 views

How to hide the other product categories in the shop page when a specific one is opened?

in my shop page (WooCommerce), I have a sidebar on the left side showing all the product categories. I would like to hide SOME OF those categories in the sidebar when you click a specific category ...
0
votes
1answer
18 views

Set category page title in custom theme [closed]

I'm new in wordpress. I am using one custom theme and install in wordpress. I want to change category page title and remove "Category:" prefix from title. How can I manage it from admin ? I don't ...
0
votes
1answer
48 views

Sort by last word in title

I need to order posts within a category alphabetically based on the last word in the title. I have seen a few suggestions online but none fit correctly. I am using a custom layout for the category ...
-1
votes
0answers
20 views

style category in wordpress

how to style my category in wordpress? i am currently using this code in pages <?php /** * Category Name: coming * * A custom page template for showing posts on a chosen category. * * The "...
0
votes
0answers
15 views

Display category name without echoing data type

Good afternoon everyone, I have written a loop for a custom post type that displays the image of 1st post of each category $args = array( 'hide_empty' => 1, '...