• Resolved talknation

    (@talknation)


    When I moved from blogger to WordPress one of the features that I miss is the ability to list post titles on the sidebar. I do not use categories and would love to be able to produce a list or topic, with permalinks, on the sidebar.

    It would be ideal if I could choose how many posts titles to list there but I’ll take anything for a start. Basically I want it to act like an index.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The get_archives() and wp_get_archives() template tags offers a postbypost option for the ‘type’ parameter, which provides titles as links to the posts (may want to look at the ‘limit’ parameter as well).

    https://codex.www.ads-software.com/Template_Tags/get_archives
    https://codex.www.ads-software.com/Template_Tags/wp_get_archives

    Good enough?

    Thread Starter talknation

    (@talknation)

    I’ll check into it. Thanks.

    Thread Starter talknation

    (@talknation)

    That works great thanks. Are there any ways to tweak it so that it will show all the posts not on the front page? I have the display set to 10 posts on the main page and the post list starts with that page. It’s a pretty minor issue since the main problem is solved by having a list of post titles for clicking but it would be nice to be able to have a parameter that allows showing all post titles after the first 10 or whatever the amount is set at in the WP settings.

    It would mean updating the Sidebar file to match if I change the number of posts on a page but that is no big deal.

    Unfortunately get_archives() / wp_get_archives() don’t offer the ability to offset the arvchive links. However, you can duplicate it and make use of an offset through the get_posts() function:

    <ul>
    <?php $archive = get_posts('numberposts=20&offset=10'); ?>
    <?php foreach($archive as $post) : ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    A bit more complicated than a single template tag, but it works. The ‘numberposts’ and ‘offset’ parameter values should be obvious.

    Thread Starter talknation

    (@talknation)

    Thanks Kafka, it works perfectly, a very elegant solution.

    I appreciate the help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘listing post titles in sidebar’ is closed to new replies.