Viewing 2 replies - 1 through 2 (of 2 total)
  • Same here, sadly it looks like there’s no examples for newbies or this plugin isn’t supported. Pity ??

    Hi! You can use the following code (obtained in https://developer.www.ads-software.com/reference/functions/get_term_meta/)

    <?php
    //TO USE IN SINGLE LOOP (single.php)
    //Get the category from the current post in the loop
    $category = get_the_category();
    
    //get_term_meta documentation https://developer.www.ads-software.com/reference/functions/get_term_meta/
    $color = get_term_meta($category[0]->cat_ID, 'color', true);
    
    //Check if it has a color
    if($color){
      echo '<h1 style="color:', $color , '">Category Color</h1>';
    }
    //
    //
    //
    //TO USE IN CATEGORY LOOP (category.php)
    //Get the category used in the loop
    $category = get_category( get_query_var( 'cat' ) );
    
    //get_term_meta documentation https://developer.www.ads-software.com/reference/functions/get_term_meta/
    $color = get_term_meta($category->cat_ID, 'color', true);
    
    //Check if it has a color
    if($color){
      echo '<h1 style="color:', $color , '">Category Color</h1>';
    }
    ?>
    • This reply was modified 8 years, 3 months ago by vitorhugojapa.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot access color variable’ is closed to new replies.