Hi there. First of all, thanks for this plugin. It’s been a great help so far.
As jkgraves14 mentioned though, the default behavior of the order seems to be reverse alphabetical when sorted by name (orderby=”name”), which is frustrating when the client requires an alphabetical listing of logos.
Whether this is due to the theme, templates, or the plugin itself, there’s a simple fix within the plugin that overrides any defaults and allows for another argument within the shortcode. I’ve made this modification and it seems to be working, no problem, so I thought I’d share:
// Taxonomy category shortcode
function sponsor_level_cat_func($atts, $content) {
extract(shortcode_atts(array(
'columns' => '4',
'image' => 'yes',
'title' => 'yes',
'link' => 'yes',
'bio' => 'yes',
'show' => '',
'orderby' => '',
'order' => '',
'category' => ''
), $atts));
global $post;
if( $category == ('') ) { $category = 'all';} else { };
if( $orderby == ('') ) { $orderby = 'rand';} else { };
if( $order == ('') ) { $order = 'asc';} else { };
if( $category != ('all') ) {
$args = array(
'post_type' => 'cr3ativsponsor',
'posts_per_page' => $show,
'order' => $order,
'orderby' => $orderby,
'tax_query' => array(
array(
'taxonomy' => 'cr3ativsponsor_level',
'field' => 'slug',
'terms' => array( $category)
)
));
} else {
$args = array(
'post_type' => 'cr3ativsponsor',
'order' => $order,
'orderby' => $orderby,
'posts_per_page' => $show
);
}
As I mentioned, this sets the default order to be ASC on top of any orderby parameters. It also allows for an additional argument within the shortcode to control the order manually (ASC/DESC):
[sponsor_level category="corporate-partners" orderby="name" order="ASC" image="yes" title="no" link="yes" bio="no" show="9999"]
I realize that it’s poor practice for me to make modifications to a plugin I didn’t write, but this is my only alternative for achieving the desired effect without starting from scratch with a new plugin. I’m hoping you might implement this change into your next update though so we can continue updating the plugin in the future. If this plugin is opensource somewhere on GitHub I’d love to commit these changes. Let me know if you have any questions for me. Thanks so much.