StudioPress Community Forums

StudioPress Community Forums (http://www.studiopress.com/support/index.php)
-   General Discussion (http://www.studiopress.com/support/forumdisplay.php?f=7)
-   -   Adding SubCategory to Article title on Home page (http://www.studiopress.com/support/showthread.php?t=10108)

marksperl 06-21-2009 05:55 PM

Adding SubCategory to Article title on Home page
 
On the front page, within the homepageright & homepageleft sections, I am trying to format the article titles to custom display next to the thumbnail. I would like it to be:

<sub-category> -- in one color, ie light blue - and linkable
<article title> -- in other color, ie. dark blue - and linkable
<read more> -- no article summary

similar example is on http://www.huckmagazine.com/

what is the coding on this?

my website it www.groupYnetwork.com

SoZo 06-21-2009 09:05 PM

Re: Adding SubCategory to Article title on Home page
 
You would need to add the category call

<div class="hpfeatured">
<?php $feature_cat_1 = get_option('lifestyle_feature_cat_1'); $feature_cat_1_num = get_option('lifestyle_feature_cat_1_num'); if(!$feature_cat_1) $feature_cat_1 = 1; //setting a default ?>
<h3><?php echo cat_id_to_name($feature_cat_1); ?></h3>



<?php $recent = new WP_Query("cat=".$feature_cat_1."&showposts=".$feat ure_cat_1_num); while($recent->have_posts()) : $recent->the_post();?>
<?php if( get_post_meta($post->ID, "thumbnail", true) ): ?>
[img]<?php echo get_post_meta($post->ID, [/img]" alt="<?php the_title(); ?>" />
<?php else: ?>
<?php endif; ?>
<?php the_category(', ') ?>: <?php the_title(); ?>

<div style="border-bottom:1px dotted #94B1DF; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>

<?php endwhile; ?>

Read More Posts From This Category

</div>

marksperl 06-22-2009 04:53 AM

Re: Adding SubCategory to Article title on Home page
 
Perfect, I also added
to break up the line.

Now how do I assign different colors to Sub Category & Article title.

Subcategory (color #5FCBF3)
Title (color #194989)

CharlesClarkson 06-22-2009 05:46 AM

Re: Adding SubCategory to Article title on Home page
 
Quote:

Originally Posted by marksperl
Now how do I assign different colors to Sub Category & Article title.

Learn how a CSS id works and add an appropriate id (if needed) so you can select the title or subcategory you are trying to control.

If you cannot find an easy way to select some text, you can use <span> or <div>. <span> is for inline markup and <div> is for blocks of markup.

ie: <span id="subcategory">Some Subcategory Name</span>

Now you can select the subcategory with #subcategory {}.


HTH,


All times are GMT -5. The time now is 03:37 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.