WordPress.org

Ready to get started?Download WordPress

Forums

Plugin for adding a few article titles in the sidebar (9 posts)

  1. radu.tanasescu
    Member
    Posted 5 years ago #

    Hello,

    Is there a plugin that can publish a number of article titles in the sidebar? Sort of a "Recommended Articles", or "Most Read Articles" (but with the possibility to decide exactly what articles appear there).

    Thanks in advance.

  2. MichaelH
    Member
    Posted 5 years ago #

    This displays post id 1,170, and 172 so try that in your sidebar.php.

    <?php
    $posts=get_posts(array('post__in' => array(1,170,172)));
    if ($posts) {
    foreach($posts as $post) {
    setup_postdata($post);
    ?>
    <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
    <?php }
    }
    ?>

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  3. radu.tanasescu
    Member
    Posted 5 years ago #

    I'm sure this works and I won't have any problem using it, however a normal blog user won't be able to change the articles in the sidebar by themselves.

    Thank you for the suggestion, if I won't be able to find an plugin I'll use this.

  4. MichaelH
    Member
    Posted 5 years ago #

    I won't have any problem using it, however a normal blog user won't be able to change the articles in the sidebar by themselves

    Well you certainly have me confused ;) Wouldn't the user just navigate to the things they thought important?

  5. radu.tanasescu
    Member
    Posted 5 years ago #

    I'm probably the one confused, what exactly does your code do?

  6. MichaelH
    Member
    Posted 5 years ago #

    It displays 3 post titles in the sidebar, where the post IDs are 1,170,172. Of course, you will use different post IDs, I suspect.

    To see it work, add that code just before the <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?> line in `wp-content/themes/default/sidebar.php. Then change to the WordPress Default Theme.

    Of course you could also consider downloading and installing Otto's php code widget and put that code in one of those widgets.

  7. radu.tanasescu
    Member
    Posted 5 years ago #

    Thank you for the clarification.

    What I meant was, I'm just the web designer, the blog I'm working on is owned and used by a person with no web design skills, the idea is to make it possible for that person to chose what posts are displayed in the sidebar without my intervention.

    The idea is to have a way to promote several posts of grater importance, which will change in time.

    I think I might be able to do something with Otto's php widget, if no other option exists.

  8. MichaelH
    Member
    Posted 5 years ago #

    With the php Widget at least they can edit code as long as they know the post IDs.

  9. radu.tanasescu
    Member
    Posted 5 years ago #

    That's what I was thinking, thanks for your assistance.

Topic Closed

This topic has been closed to new replies.

About this Topic