WordPress.org

Ready to get started?Download WordPress

Forums

Instructions for formatting function reference calls? (2 posts)

  1. TomJohnson
    Member
    Posted 4 years ago #

    On almost every function reference info page (such as wp_list_pages), I see things like this:

    <?php wp_list_pages( $args ); ?>

    Default Usage

    <?php $args = array(
        'depth'        => 0,
        'show_date'    => ,
        'date_format'  => get_option('date_format'),
        'child_of'     => 0,
        'exclude'      => ,
        'include'      => ,
        'title_li'     => __('Pages'),
        'echo'         => 1,
        'authors'      => ,
        'sort_column'  => 'menu_order, post_title',
        'link_before'  => ,
        'link_after'   => ,
        'exclude_tree' =>  ); ?>

    But all the examples show the function reference written out in a different way, like this:

    <?php wp_list_pages('include=5,9,23&title_li=<h2>' . __('Poetry') . '</h2>' ); ?>

    Apparently I can also write the function reference using the => and putting everything in single quotes, like this:

    <?php wp_list_pages (array('depth'=>'0','link_before'=>'h3','link_after'=>'/h3')); ?>

    But I'm not very familiar with this second format for writing the function reference. Is there any page on the codex that explains how to write out the function reference this second way? And why is there a disconnect between the usage and the examples? Shouldn't more of the examples use the => format? Is there an advantage to using one over the other?

    Tom

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Is there any page on the codex that explains how to write out the function reference this second way?

    See How_to_Pass_Tag_Parameters

Topic Closed

This topic has been closed to new replies.

About this Topic