List subcategories of active parent category (WooCommerce)
List subcategories of active parent category (WooCommerce)
List subcategories of active parent category (WooCommerce)
You can use wp_insert_post like this: $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is my post.’, ‘post_status’ => ‘publish’, ‘post_author’ => 1, ‘post_category’ => array(8,39) ); // Insert the post into the database wp_insert_post( $my_post ); Ref: https://codex.wordpress.org/Function_Reference/wp_insert_post use wp_update_post to update posts.
You can achieve categories and sub-categories this way. <?php $list_categories = get_categories( $args ); echo “<div class=”container”>”; echo “<div class=”productsubmenu”>”; echo “<ul>”; foreach ($list_categories as $cat) { if($cat->category_parent == 0) { $category_id = $cat->term_id; echo ‘<li class=”parent ‘.$my.’ “><a href=”‘.get_term_link( $cat ) . ‘”>’.$cat->name.'</a>’; $args2 = array( ‘taxonomy’ => $taxonomy, ‘child_of’ => 0, ‘parent’ => … Read more
Multiple category archive page
Order categories by name or view count
query cat orderby and order not working
I finally found an answer. It didn’t work the first few times I used it, but after reworking some HTML and with a better grasp of what I’m doing, I was able to put this together. This was from an answer here on W.SE but I can’t locate it anymore: <?php $custom_query = new WP_Query( … Read more
Huge category CSV import does not work
You need to make your category name translation ready. You can do so by using WordPress functions such as __(‘Your category’,’your-text-domain’), _x(‘Your Category’, ‘your context’, ‘text domain’) and more click here. After that, you can use poedit or other tool to extract translatable strings form your code and create your_locale.po file which contain your custom … Read more
add_rewrite_endpoint returns 404 on archives