Make [TAXONOMY] Shortcode Alphbetical

  • thomas
    thomas
    Newbie 29 points
    April 6, 2015 at 10:49 pm

    I would like my stores list to be alphabetical using the taxonomy shortcode. Here is what I have done;

    I went to the wp-content/themes/CP/framework/class/class_shortcodes.php file

    section

    /* =============================================================================
    [TAXONOMIES] – SHORTCODE
    ========================================================================== */
    function wlt_page_taxonomy( $atts, $content = null ) {

    global $userdata, $CORE, $post; $STRING = “”; $default_options = ‘show|hide’;

    extract( shortcode_atts( array( ‘show’ => “” ,’hide’ => “”, ‘name’ => “”, ‘count’ => “yes”, ‘icon’ => “yes”, “limit” => 500, ‘perrow’ => ‘3’ ), $atts ) );

    // build query
    $args = array(
    ‘taxonomy’ => $atts[‘name’],
    ‘orderby’ => ‘count’,
    ‘order’ => ‘desc’,
    ‘show_count’ => 0,
    ‘pad_counts’ => $atts[‘count’],
    ‘hierarchical’ => 0,
    ‘title_li’ => ”,
    ‘include’ => $atts[‘show’],
    ‘exclude’ => $atts[‘hide’],
    ‘hide_empty’ => 0,

    );

    I changed ‘orderby’ => ‘count’,
    ‘order’ => ‘desc’,

    to ‘orderby’ => ‘name’,
    ‘order’ => ‘asc’,

    The test worked, and my stores list was now alphabetical.

    I changed the php back in the parent theme, and added the php changes to my child theme functions.php, but it did not work.

    Can anyone show me the correct code to add to the child theme functions file?

    Thanks

  • Hemanta Chakladar
    Hemanta Chakladar
    Super Guru 1,710 points
    April 7, 2015 at 9:51 am

    Create a new shortcode and add that to _functions.php and use you own shortcode.

  • Alex Morgan
    Alex Morgan
    Super Guru 1,109 points
    April 7, 2015 at 9:59 am
  • thomas
    thomas
    Newbie 29 points
    April 8, 2015 at 3:21 pm

    ok thanks.

  • Hemanta Chakladar
    Hemanta Chakladar
    Super Guru 1,710 points
    April 8, 2015 at 3:24 pm

    Thanks for sharing.

  • Alex Morgan
    Alex Morgan
    Super Guru 1,109 points
    April 8, 2015 at 4:18 pm

    🙂

Viewing 6 posts - 1 through 6 (of 6 total)

New Business Themes for WordPress 2020

Start your new website today!

View Business Themes