Apply custom category template to subcategories

If a is the category slug, then following code would work – add_action(‘template_include’, ‘wpse129481_template_include’); function wpse129481_template_include($t) { // is category archive page if( is_category() ) { // current queried category id from queried object $child_id = get_queried_object_id(); // parent category object, getting it by slug. $parent_cat = get_term_by(‘slug’, ‘a’, ‘category’); // current category object, can … Read more

How Do I Merge Categories With phpMyAdmin

You can’t simply “merge categories” you have to change the category that each post is associated with. The table WP_TERM_RELATIONSHIPS links posts with categories. You could try something like this: UPDATE wp_term_relationships SET term_taxonomy_id = (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id = 112748) WHERE term_taxonomy_id = (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id = 112747) You … Read more

How to get only the last child of category slug?

Create a custom taxonomy for cities, and then use get_the_terms() to display the term slug in the image URL. ALTERNATIVE If you’re only wanting the last slug, you can use PHP for that. Place this at the very top of the file just after get_header() : <?php /* Grab the link. */ $link = $_SERVER[‘PHP_SELF’]; … Read more

Dropdown category filter

I don’t see where your posts are pulling from, just the category list, but you are most likely missing the post_count variable where you have your query args to retrieve the posts. post_count=-1 will return all, but it defaults to 10 (or whatever is set in your settings) if you do not specifically say otherwise.

How i can let users add notes to my posts

There are number of possibilities here: 1- Giving users the ability to edit posts and add notes. This is not something you want to do. As it might create many issues for you. However, you can use a Wiki plugin if you want to pursue this option. 2- Enabling notes through comments. This is a … Read more

display woocommerce all category title on home page

<?php $post_type=”product”; $taxonomies = get_object_taxonomies((object) array( ‘post_type’ => $post_type )); foreach ($taxonomies as $taxonomy) : $terms = get_terms($taxonomy); foreach ($terms as $term) : $term_link = get_term_link($term->term_id); $posts = new WP_Query( “taxonomy=$taxonomy&term=$term->slug&posts_per_page=2″ ); ?> <li> <h2> <a href=”https://wordpress.stackexchange.com/questions/218036/<?php echo $term_link; ?>”><?php echo $term->name; ?></a> </h2> <?php if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post(); ?> <div> … Read more