Support

Home Forums Event Espresso Premium People plugin sort order for archive page

People plugin sort order for archive page

Posted: July 3, 2018 at 6:14 am


WEMconference

July 3, 2018 at 6:14 am

Hi

I have a speakers page for our conference website which I need to be able to list my event speakers in a predefined order that can be set in some way by event admins in the backend.

I currently have the [display_speakers] used on a custom archive page. Is there a way for me to add a number to each speaker in the speaker admin and have them list in archive page in that order?

Thanks for your time!
Ben.


Tony

  • Support Staff

July 3, 2018 at 7:07 am

Hi Ben,

I currently have the [display_speakers] used on a custom archive page.

I’m not aware of a [display_speakers] shortcode, is that something you have created yourself?


Josh

  • Support Staff

July 3, 2018 at 7:11 am

Hi Ben,

I’m not familiar with a [display_speakers] shortcode, is that from another plugin or the theme? The People add-on does not currently have shortcodes.


WEMconference

July 3, 2018 at 7:25 am

Hi Yes

This is what i added to the functions…

function display_speakers(){
 $template_vars = array(
    'layout' => "classic",
    'type' => "grid",
    'columns' => 4,
    'img_size' => "us_400_400_crop",
    'metas' => (array) us_get_option( 'archive_meta', array() ),
    'content_type' => "grid",
    'show_read_more' => 0,
    'pagination' => us_get_option( 'archive_pagination', 'regular' ),
);
 $the_content = us_load_template( 'templates/blog/listing', $template_vars );
 echo $the_content;
}
add_shortcode("display_speakers","display_speakers");

Can you advise as to how i can sort the individual speakers? Ideally i want to add somthing to the wp-admin/admin.php?page=espresso_people people admin page?

Is there a way to add a columb with numbers or somthing similar that will give a display order?

Thanks again
Ben.


Josh

  • Support Staff

July 3, 2018 at 8:44 am

Hi Ben,

I’m afraid we’re really not in a position where we can support custom development. In this case you’ve got a custom shortcode that make use of a us_load_template() function (which isn’t something developed by or supported by Event Espresso).

I’ll try with a guess, if the us_load_template() function supports native WP_Query parameters, you should be able to add the following to the $template_vars array:

'meta_key' => 'speaker_display_order',
'orderby' => 'meta_value_num',
'order' => 'DESC'

and then go in to edit each speaker post type, and add one custom field where the meta key is speaker_display_order and then set the value as the number order (start with 1, then 2, and so on.)


Josh

  • Support Staff

July 3, 2018 at 8:58 am

Another approach, if you use the native post archive feature of the Event Espresso People add-on, you can install this plugin:

https://wordpress.org/plugins/simple-page-ordering/

Then add this code to a custom site plugin:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-people/jf_eea_people_archive_orderby_menu_order.php

And that will add an additional “People” menu to the WP dashboard where you can drag and drop to re-order the sort order for the archive page.


WEMconference

July 3, 2018 at 9:03 am

Hi Josh

Excellent I will take a look at both of those and see which works best.

Thanks again for your time much apprieciated!

Ben.


WEMconference

July 6, 2018 at 4:56 am

Hi Josh

I have followed your instructions i have installed the simple page ordering plugin (which is working on normal pages) and created a plugin called “people-sort-plugin”

<?php
/*
   Plugin Name: people-sort-plugin
*/
   
   
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file

/* The following can be added to make a second People admin list table menu item (at the main menu level) 
 * that will work with the Simple Page Ordering plugin 
 */

// modify how the People custom post type is registered so it's hierarchical **and** shown in the main WP menu 
add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_modify_visibility_of_event_people_cpt' );
function ee_modify_visibility_of_event_people_cpt( $cpt_registry_array ) {
    if ( isset( $cpt_registry_array['espresso_people'] ) ) {
        $cpt_registry_array['espresso_people']['args']['show_ui'] = true;
        $cpt_registry_array['espresso_people']['args']['show_in_menu'] = true;
        $cpt_registry_array['espresso_people']['args']['hierarchical'] = true;
        $cpt_registry_array['espresso_people']['args']['capabilities']['create_posts'] = 'do_not_allow';
    }
    return $cpt_registry_array;
}

// change the post query’s orderby parameter to menu_order so the posts display in the defined order
add_filter( 'posts_orderby', 'jf_eea_people_archive_orderby' );
function jf_eea_people_archive_orderby( $orderby ) {
    if( is_post_type_archive( 'espresso_people' ) || 
      is_tax( 'espresso_people_categories' ) ||
      is_tax( 'espresso_people_type' ) ) {
        $orderby = "menu_order";
        return $orderby;
    }
    // not a people archive, return default order by
    return $orderby;
}

and installed it using the code supplied but there is no new menu item for people, where would this be located? Is there a way to get this to work on the EE Event Espresso – Manage People plugin page?

Thanks again
Ben.


WEMconference

July 6, 2018 at 5:25 am

Hi Josh

Actually the page ordering plugin is not working either on normal pages when i drag a page it just kjeeps running the small animation and never loads then on refreah the pages are back in the same order?

Thanks
Ben


Josh

  • Support Staff

July 6, 2018 at 5:36 am

Hi Ben,

Have you activated the plugin that adds the People menu item to the WP Dashboard?

Since it appears you’re having some issues with the Simple Page Ordering plugin, you can rule out a plugin conflict. You’ll note that others have had to resolve plugin conflicts in the Simple Page Ordering plugin’s support forums:
https://wordpress.org/support/plugin/simple-page-ordering

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: publish

Updated by  Josh 2 weeks, 1 day ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!