Results 1 to 4 of 4

Thread: Wordpress latest posts in sidebar (but manually).

Hybrid View

  1. #1

    Wordpress latest posts in sidebar (but manually).

    Well to everyone can happen to find some extra cool theme that has not widgetized sidebar. Its easy to make your theme widget compatible but some people (like me) prefer to manually edit sidebar and insert needed option to your site.

    Here is part of code that inserts Recent posts to your sidebar.

    <div class="mycustomclass">
    <h3>Latest Guides</h3>
    <?php query_posts('showposts=15'); ?>
    <ul>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href='<?php the_permalink() ?>'><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    </ul>
    </div>

    You will add this to your sidebar.php. And add custom styling by defining mycustomclass in your css.

  2. #2
    Quote Originally Posted by Hellas View Post
    Its easy to make your theme widget compatible
    And how's that? What needs to be done?

    I confess I've never tried to widgetize some of my themes. (lazy me )

  3. #3
    Actualy I just figured out that this code above will probably brake almost every theme.

    Here is the easier way.

    Just add to your sidebar

    <?php wp_get_archives('type=postbypost&limit=10'); ?>

    you can wrap it again in h3 tags or whatever tags you used in your theme

    <div class="whatever">
    <h3>Latest Posts</h3>
    <ul>
    <?php wp_get_archives('type=postbypost&limit=10'); ?>
    </ul>
    </div>

  4. #4
    The second method works.That's what I've been using. It is easier than continually updating plugins.

    You can find all the variations here: Template Tags/wp get archives WordPress Codex
    "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- Benjamin Franklin


Similar Threads

  1. latest finding : wordpress search replacement
    By anantshri in forum Blogging
    Replies: 2
    Last Post: 18 April, 2010, 20:52 PM
  2. More then 15 recent posts in Sidebar
    By Hellas in forum Wordpress
    Replies: 1
    Last Post: 9 July, 2009, 15:43 PM
  3. [WTH] Style Sidebar Widgets For Wordpress $25
    By Sundance in forum Contests
    Replies: 3
    Last Post: 15 June, 2009, 01:12 AM
  4. WordPress number of posts problem
    By Aquarezz in forum Wordpress
    Replies: 2
    Last Post: 30 May, 2009, 12:45 PM
  5. Wordpress blog - sidebar.php problem
    By elishevadpw in forum Wordpress
    Replies: 6
    Last Post: 25 January, 2009, 17:26 PM

Tags for this Thread

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
  •