• If I activate the static front page plugin all works well… except that I’ve noticed that my list of recent posts in my sidebar is wrong (it then only shows a link for my home page).

    So, when using static front page, how do I get a list of recent posts? ATM I’m using this code in my sidebar

    <?php
    query_posts('posts_per_page=5');
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    <p class="sidebar-footer" style="padding-top:3px;margin:0;"> " title="Permalink for : <?php the_title(); ?>"><?php the_title(); ?>
    <?php endwhile; endif; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try this:

    <?php
    $recent = new WP_Query('showposts=5');
    while ($recent->have_posts()) : $recent->the_post(); ?>
    <p class="sidebar-footer" style="padding-top:3px;margin:0;"><em>&para;</em> <a href="<?php the_permalink(); ?>" title="Permalink for : <?php the_title(); ?>"><?php the_title(); ?>
    <?php endwhile; ?>

    Note that WP_Query() can accept the same arguments as query_posts(). More on WP_Query:

    https://codex.www.ads-software.com/Function_Reference/WP_Query

    Thread Starter omz13

    (@omz13)

    Thanks for the suggestion, but it makes no difference… the recent posts lists is still borked ??

    Then I’d recommend either going with a different solution for displaying a Page on your front page (my plugin may work for you), or wait and see if Denis can provide a workaround to his plugin… :)

    There’s no workaround as far as I can tell: The static front page plugin overrides the WP query on the home page. You can’t use query_posts() as a result, since it gets filtered exactly the same way as the main query.

    Thread Starter omz13

    (@omz13)

    Thanks Denis. Sorry to hear it works that way ??

    I’ve now switched to Kaf’s plugin and that seem to work (after I did a bit of tweaking).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘static front page plugin and recent posts’ is closed to new replies.