• Resolved Shapeshifter 3

    (@shapeshifter-3)


    Does anybody know how I can get my Posts Tags to display alphabetically on my homepage, archive pages, and individual posts? If I remember correctly, some of my previous themes did it automatically (although I might be wrong).

    Here’s my Homepage: https://shapeshifter3.com/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author mrwweb

    (@mrwweb)

    Some themes may include that as a “feature” but that is more plugin/custom-code territory. I wlll not be adding it to this theme for sure.

    That said, take a look at this thread on WordPress Stackexchnage. If you’re even a little familiar with WordPress theming and plugin development, you could take that filter and make it a plugin file for your site.

    Thread Starter Shapeshifter 3

    (@shapeshifter-3)

    Thank you for your response, Mark.

    I’ll check out that link you provided…

    Thread Starter Shapeshifter 3

    (@shapeshifter-3)

    A kind contributor on WordPress StackExchange suggested that I past this code into the functions.php file of my Theme Editor:

    add_filter( "term_links-post_tag", 'themeslug_sort_tags_alphabetically' );
    function themeslug_sort_tags_alphabetically( $tags ){
        natcasesort( $tags );
        return $tags;
    }

    So far, it seems to work well.

    Theme Author mrwweb

    (@mrwweb)

    Word of warning: Anything added to the functions.php file of a prebuilt theme will be lost when you update it! As I suggested above, I strongly recommend you just turn the snippet into a plugin like this: https://gist.github.com/mrwweb/188281c2f71e2f21088a

    Then just upload that to /wp-content/mu-plugins/ or ‘/wp-content/plugins/az-the-tags/` and it’ll run!

    Thread Starter Shapeshifter 3

    (@shapeshifter-3)

    Thank you Mark,

    I didn’t know how to create a plugin, so I had kept a file copy of the script on my desktop to re-enter whenever you updated this theme.

    BUT at your advice, I just removed that script from my editor and uploaded and enabled your plugin instead.

    Still works fine…Thank You!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How Do I Get My Post Tags to Alphabetize ?’ is closed to new replies.