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.

Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

automatically set multiple featured images in wordpress on post

Basically I want to automatically set an image randomly from a selection of about 3 or 4 images in my Media Library when someone posts a blog from a particular category. I've got this so far but it ...
0
votes
0answers
12 views

Can I reset post counters for categories?

I've noticed my post counters in Dashboard - Posts - Categories are showing wrong values. For example, it shows a positive numbers in the Count column for categories, that have zero posts associated ...
0
votes
0answers
9 views

Restrict adjacent products in Woocommerce / Storefront to same category

I am using the Storefront (2.5.3) theme with Woocommerce (3.9.2) Currently I have product categories set up like so: Accessories > [Manufacturer] > [Model] > (products) e.g. Accessories - ...
0
votes
2answers
14 views

In WordPress, how do I get the number of posts next to single_cat_title(''); in the category.php file?

In WordPress, how do I get the number of posts next to <?php single_cat_title(''); ?> in the category.php file? <h1><?php single_cat_title(''); ?> (<?php ????code to count number ...
-1
votes
0answers
14 views

Woocommerce products custom sorting based on category

I would like to sort Woocommerce products based on category. Ex: if a product has two categories, I want to give the product menu order value = 1 in category X and menu order value = 10 in category ...
0
votes
0answers
21 views

Can post name be same as category name?

I have an old website written in static HTML pages. Now I want to rebuild a new website via WordPress. And make sure all SEO I have done with the old site will be transferred to the new site. So I ...
0
votes
0answers
30 views

Filtering posts in category by tag URL

I'm still learning WP, so this might seem pretty obvious to veterans. I've been given admin rights to a WordPress site and told to replicate what my predecessor did with a specific pair of pages. ...
0
votes
1answer
28 views

Include custom post type custom taxonomies in Categories widget

I wanted to see if this was possible, but I want to include the custom post type custom taxonomy categories inside the WordPress Categories widget. I know that there is a filter as shown below: ...
0
votes
0answers
24 views

Grab all the posts for particular category

So I have a class called Recipe and inside I have a get() method as shown below: public function get() { $taxonomies = get_terms([ 'taxonomy' => 'recipe-categories', '...
0
votes
1answer
16 views

Create category after theme setup and modify the default one

I need to modify the default category that is created by wordpress after the installation. I want to create a new one and modify the existing one after that my theme is activated. Is this possible?
0
votes
0answers
42 views

Linking to the most recent post in my podcast category

I am attempting to pulloff what the author did here: How can I link to the most recent post in a category? However, after updating my functions.php file in my child theme I can not get it to load the ...
0
votes
1answer
19 views

echo $category[0]-> cat_name; shows only one category name

I have this code: <div class="row"> <div class="col-lg-12 post_meta"> <ul> <li> <p class="meta-txt">Category</p> ...
0
votes
0answers
29 views

Custom Function.PHP Code Not Working on One Site

So I use to have this site on a small time bulk hosting company and when I asked them why the code wasn't working they said it isn't supported on our server. I moved to a new hosting a few months ago ...
0
votes
1answer
15 views

Use get() method to grab all categories and output inside another method

I have the below get method that I would like to use as a template to output my category names into an output method: public static function get() { $recipe_categories = get_terms('...
0
votes
0answers
12 views

Adding new Category does not refresh the backoffice

I've already checked this thread from a while back and it said that it might be related to an error in the functions.php file. My code editor does not alert me to any type of error right now My ...
0
votes
1answer
20 views

How to remove parent category from child category url using wordpress rewrite rule?

I am trying to remove parent category from the child category but nothing happens. I have a website made with the use of EDD. currently i have categories like below: angular-templates react-...
1
vote
0answers
18 views

Limit amount of posts made within a custom taxonomy

Is there a way to limit the number of posts that can be created within a custom taxonomy? I have a custom post type called Preferred Agents and a custom taxonomy called Agent Location. I want to be ...
0
votes
1answer
42 views

Get and display category name by category description

Now i use this code for get display category name: $idObj = get_category_by_slug('products'); $id = $idObj->term_id; echo get_cat_name($id); But i need to get category name by description. How ...
0
votes
2answers
22 views

Hide entry-header for a specific category

I now you can hide the entry-header using css but what if I want just to hide it for a specific category? <div class="entry-header"> <div class="entry-meta category-meta"> <...
0
votes
1answer
18 views

Query prints posts without specific categories

How to query post without specific categories for example "two"and "three" $args = array( 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', ...
0
votes
0answers
14 views

How to write script in Category and Tag section

How to add a manual script in category and tags in WordPress content write section, because visual to text switch option is not available. Check Image for clarification - Visual and Text option in ...
0
votes
0answers
23 views

How To Customize Position of “Add to Cart” button of WooCommerce on Product Category Page [closed]

I have found a similar question answered, but I couldn't figure out how to apply that to what I need to do. On the Product Category page the price and add to cart buttons are on the same line. I tried ...
-1
votes
0answers
17 views

Woocommerce hide products in PRoduct-Category Listing [closed]

For Standard Shop Listing we already use woocommerce_product_query to extend the SQL Query as follows: add_action('woocommerce_product_query', 'custom_hide_special_products');function ...
0
votes
0answers
14 views

Display subcategory posts

Let's say I have the following categories with subcategories: Music Movies Music Cartoons Anime Every category and subcategory contains some posts. My question is... how can I display the posts ...
1
vote
1answer
25 views

Best way of getting WooCommerce category path

If I am on a product or any category/subcategory I want to display a complete path to the topmost category. Does WooCommerce already have a function for it or do I need to make my own loop that goes ...
0
votes
0answers
13 views

Control on category insertion

I did a lot of research on internet and also in wordpress developer but without results. my question is: I would like to ensure that when add post is mandatory to enter a category. Can a control be ...
1
vote
1answer
18 views

Group listed elements by category

I'm quite new to wordpress so there's a lot of terms I'm missing... I'd like to have a list of elements, grouped depending on a category. For example, let's say I have a list of superhero movie ...
1
vote
1answer
20 views

Problem with displaying posts in the CPT category

I have a problem. <div class="list"> <?php $categories = get_the_category(); $category_id = $categories[0]->cat_ID; $args = array( 'posts_per_page' => -1, '...
0
votes
2answers
26 views

Unable to edit categories in custom post type

I have a custom post type created using the following code: // Event Post type register_post_type('event', array( 'capability_type' => 'event', 'map_meta_cap' => true, 'supports' => ...
0
votes
0answers
23 views

Display menu in category and sub category

I need to show menu with all subcategories for specific category (and sub category). When code looks like this: <?php if (is_category('news')) : ?> <?...
0
votes
1answer
21 views

Want to hide some categories from the categories meta box in the post editor for the two specific user roles

Recently, I am customizing the COLORMag theme in WordPress. I want to make my site as a multi-author website where random people will register and write. But as my theme's homepage shows all the posts ...
0
votes
0answers
16 views

Query distinct years in a category

I'm building out a custom archive widget that displays a select dropdown of months for each year. How can I extend this query to to pass $categories[0]->term_id? This is my query so far... $...
0
votes
1answer
28 views

How to select a parent category and show the children to choose in another select?

How to select a parent category and show the children to choose in another select? this is the code (parent taxonomy) <select> <option value=""><?php esc_html_e('Selecciona País', '...
0
votes
0answers
20 views

Modifying category order

I am working with a directory style wordpress theme that displays categories in masonry style columns with their posts listed under each category title. The categories are appearing on the front page ...
0
votes
1answer
12 views

Subcategories in Category Page

I'm trying to do a category page where it displays a card layout with the sub-categories of that wordpress category. Basically i would have "Sports" and inside the page multiple cards with the ...
0
votes
1answer
21 views

Link to index.php from home.php?

I have home.php that displays recent posts from two prominent categories. At the bottom of home.php, I have a link that says "All Posts" which I would like to have point to a listing of all posts. ...
1
vote
1answer
26 views

Display Categories, Sub-categories, and Sub-sub-categories on separate pages

I am building a FAQ section in our mobile site which I would like to have the following hierarchy: Category > Sub-category > Sub-sub-category > Article I would like the category list and each sub-...
0
votes
0answers
31 views

Add a class “active” on Category Posts Menu

I would like to add an active class on Category Post Menu. I've used it as a widget. This is my code: <ul class="category-posts-menu"> <li class="cat-posts-item"><a href="#">...
0
votes
1answer
10 views

Foreach issue in get_posts function

My category is coming from comma separated place and then i put it into get_posts's args array, but my query gives me only last category's posts. Please have a look at my code below: $content_arr = ...
0
votes
2answers
48 views

Get category if used in a custom post type

I'm trying to get a list of categories if they are used in a Custom Post type. The post type uses the default categories taxonomy. There are also other custom post types that use the same default WP ...
0
votes
1answer
19 views

Cannot use object of type WP_Error as array display category

I'm trying to deduce a category for my custom WordPress post, but I get this error. How to fix ? $events= wp_get_post_terms(get_the_ID(), 'events', array("fields" => "all")); <?php echo $...
0
votes
0answers
13 views

Wordpress Portofolio Conditional Templating - functions php

I'm trying to load some code depending on which portfolio category i am , but cant seem to get it quite right... I've read that portfolio categories are called taxonomies, but don't know if thats ...
1
vote
0answers
48 views

How to retrieve more posts from a custom post type that are in the same category as the current post

The site I'm working on is using a plugin IssueM that created a custom post type called article, and has a custom taxonomy called issuem_issue_categories that has categories such as boat-profile, ...
0
votes
0answers
18 views

woocommerce custom header image for each category

I have been reading every post and question for the past 5 hours and cannot find something that works for the theme I am using. I am using wordpress flooring theme for a flooring woocommerce website ...
-2
votes
0answers
11 views

Wordpress wp-admin new-post.php update catgories list via ajax

I have created custom post type and add some categories. Now I want to update categories list on add new post via ajax based on parent category Requirement: When I select Policy Issues of parent ...
0
votes
2answers
24 views

What code to use in an array to call the current sub-category?

On a page like taxonomy-product_cat.php - this function lists just the products for the called sub-category - bags: $args = array( 'post_type' => 'product', 'product_cat' => 'bags') $loop = new ...
0
votes
0answers
12 views

How to customize URL of posts under a specific category

How do I customize the URL of posts posted under a specific category? To customize the category page URL, i was able to use the plugin "custom permalinks".However, this does not change the URL of ...
1
vote
0answers
26 views

Wordpress admin categories sort show is wrong

I create categories like: A -- A1 -- A2 ---- A21 ---- A22 -- A3 B -- B1 -- B2 C But in new post on left side admin show wrong: A -- A1 ---- A21 ---- A22 B -- B2 C A2 A3 B1 Why? How I can fix it? ...
0
votes
2answers
52 views

List just subcategory and products of active category page in Woocommerce

Working on a category page - taxonomy-product_cat.php - I want to list all the subcategories of that category page, with all its products. I would think it is simple enough but I cant get it to work. ...
0
votes
1answer
30 views

wp_list_pages() exclude category

I tried adding this to a similar much older thread but didn't get a response so I am posting it as a new question. I have a large page based website that I am working on. Since it is mainly page ...

1 2 3 4 5 87