FYI: I am using Post Tags and Categories for Pages by curtismchale Version 1.4.1. I don’t understand the details (below) but I believe that this plugin has no effect on display of labels. Post Tags and Categories for Pages adds the stock WordPress categories for all of your pages. Pages will show up in the stock WordPress archive queries.
I have this category on my wordpress:
Now iam at url:
http://localhost/wordpress/category/test1
I write the following code on file category-test1.php
I'm trying to show sub category of Test1 but the code only return array(). What did I miss?
Permana
PermanaPermana
4 Answers
Is that category empty? By default WordPress hides emptr categories. try:
Edit: Fixed, thank you @Stoep
LobsterManLobsterMan
The
child_of
argument of get_categories
specifies the category by it's ID - assuming you created your categories in order, the code get_categories('child_of=2')
is probably requesting the subcategories of Sub1OfTest1.
To get the ID of a category, go to Posts → Categories and click on a category. The cat_ID will be in the url of the page.
Adam HopkinsonAdam Hopkinson
![Wordpress Wordpress](/uploads/1/2/4/8/124851151/552180828.png)
try this too - Show wordpress subcategories only
that topic might help too, as there are different solutions for showing subcategories.
Community♦
T.ToduaT.Todua
//This is coding of getting sub category and sub-sub category
SparkySparky
Not the answer you're looking for? Browse other questions tagged wordpresswordpress-theming or ask your own question.
The Shop page is one of the most important pages on the E-Commerce website. Since the consumers can’t physically view what all products you are selling, it is very important to present a shop page in a way to make it easier for them to stay on the website and make a purchase decision.
This post is specifically for those who have built up the stores using the WooCommerce plugin. In this post, we will see how to show all product categories on shop page using WooCommerce customizer and how to hide WooCommerce categories from being displayed on the shop page.
WooCommerce lets you decide how you want your products to be displayed on a Shop page. Using Product Catalog under Appearance-> Customize->WooCommerce you can show the WooCommerce Shop page in a unique manner. For example, you can display only category, the category with products or only products.
- Show products: All the product will be listed.
- Show categories: All the categories will be listed
- Show categories and products: Products and Categories both will be listed.
If we select ‘Show categories‘ option under ‘Shop page display‘ then all the product categories will be displayed on the Shop page as shown in the below screenshot.
As you can see in the above screenshot, four categories are being listed on the Shop page. The first one is ‘Uncategorised’ category, which contains all the products that don’t have any category assigned then it will be considered in the ‘Uncategorised’ category. Other categories are Men, Women, Kids & Baby.
Hide a WooCommerce Category from Shop Page
In some scenarios, you don’t want to display some categories on the Shop page. Like the ‘Uncategorised’ category appearing on the shop page and that is ruining the presentation of it. Either by giving the correct name to this category or by hiding it from being listed on the Shop page the presentation of the shop page can be improved.
So let’s see how to hide WooCommerce categories from being displayed on Shop using a small piece of code as shown below.
I have added this code snippet in my currently active theme’s functions.php file. The magic of this code snippet is, it has removed the ‘Uncategorised’ category being displayed from the shop page as shown in below screenshot.
Important: Even though the category is being hidden from Shop page, but it is still accessible via URL.
Increase WooCommerce Store Sales
'I purchased Woo Commerce Abandoned Cart Pro for two websites and after three days of it being active, the plugin paid for itself with recovered sales.
I had one issues with setting up the plugin in one of my websites because of the custom nature of the site, however tech support was very responsive and fixed all the incompatibilities themselves – was definitly the best tech support service I have ever received.
Couldn’t recommend this plugin more – if you are having a high number of abandoned carts then this is then this plugin is for you!' - Timmy Weston