Articles of categories

Get woocommerce catogry

Hello (sorry for bad english) i want know how can i get the category list in woocommerce . with this code i get wordpress category list function gaga_lite_category_lists(){ $categories = get_categories( array( ‘hide_empty’ => 0, ‘exclude’ => 1 ) ); $category_lists = array(); $category_lists[0] = __(‘Select Category’, ‘gaga-lite’); foreach($categories as $category) : $category_lists[$category->term_id] = $category->name; […]

How to find all posts without category and assign the “Uncategorized”?

Hi is there anybody who can help me how to find all posts without category and assign the “Uncategorized”? I have more than 7000 posts and 300 of them are without category, how I could assing one? And another question, how I can assign category to all posts (except bulk edit which doesnt work well […]

How to get this only in small letters (lowercase)?

I used the following code to give out the category name (without link) in a single post. How would it be possible for the category name that is given out to only appears in small letters ? I just think this has to be made with substring, but I dont get it 🙂 Could somebody […]

“All posts” in the category widget

The Category widget shows the list of existing categories. I need this list to begin with “All posts”, with the count of all posts in the brackets.

Different template for subcategories

I would like to have a different template for categories and subcategories The categories template is set in categories.php is it somehow possible to load the subcategories template from subcategories.php or something like that?

Why does accessing url by category cause issues with post types?

I just built a site with a few CPTs (apple, banana, cucumber). My boss wanted to split them out into categories (red, yellow, green) and link to the category pages. As soon as we did and accessed the page via category in the URL, the page is not displaying correctly. Specifically, mysite.com/category/red is displaying the […]

Posts from custom post type not shown in “category” archive

I’ve created multiple custom post types which should share “category”. Creation is done like this: $args = array( ‘label’ => __(‘MyPostType’, ‘key’), ‘description’ => __(‘MyPostType’, ‘key’), ‘labels’ => $labels, ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’, ‘author’, ‘thumbnail’, ‘comments’, ‘trackbacks’, ‘revisions’, ‘custom-fields’), ‘taxonomies’ => array(‘category’), ‘hierarchical’ => false, ‘public’ => true, ‘show_ui’ => true, ‘show_in_menu’ => true, […]

How to select product category while adding new product in woocommerce?

I am beginner in wordpress. I have WooCommerce website & have hundreds of product categories. I want to assign related category to the product while adding it, how can i do this?

store posts_id of category into a varable?

I have ten posts in my query that belong in three categories: cat-a,cat-b,cat-c. I’m looking for a way to store $posts_ids from each category into a variable. Say for example, if three posts are in “category-a” then store those posts_ids in a variable. Cat-a Post 1 ID->435 Post 2 ID->477 Post 3 ID->488 $idcata = […]

How do I add Category Body Classes to Admin?

So why are category classes not added to the admin body class with this function? I see the current post ID in page source as part of the complete body class, so the basic function of adding body classes to admin with admin_body_class does work. Any ideas? function base_admin_body_class( $classes ) { // Current action […]