• I have a list of the most recent posts in my sidebar as such:

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

    This has been working fine to display the most recent 10 posts, but I wish to display “by admin” or whoever the author is next to it.

    When I put the standard php author code in it doesn’t display and was wondering if there is a solution to this?

    Thanks

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter stoo31

    (@stoo31)

    I don’t think I am explaining myself very well sorry.

    If you click the second post in the sidebar (https://www.blog.dpadmagazine.com/2009/02/08/tester-tester-tester/) which you will notice displays the correct URL & header but doesn’t display the content of the relevant post it only displays the most recent post.

    When I take the sidebar code out that you gave me it returns to normal.

    Maybe something with your single.php or your permalinks or even .htaccess, because if you visit https://www.blog.dpadmagazine.com/author/admin/ and click on that test post you see the same problem.

    Thread Starter stoo31

    (@stoo31)

    The blog functions fine when I take the sidebar code that you gave me out though. So it is something in that sidebar code on it’s own or it is conflicting with some code in my theme, but I can’t locate anything that would be causing it.

    This, in a widget from Otto’s PHP Code Widget, or in a sidebar.php works:

    <?php
       $args=array(
       'showposts'=>5,
       'caller_get_posts'=>1
       );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> by:  <?php the_author(); ?></p>
    
    <?php
    endwhile;
    }
    ?>

    Note: have also used the Recent Posts plugin/widget recently that allows configuration of things like this via Settings ??
    https://rmarsh.com/plugins/recent-posts/

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Displaying “by <author>” next to list of recent posts’ is closed to new replies.