Two questions: Event List in Alphabetical Order and Change Wording

Home Forums Calendar Products Events Calendar PRO Two questions: Event List in Alphabetical Order and Change Wording

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1209364
    Helen
    Participant

    Hi!

    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

    #1209918
    Geoff B.
    Member

    Good 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.

    #1209927
    Helen
    Participant

    Hi 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

    #1210217
    Geoff B.
    Member

    Good 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.

    #1211217
    Helen
    Participant

    Hi 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’ );

    }
    }

    #1211272
    Geoff B.
    Member

    Good 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.

    #1211286
    Helen
    Participant

    Thanks Geoff,

    I will hang in there 🙂

    Have a great New Year!!!

    #1211612
    Geoff B.
    Member

    Dear Helen,

    Happy new year too!

    I will make sure to report any findings I have.

    Have a great day!

    Geoff B.

    #1211831
    Brook
    Participant

    Howdy 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

    #1217251
    Helen
    Participant

    Hi 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

    #1217865
    Geoff B.
    Member

    Good 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.

    #1218170
    Brook
    Participant

    Howdy 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

    #1218244
    Helen
    Participant

    Brook, Geoff – you guys are awesomazing!!!!

    That fixed it. Thanks so much.

    Best,

    Helen

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Two questions: Event List in Alphabetical Order and Change Wording’ is closed to new replies.