Articles of categories

Programmatically Create Category and sub Category

i create category have name Brand with this code. i have total 3 categories and each have 3 subcategories. how to output 3 category and 3 subcategories for each category? function.php code function insert_category() { if(!term_exists(‘brand’)) { wp_insert_term( ‘Brand’, ‘category’, array( ‘description’ => ‘sample category.’, ‘slug’ => ‘brand’ ) ); } } add_action( ‘after_setup_theme’, ‘insert_category’ […]

Custom post type categories gives 404 error

I’ve created a custom post type for a website. This is the code: //EVENTS // Register Custom Post Type function events_post_type() { $labels = array( ‘name’ => _x( ‘Eventi’, ‘Post Type General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Eventi’, ‘Post Type Singular Name’, ‘text_domain’ ), ‘menu_name’ => __( ‘Eventi’, ‘text_domain’ ), ‘name_admin_bar’ => __( ‘Eventi’, […]

Show subcategories on a parent category page

I want to show list of the subcategories when you click on the parent category page. I will be really grateful if someone can help me.

Remove any product that is featured from regular display loop

I have set up a custom loop to display featured products at the top of their relevant category pages. but now I would like to go about removing featured products from the regular loop below, which is using the standard woocommerce code to display products, Any help would be greatly appreciated http://onthesquareauctions.com/index.php/product-category/emporium/furniture/chairs-emporium/

Post Query not working

I have made a widget in my functions.php, like this: class Categories_Widget extends WP_Widget { function __construct() { parent::__construct( ‘categories_widget’, // Base ID (‘Categoriën tonen’), // Name array( ‘description’ => ( ‘Toon categoriën’ ), ) // Args ); } function widget($args, $instance) { extract($args, EXTR_SKIP); echo $before_widget; //echo “<h1>This is my new widget!</h1>”; include ‘inc/categories.php’; […]

Template hierarchy: how to let category.php conditionally-load archive.php?

In WordPress template chaining for categories, we have WP looking for: category-slug.php → category-id.php → category.php → archive.php → index.php Now, I’d like to make some tweaks in category.php, for instance insert some conditions over there, and if the condition is true, use a particular template (custom) otherwise continue processing the chain moving control as […]

Two Sections on Woocommerce Catergory Page

I would like to be able to customise the layout of the category pages of my website. If possible, I would like to make it so that products will appear in two sections, determined by a custom attribute (in this case an attribute we’ll call ‘Showroom’). This would be a checkbox attribute. Then on the […]

show WordPress categories with different Structure

i want to display all wordpress Categories with different structure and i dont want use the list structure . i want to choose my own elements in structure like this : <div> catname <input type=”hidden”> <div class=”sub”>subname<input><div class=”secondsub”></div></div></div> Guide me please . thanku

Loading Posts & Category with Ajax

Is there any way to make this function also output another html template with the current selected category’s data? function load_cat_posts () { $cat_id = absint($_REQUEST[‘cat’]); $args = array ( ‘cat’ => $cat_id, ‘posts_per_page’ => 10, ‘order’ => ‘DESC’ ); global $post; $posts = get_posts($args); ob_start (); foreach ( $posts as $post ) { setup_postdata( […]

Automatically select categories on new post based on GET value

Im looking for a solution in admin panel when admin click on a specific link to add new post automatically select one or more categories based on GET value. for example if admin click on fallowing link wp-admin/post-new.php?cat=news in the add new post page automatically check the news category in category selection section.