SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Wordpress question. Can I make my latest blog post be in a different font color?

    Has anyone ever done this? I found a tutorial here: http://www.ruhanirabin.com/how-to-st...-in-wordpress/

    Cannot get that to work right though.

    Any help is appreciated.

    - John

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hard to help with nothing to work with

    Paste the top of The Loop from your index template and we can show you how to edit it

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php if (have_posts()) : ?>

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

            
            

        

                <div <!--<?php post_class() ?> id="post-<?php the_ID(); ?>" -->
                    <!--<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                    <small><?php the_time('F jS, Y'?> <!-- by <?php the_author() ?> </small> -->

                
                    
                    
                    
                    
                    
                    
                    
                    <div class="entry">
                    
                    
            

                    
                    
                    
                    
                        
                        <?php the_content('Read the rest of this entry &raquo;'); ?><div class="timestamp"><?php the_time('F jS, Y'?></div>
                    </div>

                    <!--<p class="postmetadata"><?php the_tags('Tags: '', ''<br />'); ?> Posted in <?php the_category(', '?> | <?php edit_post_link('Edit'''' | '); ?>  <?php comments_popup_link('No Comments »''1 Comment »''% Comments »'); ?></p> -->
                </div>

            <?php endwhile; ?>

            <div class="navigation">
                <div class="alignleft"><?php next_posts_link('&laquo; Older Tweets'?></div>
                <div class="alignright"><?php previous_posts_link('Newer Tweets &raquo;'?></div>
            </div>

        <?php else : ?>

            <h2 class="center">Not Found</h2>
            <p class="center">Sorry, but you are looking for something that isn't here.</p>
            <?php get_search_form(); ?>

        <?php endif; ?>
    I would like to use CSS styles to display what I need.

    Thank you!

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this to troubleshoot:

    1:
    Switch to the default theme temporarily by going into the admin.
    Try making the changes on the default theme and see if it works.
    If it works on the default theme, then perhaps is some peculiarity of the theme you are using and you'll have to look more closely.

    2:
    Or, browse to the front page of your site and view the page source code (right click in the open window on a pc).
    When you view the code see if the class of the <div> surrounding the post you want to change the color of shows up as
    <div class="featured-post">

    If yes, it means you coded the php files correctly and the problem is in your CSS file.
    If no, it means you have NOT coded the php files correctly.

  5. #5
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Take this part here, the first three lines:

    PHP Code:
    <?php if (have_posts()) : ?> 

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

                <div <!--<?php post_class() ?> id="post-<?php the_ID(); ?>" -->
    Change it to this:

    PHP Code:
    <?php if (have_posts()) : ?> 
            <?php while (have_posts()) : the_post(); ?> 
            
            <?php
                    $postclass 
    "normal";
                    if (!isset(
    $firstpost)) {
                            
    $firstpost true;
                            
    $postclass "firstpost";
                    }
            
    ?>
                         
            <div class="<?php echo $postclass?>" id="post-<?php the_ID(); ?>">
    Now you can style div.firstpost differently than div.normal

    Code CSS:
    div.firstpost {
      background: blue;
    }

  6. #6
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dan -

    PERFECT!!!!!!

    Thank you VERY much. You saved me A LOT of troubles!!!!

    - John


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •