Support » Fixing WordPress » wp_get_archives() –> where is it?

  • I want to change the order of the posts displayed in widgets – Primary Widget Area – Recent Posts – which shows up in the right sidebar of the Twenty Ten theme. I know that wp_get_archives() has an argument of ‘order’ to do this and that I want to set it to ASC, but I can’t find where to do this.

    Help?

    Thank you

    • This topic was modified 6 months, 2 weeks ago by  Steve Stern.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    I think I’d use a filter on pre_get_posts(). It might take a little bit to get the conditionals right so your filter only hits on the right places.

    Since it’s not filtered, it’d be easier to clone the widget and change the $args.
    Or use a plugin that supplies a more versatile widget.

    I think you folks are saying that there is no straight forward way to change the order of the posts in that particular theme (?)

    I failed to find “pre_get_posts()” and also failed to find the $args array to change.

    Perhaps the following doesn’t actually exist for my theme: ?

    <?php $args = array(
    ‘type’ => ‘monthly’,
    ‘limit’ => ”,
    ‘format’ => ‘html’,
    ‘before’ => ”,
    ‘after’ => ”,
    ‘show_post_count’ => false,
    ‘echo’ => 1,
    ‘order’ => ‘DESC’,
    ‘post_type’ => ‘post’
    );
    wp_get_archives( $args ); ?>

    Thank you for the help and advice !!

    I didn’t look at the theme to see if it is part of the template file. Most themes don’t hard-code widgets in anymore. But if it does, you could just make a child theme and change the arguments there.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_get_archives() –> where is it?’ is closed to new replies.