Skip to:

single.php has wrong function and format to show next and/or previous post link.

  • chestnut_jp


    I posted to

    /bp-themes/bp-default/single.php has a wrong function and format to show the next and/or previous post link.

    [ Original ]
    <div class=”alignleft”><?php next_posts_link( __( ‘? Previous Entries’, ‘buddypress’ ) ) ?></div>
    <div class=”alignright”><?php previous_posts_link( __( ‘Next Entries ?’, ‘buddypress’ ) ) ?></div>

    Should be

    [ Changed to ]

    <div class=”alignleft”><?php next_post_link(‘%link’, __( ‘? Previous Entries’, ‘buddypress’ ) ) ?></div>
    <div class=”alignright”><?php previous_post_link(‘%link’, __( ‘Next Entries ?’, ‘buddypress’ ) ) ?></div>

    However, this still will collapse the format of page, thus I recommend:

    [ Changed to ]

    <tr><td class=”alignleft”>
    <?php previous_post_link(‘%link’, ‘?¬†%title’) ?>
    </td><td class=”alignright”>
    <?php next_post_link(‘%link’, ‘%title¬†?’) ?>

    Note that %title can be changed to the default of “__( ‘? Previous Entries’, ‘buddypress’ )” and “__( ‘Next Entries ?’, ‘buddypress’ )”

Viewing 4 replies - 1 through 4 (of 4 total)
  • A table construct is not an appropriate structure – this is not tabulated data if anything it’s a list and a ul would be the structure best suited.



    Thanks for you comment, @hnla

    Yes, I have tried a various ways, and have found that <div> and <ul> collapse the layout of post.
    Try and you will see what I mean.

    Anyway, the point is that single.php uses a wrong function.

    If elements cause an issue then that needs to be addressed and is a presentational matter, Semantics is a different subject and dictates that the correct elements are chosen to describe the data, regardless of presentation which comes later.

    A ul won’t collapse the layout, however if you floated the li elements then you would need to ensure that you had used an appropriate method of ‘containing floats’ e.g ‘overflow:hidden;’



    Just add the class clearfix in item-options (the div that wraps these previous and next links)

    and be sure you have the appropriate CSS for that class

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘single.php has wrong function and format to show next and/or previous post link.’ is closed to new replies.
Skip to toolbar