Forums

Error when passing $args to wp_list_pages() (3 posts)

  1. dexteremmerich
    Member
    Posted 1 year ago #

    This is my code:

    <?php
    $args = array(
    'show_option_all' => '',
    'orderby' => 'name',
    'order' => 'ASC',
    'show_last_update' => 0,
    'style' => 'list',
    'show_count' => 0,
    'hide_empty' => 1,
    'use_desc_for_title' => 1,
    'child_of' => 0,
    'feed' => '',
    'feed_type' => '',
    'feed_image' => '',
    'exclude' => '',
    'exclude_tree' => '',
    'include' => '',
    'hierarchical' => true,
    'title_li' => __( 'Categories' ),
    'number' => NULL,
    'echo' => 1,
    'depth' => 0,
    'current_category' => 0,
    'pad_counts' => 0,
    'taxonomy' => 'category',
    'walker' => 'Walker_Category' );
    ?>
    <?php wp_list_pages($args); ?>

    And I'm getting this error from it:

    Fatal error: Using $this when not in object context in C:\wamp\www\lessons\wp-includes\classes.php on line 912

    Any ideas why? :<

  2. dexteremmerich
    Member
    Posted 1 year ago #

    *bump*

  3. BandonRandon
    Member
    Posted 1 year ago #

    There is no reason to create an $args variable you want to do something like <?php wp_list_pages('orderby=name&order=ASC'); ?> You only want to pass the arguments you are changing from the default into wp_list_pages.

Topic Closed

This topic has been closed to new replies.

About this Topic