• The “Get Posts” plugin has a default ‘orderby’ => ‘date’ and ‘numberposts’ => ’10’ set in the array. Here is the original array provided with the plugin code:

    array(
          'numberposts'      => '10',
          'offset'           => '',
          'category'         => '',
          'category_name'    => '',
          'tag'              => '',
          'orderby'          => 'date',
          'order'            => '',
          'include'          => '',
          'exclude'          => '',
          'meta_key'         => '',
          'meta_value'       => '',
          'post_type'        => '',
          'post_status'      => '',
          'post_parent'      => '',
          'nopaging'         => '',
          'ul_class'         => 'get_posts_class',
          'fields'           => 'post_title',
          'fields_classes'   => 'post_title_class',
          'fields_make_link' => 'true'),
        $args );

    If I change the ‘numberposts’ default to 8, the new default value works. However, if I change the default ‘orderby’ or default ‘order’ to anything else, it does not work. Here is an example of the code for the array I’m trying to create:

    array(
          'numberposts'      => '8',
          'offset'           => '',
          'category'         => '',
          'category_name'    => '',
          'tag'              => '',
          'orderby'          => 'menu_order',
          'order'            => 'asc',
          'include'          => '',
          'exclude'          => '',
          'meta_key'         => '',
          'meta_value'       => '',
          'post_type'        => '',
          'post_status'      => '',
          'post_parent'      => '',
          'nopaging'         => '',
          'ul_class'         => 'get_posts_class',
          'fields'           => 'post_title',
          'fields_classes'   => 'post_title_class',
          'fields_make_link' => 'true'),
        $args );

    If I add the ‘orderby’ and ‘order’ I want into the shortcode, it works perfectly:

    [get_posts tag="beaches" numberposts=8 orderby="menu_order" order="asc"]

    But if I try and use the default values:

    [get_posts tag="beaches"]

    Only the default ‘numberposts’ works. Any ideas?

    https://www.ads-software.com/extend/plugins/nurelm-get-posts/

  • The topic ‘[Plugin: Get Posts] Setting default orderby and order does not work’ is closed to new replies.