Posted: August 27, 2018 at 9:22 am
Hi I had to move on to other issues but i have still not managed to resolve this… https://eventespresso.com/topic/people-plugin-sort-order-for-archive-page/ Is there a way for me to order the speakers by changing the database ID’s of the people as a quick fix? To answer this… https://eventespresso.com/topic/people-plugin-sort-order-for-archive-page/#post-273033 I have created installed and activated the plugin as you advised but still have no “People” menu item? can you advise as to why this might be? Thanks! |
|
You’ll break all relationships to events and taxonomies if you do that.
I think that hook has been deprecated since the time of that other topic. Along with that, we can try a different approach that avoids additional plugins to re-order the items in the people post archive on the front end. You can add the following code to your functions file: https://gist.github.com/joshfeck/326c0a511afa8b829405157762f9f7a9 The first function adds a Post Attributes meta box, with one field (Order). You’ll input 1 for the first item to be displayed, 2 for the second and so on. The second function takes those values and applies them to the native WP custom post type archive so they’ll display in the set order. |
|
Hi Josh Thanks for the update this seem like a great solution but i have implemented it on my local machine and it has thrown these errors….
Any idea whats going on please? Thanks again, |
|
I do have this in my funtions file will it be effecting the new code above?
Thanks again |
|
I’m sorry about that. There was a line of debug code remaining in the gist. That has now been removed. The corrected code resides at: https://gist.github.com/joshfeck/326c0a511afa8b829405157762f9f7a9 |
|
Hi Josh Thanks that has now added the post attributes meta box so i can enter the order. I have added numbers 1-5 to some of the people but they are not ordering on the page. Could this be because i have created a short code to show them on the page? This is the shortcode [display_speakers] and its corresponding code i have in my functions…
|
|
Yes, it’s quite likely because you’re using a custom shortcode to display those. We actually do not support custom shortcodes or custom theme templates. You can check with the author of the shortcode/theme to find out how to change the order of that shortcode’s output. |
|
Hi Josh Is there no easy way to make it work with this code? I found it on a forum so have no further access to the developer? |
|
The code you posted here lacks enough context to give you an answer. For example, does the |
|
Hi Josh I will look into this further and see if i can find this out thanks. If us_load_template() does accept the “order_by” function how would i add that? Thanks again |
|
Hi Ben, The answer will depend on how that |
|
Hi Josh I think this is where us_load_template() is defined in the Zephyr Themes helpers.php does this help?
|
|
No I’m afraid that does not help. Does that theme have any developer documentation? If not, you could go with a standard WP_Query instead of using the template functions. |
|
Hi Josh No developer documentation i’m afraid, could you point me in the right direction of how to implement a WP_query i have read this but am still unsure how to implement it to order the people. https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters Thanks again i really appreciate your help, |
|
Hi Josh Could you elaborate as to how the WP_query can be used in this case to sort the people? I have read through this but am still not sure as to exacly how this could be achieved https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters Thanks again i really apprieciate your help, |
|
Hi Ben, The Event Espresso plugin & the people add-on use the WP_Query by default when it does the People custom post type archive. You do not need to mess with that part, you just remove the shortcode and change things back to use the people add-on archive like when the plugin was first activated. Then, if you want to alter the template for the archive, you make a copy of your theme’s archive.php file, rename it to be archive-espresso_people.php, then make alterations to that file. If for some reason your theme does not use an archive.php template for displaying post type archives, this plugin will help you find which template it does use: |
|
Hi Josh I will give that a go thanks, there was a reason for using the shortcode to get around problems with the theme and customising the page. I have a custom revolution slider at the top of that page and could not get it working correctly with the default archive page it was using. Thanks again! |
|
The support post ‘People plugin sort order for archive page 2’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.