Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Zayed Baloch

    (@zayedbaloch)

    Hello, Which color you want to change on your homepage? Like the title or category font color or background colors etc?

    If is it possible to share with me the code or email me personally on zayedbaloch(at)gmail.com.

    Best;

    Plugin Author Zayed Baloch

    (@zayedbaloch)

    Please change <?php the category(); ?> tag with the following code.

    <?php
      $categories = get_the_category();
      $separator = ' / ';
      $output = '';
      if($categories){
        foreach($categories as $category) {
            $rl_category_color = rl_color($category->cat_ID);
            $output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '" style="color:'.$rl_category_color.';">'.$category->cat_name.'</a>'.$separator;
        }
        echo trim($output, $separator);
      }
    ?>

    Hi Zayed, sorry for asking the same question, but I think this is a truly great solution, and very nicely solved. But I do not understand which file do I need to go and do the modification. Is it functions.php, . . . index.php. I’m able to see some strings that look like it, but not quite the same.

    I would like to have a magazine look, were the visitor, with the colors, can have a quick view of the different categories.

    my site: http://www.guatecultura.org
    Thank you so much!!

    Plugin Author Zayed Baloch

    (@zayedbaloch)

    Hi Carlos,

    Check the index.php loop there have <?php the_category(); ?> function just replace the the_category function with the following code.

    <?php
      $categories = get_the_category();
      $separator = '';
      $output = '';
      if($categories){
        foreach($categories as $category) {
            $rl_category_color = rl_color($category->cat_ID);
            $output .= '<div class="featured-cat" style="color:'.$rl_category_color.';">'.$category->cat_name.'</div>'.$separator;
        }
        echo trim($output, $separator);
      }
    ?>

    Hope this will work same as you want. 🙂

    manolo13

    (@manolo13)

    Hi Zayed!

    That’s a wonderfull plugin. I sent you a message (zayedbaloch(at)gmail.com) regarding the code.

    Trying to figure out whre should i place it. Would appreciate your help.

    Thanks in advance.

    Plugin Author Zayed Baloch

    (@zayedbaloch)

    @manolo13: Check the FAQ section in plugin page, hopefully it will help you.

    https://wordpress.org/plugins/category-color/faq/

    Hi Zayed!

    This is just the plugin i need but I don´t understand how to use it. I would like to change some background colors and font colors of my posts depending on the category in my custom theme but I don´t know how. There is no <?php the_category(); ?> in my index.php ! I´m quite new in wordpress and don´t know how to make it work.

    Plugin Author Zayed Baloch

    (@zayedbaloch)

    Hay Madn,

    In your custom, where you want to display the category name with the respected color that you already selected from category section. Just paste the following code on your template home or single page.

    <?php
      $categories = get_the_category();
      $separator = '';
      $output = '';
      if($categories){
        foreach($categories as $category) {
            $rl_category_color = rl_color($category->cat_ID);
            $output .= '<div class="featured-cat" style="color:'.$rl_category_color.';">'.$category->cat_name.'</div>'.$separator;
        }
        echo trim($output, $separator);
      }
    ?>

    Hey Zayed!

    Thaks a lot for your quick answer! It´s working now. I´m really happy about it! ;D

    Thaks and have a nice day!

    Hi Zayed,
    It seems you made a great plug-in.
    In your faq, I’m confused about the “<?php the_category(); ?>”string.
    I don’t find any in my theme. I just have some “$categories_list = get_the_category_list” in content.php.
    Thanks in advance.

    Plugin Author Zayed Baloch

    (@zayedbaloch)

    @treeas: If you dont have “<?php the_category(); ?>” then simply paste the following code on your .php file where you want to show the category names.

    <?php
        $categories = get_the_category();
        $separator = ' / ';
        $output = '';
        if($categories){
            foreach($categories as $category) {
                    $rl_category_color = rl_color($category->cat_ID);
                $output .= '<a href="'.get_category_link( $category->term_id ).'" style="color:'.$rl_category_color.';">'.$category->cat_name.'</a>'.$separator;
            }
        echo trim($output, $separator);
        }
    ?>

    Hi Zayed,
    I’m new on wordpress;
    i download the plugin, i installed it and I changed the colors of my category, but I don’t understand where i have to insert the following code:
    <?php
    $categories = get_the_category();
    $separator = ”;
    $output = ”;
    if($categories){
    foreach($categories as $category) {
    $rl_category_color = rl_color($category->cat_ID);
    $output .= ‘<div class=”featured-cat” style=”color:’.$rl_category_color.’;”>’.$category->cat_name.'</div>’.$separator;
    }
    echo trim($output, $separator);
    }
    ?>
    Thanks in advance.

    Plugin Author Zayed Baloch

    (@zayedbaloch)

    Hi @gabry75

    When you want to show the categories name with the color, just paste the following code on your index.php, page.php or single.php file.

    <?php
        $categories = get_the_category();
        $separator = ' / ';
        $output = '';
        if($categories){
            foreach($categories as $category) {
                    $rl_category_color = rl_color($category->cat_ID);
                $output .= '<a href="'.get_category_link( $category->term_id ).'" style="color:'.$rl_category_color.';">'.$category->cat_name.'</a>'.$separator;
            }
        echo trim($output, $separator);
        }
    ?>

    If you need I will help to implement this as your website. Please send me a email on zayedbaloch(at)gmail(dot)com or share your website link.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Where to insert the code?’ is closed to new replies.