• Resolved dojan

    (@dojan)


    In some themes you can show the recent posts in the menu along with blogroll and other links.
    The theme I use it shows only categories. I am rather new to php but know my way around coding.
    How do I include this in my meny (sidebar.php?)

Viewing 7 replies - 1 through 7 (of 7 total)
  • 1. You can download and study how it is done in themes you saw > and apply it to your theme.
    2. You can use a recent_posts plugin

    Thread Starter dojan

    (@dojan)

    Thanks!
    I tried fruitlessly to tweak the sidebar the way I had seen in other themes. I couldn’t get it quite right.
    So i downloaded and installed the customizable-post-listings
    Plug-in.
    That did the trick.

    Thread Starter dojan

    (@dojan)

    When I write the code suggested on: https://www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/

      Recent Posts
      <?php c2c_get_recent_posts(3); ?>


    My code no longer validates??

    Scott Reilly

    (@coffee2code)

    WordPress & Plugin Developer

    By default the plugin outputs each listed post within <li></li> tags. So you need something like:

    Recent Posts
    <ul>
    <?php c2c_get_recent_posts(3); ?>
    </ul>

    Or define your own format via the function’s second argument (read the docs for this on the abovementioned page).

    Thread Starter dojan

    (@dojan)

    I am sorry, that’s the exact code I put in at first. The validator complained about that too ??
    Why do you need a plugin for showing the recent posts in the first place?
    Can’t you simply put in code like this:

    (the ul code)
    Recent posts
    <?php wp_get_recent_posts(3); ?>
    (the end ul code)

    `

    Thread Starter dojan

    (@dojan)

    It finally worked. The trick is to place your extra code so you won’t corrupt the rest ??
    Thank you very much!

    Anyone either have a solution to fix customizable-post-listings now that it doesn’t work with 2.3, or have another good way of doing this? Half my site has broken code now and I want to fix this as soon as possible. Tried a few things, but I need to skip that first item on recent posts.

    I had been toying with using this code, but can’t seem to make it work:

    <?php $my_query = new WP_Query('category_name=front-page&showposts=1');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Recent posts’ is closed to new replies.