editing fonts of category links from the_category() funtion

If you are using the_category() (so without passing parameters), the result will be something like: <ul class=”post-categories”> <li><a href=”https://wordpress.stackexchange.com/questions/262546/cat1″>Category 1</a><li> <li><a href=”http://wordpress.stackexchange.com/cat2″>Category 2</a><li> </ul> So a css line like .post-categories li a {font-family:Myfont;} should do it. Reference: the_category() calls get_the_category_list, which does the actual output. This function ends with a filter, which you could use … Read more

How Can I Display Categories Description

From the category_description( $category_id ) parameters description: Category ID. Will use global category ID by default. This means that if you are intending to use the global id, you don’t need to insert the variable $category_id which may be undefined in your use of the function. I’m assuming it is undefined because it is not … Read more

How to run select query of post with category and tags for API?

WordPress already has an API you can extend, and a class for querying posts! For example: // when the rest_api_init action/event happens add_action( ‘rest_api_init’, function () { // register a new endpoint register_rest_route( ‘mohnish/v1’, ‘/posts/’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘mohnish_awesome_func’, // that calls this function ) ); } ); // this is whats … Read more

Looking for the best solution to build this Blog structure? Picture attached?

There are various ways to achieve what you are talking about within WordPress. 1) Multisite/Network. For each City (or whatever your top level is), you create a new site with a default theme. This allows for either www.website.com/paris/music or paris.website.com/music, depending on your requirements. Introductory info on Network sites Creating a WordPress Network 2) Write … Read more

Stick multiple posts in a single category

Your category.php should have two loops — one for stickies, one for regular posts: <?php // get sticky posts array $sticky = get_option(‘sticky_posts’); // First WP_Query arguments $args = array( // include stickies ‘post__in’ => $sticky ); $query = new WP_Query( $args ); // First loop for stickies only if ( $query->have_posts() ) : while … Read more

WC 3.x Get categories from variable product of the cart

Ok, I resolved it. In a variable product $_product->get_id() is not of ID the product else is the ID only of these variation at cart. Then, in these loop can found the id of product in the variable $cart_item[‘product_id’] We can use it: $the_product = wc_get_product( $cart_item[‘product_id’] ); $array_cat = $the_product->get_category_ids(); Regards

Create blog page only to see one category

Normally the category url is www.homepage.com/category/slug-of-the-category/. You can find all categories and their url under Posts -> Categories in the backend of WordPress. So you don’t have to create a page, because the pages already exist.

Color different for the current category

By default it will add current-cat class to the current category item. If we need to change that, we can use: ‘current_category’ (int|array) ID of category, or array of IDs of categories, that should get the ‘current-cat’ class. Default 0. as mentioned in the dev docs for wp_list_categories() arguments: Then we can style it as … Read more

WordPress order categories by ID

wp_dropdown_categories() will list by id by default. It utilizes get_terms() as well, and provides a hook to toward the end if you wish to filter the html of $output further than the parameters allow. (I’ve added the source below). It has the following parameters: ‘show_option_all’ (string) Text to display for showing all categories. ‘show_option_none’ (string) … Read more