how do i set an image for a category in admin panel

Before questioning please search for the available resources. I’ve found two available plugins: Categories Images – WP Plugins WPCustom Category Image – WP Plugins I personally used the first one, and grabbed the necessary code from the plugin to implement my own version, and it worked perfectly.

in_category in index.php

The following code is working for me. I tied in a child theme of TwentyTwelve. Just copy and replace your index.php with the following and let me know (And don’t forget to change the category slug as per your database): <?php if( have_posts() ) : while( have_posts() ) : the_post(); if(in_category(‘aciform’)) { echo ‘<h2>’.get_the_title().'</h2>’; } … Read more

How to show video from wp option value?

Your code: $cat_data = get_option(“category_$cat_id”); if ( isset($cat_data[‘extra1’] ) ){ echo do_shortcode(‘[videojs youtube=”‘.$cat_meta[‘extra1′].'” width=”699″ height=”269″ preload=”auto” loop=”true” autoplay=”false” controls=”false” class=”responsive-video”]’); } There’s a number of things you’re not doing or could do better here: You never check if the option exists, if get_option doesn’t find anything and returns a value of false your code may … Read more

How to display category list with category description

Use this instead of wp_list_categories( $args ); wp_list_categories( $args ); It will display the category with formatted results like <ul><li> $categories = get_the_category(); This will returns the all category assigns to the current post and store in $category variable. Then you can display as in you listed format $page_custom_image = get_field(“your_custom_field_name”, “texonomyname_” .$category->term_id);

Woocommerce – Display product category of product in Orders page

Add Below Code in Your Theme function.php function action_woocommerce_admin_order_item_headers( ) { ?> <th class=”item sortable” colspan=”2″ data-sort=”string-ins”><?php _e( ‘Item category’, ‘woocommerce’ ); ?></th> <?php }; // define the woocommerce_admin_order_item_values callback function action_woocommerce_admin_order_item_values( $_product, $item, $item_id ) { ?> <td class=”name” colspan=”2″ > <?php $termsp = get_the_terms( $_product->id, ‘product_cat’ ); if(!empty($termsp)){ foreach ($termsp as $term) { … Read more

All post of child category not in top category

Maybe something like this would do? $cat=”About us”; $tax = ‘category’; $cat_id = get_cat_ID($cat); $category = get_term_children($cat_id, $tax); $pre=””; foreach ($category as $sub) { $cat_list .= $pre . $sub; $pre=”, “; } query_posts(array( ‘cat’ => $cat_list, ‘posts_per_page’ => 1000)); echo ‘<ul>’; while ( have_posts() ) : the_post(); echo ‘<li>’; the_title(); echo ‘</li>’; endwhile; echo ‘</ul>’;

How to get Woocomerce categories count

If anyone needs it $args = array( ‘type’ => ‘product’, ‘parent’ => get_queried_object_id(), ‘orderby’ => ‘term_group’, ‘hide_empty’ => true, ‘hierarchical’ => 1, ‘taxonomy’ => ‘product_cat’, ‘pad_counts’ => false ); $cats = get_categories( $args ); print_r(count($cats));