Forums

is this possible with just CSS or do I need a plug-in (3 posts)

  1. mjmitche
    Member
    Posted 2 years ago #

    Hi, if you look at the site Tech Crunch, they have 3 featured posts above the main content box that have room for text, the image, and a link to the main post.

    I know there are featured post plugins and sliders etc, but they all seem to show 1 post at a time. What I'd like is to be able to show 3 or 4 without requiring the viewer to click to make them slide, only click to read full post if they wish.

    Is this possible with html and css. Any ideas?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Look for a plugin.

  3. M1chel
    Member
    Posted 2 years ago #

    I guess you'ld like to feature that on you home page right?
    I'm doing something similar and my solution is to use a script that shows the latest post of a given category. with another piece of php I also add the first image of that post and below adding title and excerpt is very simple.

    <?php query_posts ('cat=5&showposts=1'); ?> //here you can change the category ID or the namber of posts to show
    
             <?php while (have_posts()) : the_post(); ?>
    
    		 <a class="title" href="<?php the_permalink() ?>" rel"">
             <div class="picture">
    		    <img class="c" src="<?php getImage('1'); ?>//this is the part that grabs the first picture of your post
    		 </a>
             </div><!--picture-->
    
    		 <div class="first_article">
    
    		 <a class="title_main" href="<?php the_permalink() ?>"><h3><?php the_title(); ?></h3></a>
    
    		 <p class="text"><?php the_excerpt() ?>
    
                    </p>
    
    				<ul class="mini_post"> <li class="rm"><a class="read_more" href="<?php the_permalink() ?>"><span>Read more</span></a><li>
    				     <li class="cm"><a class="comments" href="<?php the_permalink() ?>"><span>Comments&nbsp;<?php comments_number('0', '1', '%'); ?></span></a><li>
    				</ul>
      <?php endwhile;?>

    ok, you don't have to use this html structure, I just grabbed my own code and for some reasons I build it like that.
    so, at the beginning I'm retrieving 1 post from a given category but you could also retrieve a particular post with this code:

    <?php
    // retrieve one post with an ID of 5
    query_posts('p=5');
    ?>

    then I have a div for the picture and here you can only see the tag I used to retrieve the image but there's also a code to put in the function.php
    you can find the instructions here: http://bavotasan.com/tutorials/retrieve-the-first-image-from-a-wordpress-post/

    then were I wanted the text I used the <? php the_excerpt () ?> and it shows the excerpt you wrote on your admin panel when you wrote the article. if instead you used the tag <!--more--> inside the article then you have to use <? php the_content () ?>

    fianlly where you see the unordered list I also added a "read more" link and a "comment" link which also shows the current number of comments for that post.

    All this stuff is in a template I created for the home page so this is all stuff you need to put in a template. even the index or the single page, is up to you.

    However it's the first time that I deal with wordpress so I can't be of much help but look at this link to find more tips. they really helped me:
    http://www.noupe.com/wordpress/mastering-your-wordpress-theme-hacks-and-techniques.html

    http://www.smashingmagazine.com/2009/01/07/10-killer-wordpress-hacks/

    http://www.smashingmagazine.com/2009/04/15/10-exceptional-wordpress-hacks/

    I hope I helped!
    Have fun :)

    Michel

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.