WordPress.org

Ready to get started?Download WordPress

Ideas

wp_list_pages custom before and after parameters

  1. mkormendy
    Member

    It would be nice to have custom before and after parameters for the wp_list_pages template tag.

    For example:

    <?php
    
    $defaults = array(
        'depth'       => 0,
        'show_date'   => '',
        'date_format' => get_option('date_format'),
        'child_of'    => 0,
        'exclude'     => '',
        'title_li'    => __('Pages'),
        'echo'        => 1,
        'authors'     => '',
        'sort_column' => 'menu_order, post_title'),
    
        /* add handling for the following parameters */
    
        'custom'      => 'html', // or custom, or whatever logic
        'before'      => '<li>beforetext',
        'after'       => 'aftertext</li>');
    
    wp_list_pages($defaults);
    
    ?>

    I realize that this can be done with a plugin, however it seems like an option that should have been implemented like many other lists found in the WordPress base code.

    Posted: 6 years ago #
  2. Edward Caissie
    Theme Review Admin

    Are you referring to something other than the 'link_before' and 'link_after' parameters added in 2.7?

    Posted: 4 years ago #
  3. Jen Mylo
    Key Master

    Closing due to a year passing with no comment.

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    1 Vote
  • Status

    Sorry, not right now