Dieses Plugin ist nicht mit den jüngsten 3 Hauptversionen von WordPress getestet worden. Es wird möglicherweise nicht mehr gewartet oder unterstützt und kann Kompatibilitätsprobleme haben, wenn es mit neueren Versionen von WordPress verwendet wird.

Category Color

Beschreibung

Easily set a custom color per Post Category and use the colors in your WordPress templates to spice up your theme. You can use it to color your Category names, your Post titles, background, lines, etc. in your Theme. Colors are always easily adjustable through your Category Edit screen

Screenshots

  • Kategorie-Bearbeitungsseite
  • Category Color Picker

Installation

  1. Unzip the download package
  2. Upload rl_category_color to the /wp-content/plugins/ directory
  3. Aktiviere das Plugin über das Menü „Plugins“ in WordPress

Manuelle Plugin-Installation

  1. Download Category Color Plugin to your desktop.
  2. If downloaded as a zip archive, extract the Plugin folder to your desktop.
  3. With your FTP program, upload the Plugin folder to the wp-content/plugins folder in your WordPress directory online.
  4. Go to Plugins screen and find Category Color Plugin in the list.
  5. Klicke zum Aktivieren des Plugins auf Aktivieren.

FAQ

Wie kann ich diese Farben zu meinem Template hinzufügen?

cat_ID;

if(function_exists(‚rl_color‘)){
$rl_category_color = rl_color($the_category_id);
}
?>

Now you used the color in your template in an inline stylesheet. The variable <?php echo $category_color; ?> can be used for anything.

Wie kann man Farben in einer einzelnen Beitragsvorlage hinzufügen?

In your WordPress theme, find the file where you want the color to appear. For instance single.php your single post will be shown. Find these lines:

<?php if (have_posts()) :  ?>
<?php while (have_posts()) : the_post(); ?>

WORDPRESS_EXTRA_CODE_DONT_REMOVE_IT

<?php endwhile; ?>
<?php endif; ?>

Don’t edit or remove the above lines, but add these lines in between instead:

<?php
    $category = get_the_category();
    $the_category_id = $category[0]->cat_ID;

    if(function_exists('rl_color')){
        $rl_category_color = rl_color($the_category_id);
    }
?>
<h1 style="color: #<?php echo $rl_category_color; ?>;"><?php the_title(); ?></h1>
<p style="background: #<?php echo $rl_category_color; ?>;">Awesome Category Color!</p>

Wie kann man eine Farbe in mehreren Kategorien hinzufügen?

Add the following code in your .php file, where you want to show the categories name.

<?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);
    }
?>

Warum kann man beim Erstellen einer Kategorie nicht gleich eine Farbe auswählen, sondern nur beim Bearbeiten einer Kategorie?

Both for consistency and efficiency. First of all WordPress want to keep creating Categories sweet and simple with as little effort as possible. Adding Colors can be considered as customizing Categories, thus it would be more logical to show it in the Edit section only.

Second, when writing a Post you can also quick-add a new category. For consistency’s sake we’d have to add the Colorpicker there too, which would be too much of a hassle user-wise at least.

Rezensionen

27. Oktober 2017
For inexperienced WP coder, it will be hassle to implement the colors into the frontend of the WP site. https://wordpress.org/support/topic/where-to-insert-the-code-1/#post-5822665) will get you started in the right direction. Also, https://wordpress.org/support/topic/color-picker-doesnt-work-1/ will resolve the issue if Color Picker doesn't show up in admin when editing Category.
Alle 7 Rezensionen lesen

Mitwirkende & Entwickler

„Category Color“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:

Mitwirkende

Übersetze „Category Color“ in deine Sprache.

Interessiert an der Entwicklung?

Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.

Änderungsprotokoll

1.2

  • Extra-Codes wurden entfernt.

1.1

  • Mehrere Kategorienfarben korrigiert

1.0

  • Erste Veröffentlichung