How to echo Tags and Categories as plain text

Yes, there’s many ways to do it, You must add parameters to the function to override default value, first parameter must be empty the_tags( ” ); echo ‘<meta itemprop=”keywords” content=”‘. the_tags( ”) .””/>’; There is also wp_get_post_terms() function if you want more control, Create a function in functions.php function wpse_get_tags(){ global $post; $term_list = wp_get_post_terms($post->ID, …

Read more

Limit Category/Tag Dropdown To blog_id in Multisite Install With Global Categories/Tags

The wp_dropdown_category seems to not accept the mera_query parameter codex Maybe you must perform à special query , note that the meta_query must be an array of array. ‘meta_query’=> array( array( ‘key’ => ‘blog_id’, ‘value’ => $blog_id, ‘compare’ => ‘=’ ) ), With the new query you’ll be able to compose your dropdown by looping …

Read more

Different template for subcategories

The template hierarchy has filters for all types of templates. Here we can use category_template, check if the current category has a parent, and load the subcategory.php file in that case: function wpd_subcategory_template( $template ) { $cat = get_queried_object(); if ( isset( $cat ) && $cat->category_parent ) { $template = locate_template( ‘subcategory.php’ ); } return …

Read more

Issue with WordPress category search

You can search post by modify the query using pre_get_post filter. add this code inside your functions.php file add_filter(‘pre_get_posts’, ‘search_by_category’); function search_by_category($wp_query) { if (isset($_GET[‘cat’]) && !is_admin()) { $wp_query->set(‘category__in’, array($_GET[‘cat’])); } } Before using any query variable you must have to register/add using add_query_var. function add_category_query_string() { global $wp; $wp->add_query_var(‘cat’); } add_filter(‘init’, ‘add_category_query_string’); let me …

Read more

How to display child-category PAGES on a category page

<?php get_header(); $cb_cats = get_the_category(); $cb_cat_id = get_query_var(‘cat’); $cb_blog_style = cb_get_blog_style(); $cb_cat_title_bg = $cb_tax_id = $cb_taxonomy = $cb_tax_qry = NULL; $cb_archive_title_bg_src = cb_archive_title_bg(); if ( function_exists(‘get_tax_meta’) ) { $cb_category_color_style = get_tax_meta($cb_cat_id, ‘cb_cat_style_color’); $cb_featured_option = get_tax_meta($cb_cat_id, ‘cb_cat_featured_op’); $cb_category_ad = get_tax_meta_strip($cb_cat_id, ‘cb_cat_ad’); $cb_category_color = get_tax_meta($cb_cat_id, ‘cb_color_field_id’); if ( ($cb_category_color == ‘#’ ) || ( $cb_category_color == NULL …

Read more