示例#1
0
<head>
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <?php 
wp_head();
?>
  <style type="text/css" media="screen">
  	<?php 
$categories = get_categories();
foreach ($categories as $key => $category) {
    $slug = $category->slug;
    if (function_exists('rl_color')) {
        $rl_category_color = rl_color($category->term_id);
    }
    echo '.' . $slug . ' h3{
    		background-color:' . $rl_category_color . ';		
    	}
    	.' . $slug . ' h4 > a,.' . $slug . ' h5 > a{
    		color:' . $rl_category_color . ';			
    	}
    	.' . $slug . '-cat-color{
  			color:' . $rl_category_color . ';
  		}
  		.' . $slug . '-cat-bg-color{
  			background-color:' . $rl_category_color . ';

  		}
  		.' . $slug . '-cat-br-color{
  			border-color:' . $rl_category_color . ';
  			
示例#2
0
            $margin = '';
        }
        ?>
			<article id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class('column-three-story column-story clearfix');
        echo $margin;
        ?>
>
				<?php 
        if ($column_three_cat == '' or $column_three_cat == 'none') {
            $cats = get_the_category();
            if (function_exists('rl_color')) {
                $category_three_color = 'style="background-color: ' . rl_color($cats[0]->term_id) . ';"';
            } else {
                $category_three_color = '';
            }
            ?>
<h5 class="label-head" <?php 
            echo $category_three_color;
            ?>
><a href="<?php 
            echo esc_url(get_category_link($cats[0]->term_id));
            ?>
" <?php 
            echo $category_three_color;
            ?>
><?php 
            echo $cats[0]->cat_name;