Support » Themes and Templates » recent post in individual index page

  • I have my start page as an individual index.php, here i have the following code to display the recent post in my blog:

    <?php
    $how_many=1;
    require_once(‘blog/wp-config.php’);
    ?>

    <?
    $news=$wpdb->get_results(“SELECT ID,post_title,post_content,post_date FROM $wpdb->posts
    WHERE post_type=\”post\” AND post_status=\”publish\” ORDER BY post_date DESC LIMIT $how_many”);
    foreach($news as $np){
    printf (“%s

    “, get_permalink($np->ID),$np->post_title);
    printf (“%s“, get_permalink($np->ID),$np->post_content);
    } ?>

    Here i am having problems with the last two print lines since i am completely new to all this.

    the .. printf (“%s

    “, get_permalink($np->ID),$np->post_title); .. works just fine but i wanted to make this bold. what do i add in my css ?

    and here … printf (“%s“, get_permalink($np->ID),$np->post_content); … the actual body text shows up as a link which i dont want. how do i remove the link on this line.

    Finally is there any way i can add a text limit ? like say 50 chars and then a ” read more ..” comes up after the limit is met ?

    Cheers, and thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dhanesh

    (@dhanesh)

    Guys c’mon, anyone ?

    Thread Starter dhanesh

    (@dhanesh)

    *bump*

    I don’t know how to help with the print part, but I can help with the excerpt bit.

    There are two ways to do it:

    1. the_excerpt reloaded plugin

    It allows you to choose a set number of words to break the post off with among other variables.

    2. Use the <!–more–> function.

    It does the same thing except you can’t determine a word limit unless you manually count. I used to do a paragraph then the <!–more–>. There’s a button that looks like a little box with a dashed line and then a bigger box underneath the line.

    The shortcut code is Alt+Shift+T.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘recent post in individual index page’ is closed to new replies.