• I recently redesigned my blog using the Fluxipress theme.

    On the homepage, posts are highlighted as you mouse over them. Is it possible to have the color change depending on the post category? (i.e., Category 1 is blue when you mouse over, Category 2 is green when you mouse over, etc.)

    Here is the code from content-postlist.php:

    <div id="post-list">
    			<div id="col1" class="col"></div>
    			<div id="col2" class="col"></div>
    			<div id="col3" class="col"></div>
    			<div id="col4" class="col"></div>
    <?php
    		$i = 0;
    		while(have_posts()) :
    			the_post();
    			$displayExcerpt = (bool) get_theme_mod('fluxipress_display_excerpts', true);
    			$displayMoreLink = (bool) get_theme_mod('fluxipress_display_more', true);
    
    			$classes = array();
    			if(!$displayExcerpt) $classes[] = 'no-excerpt';
    			if(!$displayMoreLink) $classes[] = 'no-more';
    ?>
    			<div id="post-<?php echo $i++; ?>" <?php post_class(implode(' ', $classes)); ?> title="<?php echo htmlspecialchars(strip_tags(get_the_title())); ?>">
    				<?php if(is_sticky()) : ?><span class="sticky-icon"></span><?php endif; ?>
    				<?php if(!$displayMoreLink) : ?><a href="<?php the_permalink(); ?>" title="<?php echo htmlspecialchars(strip_tags(get_the_title())); ?>" class="no-more"><?php endif; ?>
    				<?php the_post_thumbnail('medium', array('class' => 'post-thumb', 'alt' => htmlspecialchars(strip_tags(get_the_title())))); ?>
    				<h2><?php the_title(); ?></h2>
    				<?php if($displayExcerpt) : ?><span><?php echo strip_tags(get_the_excerpt(), '<strong><em>'); ?></span><?php endif; ?>
    				<?php if($displayMoreLink) : ?><span class="tr"><a href="<?php the_permalink(); ?>" title="<?php echo htmlspecialchars(strip_tags(get_the_title())); ?>"><?php echo get_theme_mod('fluxipress_more_link', __('more&hellip;', 'fluxipress')); ?></a></span><?php endif; ?>
    				<?php if(!$displayMoreLink) : ?></a><?php endif; ?>
    			</div>
    <?php
    		endwhile;
    ?>
    		</div>
    
    		<?php
    			global $posts_per_page, $wp_query;
    			$paged = get_query_var('paged') ? get_query_var('paged') : 1;
    			if($wp_query->found_posts > $posts_per_page || $paged > 1) :
    		?>
    		<div id="post-navi">
    			<div class="prev"><?php next_posts_link(__('&laquo;&nbsp;Older posts', 'fluxipress')); ?></div>
    			<div class="next"><?php previous_posts_link(__('Newer posts&nbsp;&raquo;', 'fluxipress')); ?></div>
    		</div>
    		<?php endif; ?>

    And this is part of functions.php:

    // post box color
    	$wp_customize->add_setting(
    		'fluxipress_postbox_color',
    		array(
    			'default'	=> '#ffffff',
    			'transport'	=> 'refresh',
    		)
    	);
    
    	$wp_customize->add_control(
    		new WP_Customize_Color_Control(
    			$wp_customize,
    			'fluxipress_postbox_color',
    			array(
    				'label'		=> __('Post Box Color', 'fluxipress'),
    				'section'	=> 'fluxipress_color_options',
    				'settings'	=> 'fluxipress_postbox_color',
    			)
    		)
    	);

    Thanks for your help!!!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different Colors For Different Posts’ is closed to new replies.