Stack Exchange Network

Stack Exchange network consists of 175 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 [wp-list-categories]

Display or retrieve the HTML list of categories.

0
votes
1answer
18 views

Display All Top Child Categories / Taxonomy

I want to display the top 10 child taxonomies, no parent. This code gets 1 top parent taxonomy, then only displays it's 10 children. I would like to grab top 10 child taxonomies of all parents of ...
1
vote
1answer
17 views

How to exclude children categories of parent category

I want to list only certain categories and exclude a particular parent and all its children. The reason is so that if a new child category is added, it won't show up by default. With ...
0
votes
3answers
93 views

How to show category list in WordPress

If anyone know, if there's plugin to customize taxonomy list it will be faster to do. But here's my question. i create post type "product" and the categories. inside post type product, i make ...
0
votes
1answer
16 views

Retrieving Categories based on the first character of the name

I was wondering how I can get information from the wp_list_categories object just using the first character of the category name. For example, I want to get the listing of categories based on the ...
0
votes
1answer
34 views

Include Parent Term in wp_list_categories

I am using the script below to list the custom taxonomies, but I still need a link to the parent of the current custom taxonomy for an "All" link. Right now the links display as: Shoes Shirt T-...
0
votes
1answer
28 views

Argument for if term-> have child?

I am using the code off this page: https://www.wpbeginner.com/wp-tutorials/how-to-display-child-taxonomy-on-parent-taxonomys-archive-page/ However my Custom taxonomy has more depth for cities, state, ...
0
votes
0answers
15 views

How to list all categories a post is in, but exclude current post´s category on single post page

I´d like to list all categories (links) a post is in, like when I use "the_category()", but need to exclude the current category. Ex: Post name is "Bob Marley´s songs", published in the categories "...
1
vote
1answer
41 views

List subcategories of a specific product category (adapting from posts to products taxonomy)

I made the below for my sidebar to show the subcategories of a specific category (ID 89) of my choosing. Only the subcategories that the post is in appear. Works great. Now I want to change my posts ...
1
vote
1answer
10 views

Highlight “Show all” item in wp_list_categories

I use wp_list_categories to display category filters on post archives. I can use current_category param to set current category - and such item will get addition class current-cat. I can even omit ...
5
votes
4answers
45 views

How to display only 3 main categories, separated by commas, since they are marked in the post?

I want to display only 3 categories (Ex: horses, dogs, birds), names only and comma separated, in my Post, since one of them, two or all tree are marked in the post. <span><?php if ( '...
0
votes
1answer
19 views

How can I display categories on different pages

I am working on a theme. Woocommerce categories are displayed on home page but I need to add on shop page, product page and category page. How can I do this.
0
votes
2answers
31 views

No hierarchy in wp_list_categories with child of and depth

Say a site has a category structure like: Dogs Boxer Fawn Brindle Rottweiler Cats Calico Siamese Using it shows that and adds classes so that you can style it accordingly such as making ...
0
votes
1answer
95 views

Show child taxonomies (that have posts) of the current parent taxonomy

For the life of me I can't see why this isn't working. It works fine like this (normal categories) <?php if (is_category()) { $cur_cat = get_query_var('cat'); if ($cur_cat) { $...
0
votes
0answers
22 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 ...
0
votes
1answer
32 views

How can I create a Category Index page that lists all categories?

I have themed my category.php file so it now displays all posts that belong to the category that was clicked. The URL looks like [www.example.com/category/news/]. This is good and correct. When I go ...
1
vote
1answer
31 views

How would I go about pulling the most popular (most used) categories?

I am trying to use WordPress' built in function for calling a list of categories. Unfortunately there doesn't appear to be an argument for how to pull the most popular categories (say top 5). I am ...
0
votes
1answer
24 views

Problem with wp_list_category with custom taxomy

I have a custom hierarchical taxonomy and I want to list in a dropdown menu all the top level "category" of the taxonomy that have post. In my functions.php I've added this code: function ...
0
votes
0answers
976 views

List subcategories of active parent category (WooCommerce)

I want to list out the child categories when on the parent category page. Here's what I've got so far: <?php $cat_id = get_query_var('product_cat'); ...
0
votes
3answers
69 views

Show posts from categories instead of tags

I am trying to change this wordpress function given in my theme to show posts from category instead of tags. But due to wordpress beginner i am unable to do this. Please help me to change this code....
2
votes
2answers
467 views

Exclude Child Categories Using wp_list_categories

$category = get_category( get_query_var( 'cat' ) ); $child_cats = (array) get_term_children( $category , 'category' ); wp_list_categories( array( 'exclude' => $child_cats ) ); Is it ...
0
votes
1answer
52 views

How to Retrieve All Category Images on Front-End

I am trying to retrieve all the images from every category. wp_list_categories gives me all the titles of categories but I need only the images of category and the permalinks of the individual ...
0
votes
1answer
720 views

ACF Custom field not showing in Timber Taxonomy page

Issue: I am unable to display ACF custom fields while looping through taxonomies. I have an ACF text field called 'icon'. After applying it to my custom taxonomy 'topic' (and categories while ...
0
votes
0answers
15 views

Alpha list no longer works it multiple names

I have a theme that worked very well using this code but on Version 4.8.3 its no longer valid. $terms = get_terms( "ingredient", array( 'name__like' => $letter ) ); to return all posts where the ...
1
vote
1answer
76 views

Replace li Items with divs with classes

I'm trying to output the categories of my custom post type but instead of them displaying as li items, I woujld like them each to be a div so I can style them in nice floated boxes... The code I have ...
0
votes
1answer
43 views

With wp_list_category put every existing category into an option tag

Like the title says, I'm using wp_list_categories to get all of the existing categories of my website listed. I would like to achieve this: <select class="filters-select"> <option value="....
0
votes
2answers
847 views

Get the category name outside of the loop in category.php

I am in a category.php, and I have to write the category name outside of the Loop. The category name needs to be pulled dynamically through PHP. <p>You are browsing <?php get_the_category ?&...
2
votes
2answers
2k views

List with categories, subcategories and posts of custom posttype

I am trying to query a list with all Categories, Subcategories and Posts of a custom post type. e.g.: Maincat1 -Subcat1 -Post1 -Post2 -Subcat2 -Subcat3 Maincat2 -Subcat3 -...
1
vote
2answers
47 views

How to display terms from a custom taxonomy in a hierarchy AND with custom html markup?

I've created a custom taxonomy (locations) which is hierarchical, and would like to: a) display an unordered list that respects the hierarchy AND b)customize the display output so that I can specify a ...
1
vote
1answer
50 views

Shortcode - Getting Categories appears on top of website

I tried using ob_start but still my categories query in the shortcode appears on top of the site and outside its container. any ideas what's wrong here? function life_shortcode(){ $args = array('...
1
vote
1answer
384 views

Color different for the current category

I would like to change the color of the current category in this page : my code for display category is : <ul class="ul-cat"> <?php wp_list_categories( array( 'orderby' ...
0
votes
0answers
226 views

Add and Custom category for posts “PAGE”

I want to create custom category page for posts "PAGE" for an internal use. The categories will be the list of the clients I want to remove somes fields (like slug, description, parent category ...
0
votes
1answer
81 views

Category removal - Portfolio Category:

I am having trouble removing the "Portfolio Category:" text on this page http://www.dpwilliams.com/project-category/abstract/ which is automatically added to the headline. Is there a way to add a ...
0
votes
1answer
101 views

Alphabetically Ordered Category in Wordpress

In wordpress I'm trying to show the list of categories in a page. I'm simply using the function "wp_list_categories" to show the categories and it actually works pretty well however, I would like to ...
-1
votes
1answer
224 views

Listing categories on a wordpress page

I've been looking for a way to display categories on a wordpress page. I came across the wp_list_categories function which works, but the only downside is that I have a bunch of categories and don't ...
-2
votes
1answer
739 views

custom texonomy category child category list with parent head

hello i just want to make a list of custom child category list under the parent and the parent as a header as bellow
2
votes
3answers
141 views

How can I set custom order use this function

I have a sample: CODE PHP: <ul class="categories-list"> <?php wp_list_categories('title_li='); ?> </ul> This code displays the category list sorted by name. What I want ...
3
votes
1answer
974 views

Get child categories when clicking on parent category

I'm not sure how i do this, i have set it up correctly in the back end so for example i have a category 'bars and pubs' and i have 3 other categories 'x' 'y' 'z' and all there parents are bars and ...
0
votes
1answer
94 views

How to modify default category widget list display?

I am using default category widget in blogs posts page in sidebar. I am able to display categories with count but the view is not looks good. I want to know the file which is having the list . I am ...
1
vote
1answer
1k views

Category list with indent children list below current category

I am trying to create a widget to display all the top level categories of my custom taxonomy that have items in them. If you click on one of the categories, you will go to that page and the current ...
0
votes
1answer
166 views

display a link to all the categories of current post, including parents

amazingly, this seems to be hard, and I don't see the answer anywhere online. simply list all the category of the current post (on single.php), but also all the parent categories of it. <?php ...
0
votes
2answers
1k views

How to create a array that contains all of the children slugs of a specific parent category

I need to create an Array that contains all of the children slugs of a specific parent category ID. Let's say I have the following parent category and its children categories: Food pizza bread ...
1
vote
0answers
446 views

How do I get the sub categories of the parent when in a sub category?

Im having an issue with a widget I'm building. It shows you the sub categories of the selected category page and displays them in a list like so. appologies for the subject of the site. But when I ...
1
vote
1answer
392 views

Swapping wp_dropdown_categories function with wp_category_checklist

I am trying to change a field in a search widget by going into the php files and altering the wp functions. I currently am trying to change a dropdown select box to a check box for categories (parent ...
0
votes
1answer
519 views

Display children of the category a post is assigned to

The following code works to display all child categories of a parent (when viewing a parent category), and all siblings of a child category (when viewing a child category) within sidebar.php. The same ...
0
votes
1answer
72 views

list categories based on updated posts [closed]

I mean to order the of categories should be based on the updated posts. The category which has most recent post should come up first and so on. Suppose, I have 50 categories and i add new post very ...
3
votes
2answers
2k views

List of subcategories with featured image

In a page, I need to display a list of all sub categories of a specify category. For example, in the category Sport have 6 subcategories: Swim Football Basket Ski Hockey Each ...
0
votes
2answers
1k views

Access current post parent and sub category

I need to show in the each post his parent category and sub category, at the moment I use this code: <?php $categories = get_the_category(); echo 'Parent Category: <a href="' . esc_url( ...
4
votes
1answer
2k views

wp_list_categories: order by term order?

I am currently using WordPress' wp_list_categories function in order to retrieve my terms from a specified taxonomy. I like this function for its ability to generate (hierarchical) HTML lists, that ...
0
votes
0answers
514 views

how to avoid reloading/refresh the page when displaying the post of wp_list_categories

I have a wp_categories_list in my site and it displays all of my categories. Now when i click one of my category, it displays the posts within that category by refreshing. How can i avoid refreshing/...
0
votes
1answer
85 views

How to list categories by page id in wordpress

I want to create a sidebar with below hierarchy. All courses, padi courses (these are pages) ---divetravel (these are categories) ---suba courses (these are categories) Can someone help me out ...