Home › Forums › Calendar Products › Events Calendar PRO › Two questions: Event List in Alphabetical Order and Change Wording
- This topic has 13 replies, 4 voices, and was last updated 9 years, 4 months ago by
Helen.
-
AuthorPosts
-
December 22, 2016 at 12:34 am #1209364
Helen
ParticipantHi!
First off – love, love love your product.
Page on my site I need help with (still in test mode): http://5bc4ac0df1.url-de-test.ws/evenements/categorie/expositions-2017/
Okay here are my questions:
1 – I need to change the listing order in the Event List view to Alphabetical. I know I probably need to add something to the functions.php file. Can you let me know what and where to add it. I’m a little new to altering php so please walk me through it (especially which file to alter/add to and where within the file.) I’m working with a child theme so even better – can you let me know how to create a functions.php file to go in my child theme folder to overwrite the main one. (Or am I totally off on how this is done???)
2 – I need to change the wording of the “See More…” at the end of the listings (my site is in French so it says “Voir les détails”). Where/how do I change this.
Thanks, thanks, merci!!
– Helen
December 22, 2016 at 11:38 pm #1209918Geoff B.
MemberGood evening Helen and welcome to the Events Calendar Support forum!
Thank you for reaching out to us.
I would love to answer your questions.1 – I need to change the listing order in the Event List view to Alphabetical. I know I probably need to add something to the functions.php file. Can you let me know what and where to add it. I’m a little new to altering php so please walk me through it (especially which file to alter/add to and where within the file.) I’m working with a child theme so even better – can you let me know how to create a functions.php file to go in my child theme folder to overwrite the main one. (Or am I totally off on how this is done???)
You are right. You need to add the following snippet to your child theme’s functions.php file: https://gist.github.com/geoffgraham/0bca3dd3eac1534e32ffeee369f63449#file-reverse-alphabet-order-php
Basically, you open up that functions.php file with a text editor and add the code found in the link above directly after the opening <? php statement.
2 – I need to change the wording of the “See More…” at the end of the listings (my site is in French so it says “Voir les détails”). Where/how do I change this.
It looks like you already fixed that part.
As a side note, we can continue this conversation in french if you prefer.
Let me know how that goes.
Best regards,
Geoff B.December 22, 2016 at 11:52 pm #1209927Helen
ParticipantHi Geoff,
Thank you for your response. I will try the code snippet right away.
But I did not express myself clearly in the second question. The wording at the end of the listing is in French already. It says “Voir les détails” but I want to change it to “Voir la suite.” How do I do this.
Thank you.
English is fine by the way – it’s my first language, my clients are French.
– Helen
December 23, 2016 at 11:38 pm #1210217Geoff B.
MemberGood evening Helen,
Thank you for writing back.
There are a few approaches to this, but the simplest is by adapting and using the code snippet found way at the bottom of the following link: https://theeventscalendar.com/knowledgebase/change-the-wording-of-any-bit-of-text-or-string/
Just make sure you don’t paste the opening <? php statement.
Have a good weekend,
Geoff B.
December 28, 2016 at 1:48 pm #1211217Helen
ParticipantHi Geoff,
Thanks for the help so far. The code to change the wording worked like a charm.
To list the events alphabetically the code you sent me worked great as well. But I need to modify it a little bit. The titles are names and the client wants the listings to be listed alphabetically by last name but wants the title of the events to be “First Name” then “Last Name.”
So I figured I’d modify the slug of each event and put the last name first there. Then I modified the code you sent me by placing ‘name’ instead of ‘title’. It works fine for everything except one listing. The first listing is not in the right order (it is the only listing with event dates that start before the rest.) When I change the event dates then it lists in the right place alphabetically.
Please help!
– Helen
Link to page: http://5bc4ac0df1.url-de-test.ws/evenements/categorie/expositions-2017/
Here is the code in my functions.php file:
<?php
// enqueue the child theme stylesheet
Function wp_schools_enqueue_scripts() {
wp_register_style( ‘childstyle’, get_stylesheet_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘childstyle’ );
}
add_action( ‘wp_enqueue_scripts’, ‘wp_schools_enqueue_scripts’, 11);function tribe_custom_theme_text ( $translation, $text, $domain ) {
$custom_text = array(
‘Voir les détails’ => ‘Voir la suite’,
);// If this text domain starts with “tribe-“, “the-events-“, or “event-” and we have replacement text
if( (strpos($domain, ‘tribe-‘) === 0 || strpos($domain, ‘the-events-‘) === 0 || strpos($domain, ‘event-‘) === 0) && array_key_exists($translation, $custom_text) ) {
$translation = $custom_text[$translation];
}
return $translation;
}
add_filter(‘gettext’, ‘tribe_custom_theme_text’, 20, 3);add_action( ‘pre_get_posts’, ‘tribe_post_alphabetical_ordering’, 51 );
function tribe_post_alphabetical_ordering( $query ) {
if( tribe_is_upcoming() ) {
$query->set( ‘orderby’, ‘name’ );
$query->set( ‘order’, ‘ASC’ );}
}December 28, 2016 at 11:13 pm #1211272Geoff B.
MemberGood evening Helen,
Thank you for writing back.
I am super stoked that the snippets I shared helped out!
For that last rebellious event, I will have to ask our coding ninjas, since this is above my pay grade. However, unfortunately as you might have seen, most of the support team is out until January 2nd.
I will have to wait until then to follow-up on this for you.
Thank you for your understanding and hang in there!
Best regards,
Geoff B.
December 29, 2016 at 12:58 am #1211286Helen
ParticipantThanks Geoff,
I will hang in there 🙂
Have a great New Year!!!
December 29, 2016 at 11:11 pm #1211612Geoff B.
MemberDear Helen,
Happy new year too!
I will make sure to report any findings I have.
Have a great day!
Geoff B.
December 30, 2016 at 10:16 am #1211831Brook
ParticipantHowdy Helen,
Thank you for working to isolate why that event is different. That gives me an idea. Could you try changing this line:
if( tribe_is_upcoming() ) {to:
if( tribe_is_list_view() ) {Does that help with the last event?
Cheers!
– Brook
January 12, 2017 at 1:50 am #1217251Helen
ParticipantHi Brook,
Thanks for the suggestion. I tried it and unfortunately it doesn’t fix the problem.
I hadn’t seen your response till today because I was checking my email instead of this thread and I never received a follow-up email. So this puts me in a difficult position because my deadline is fast approaching (like one week fast!) I’m kicking myself!
I eagerly await your next ninja coding move – this is the last thing I need to fix and I’m done! Help!!!
Best,
Helen
January 12, 2017 at 8:22 pm #1217865Geoff B.
MemberGood evening Helen,
I am sorry to hear about the communication breakdown and the deadline approaching fast.
I will follow-up to make sure Brook looks into this.
Hang in there,
Geoff B.January 13, 2017 at 9:34 am #1218170Brook
ParticipantHowdy again Helen,
I’d love to help you meet your deadline if I can.
I wonder if our orderby code is overriding part or all of yours? What happens if you remove our filter from the query:
function tribe_post_alphabetical_ordering( $query ) { if ( tribe_is_upcoming() ) { $query->set( 'orderby', 'name' ); $query->set( 'order', 'ASC' ); remove_filter( 'posts_orderby', array( 'Tribe__Events__Query', 'posts_orderby' ), 10, 2 ); } } add_action( 'tribe_events_pre_get_posts', 'tribe_post_alphabetical_ordering' );Cheers!
– Brook
January 13, 2017 at 11:28 am #1218244Helen
ParticipantBrook, Geoff – you guys are awesomazing!!!!
That fixed it. Thanks so much.
Best,
Helen
-
AuthorPosts
- The topic ‘Two questions: Event List in Alphabetical Order and Change Wording’ is closed to new replies.
