• Resolved homme4

    (@homme4)


    In single-event.php,
    I want to change the link title of next/prevbtn at the footer,
    but I can’t change the title of the article to any character.

    I tried the following in Directory [tribe-events/single-event.php]

    
    from
    <li class="tribe-events-nav-previous"><?php tribe_the_prev_event_link("<span>&laquo;</span> %title%") ?></li>
    
    to
    
    <li class="tribe-events-nav-previous"><?php tribe_the_prev_event_link("<< prev") ?></li>
    • This topic was modified 2 years, 8 months ago by homme4.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Are you trying to change the Left Arrow and Right Arrows?

    Those are actually being added using a CSS pseudo element ::before

    Thread Starter homme4

    (@homme4)

    Thank you for your reply!

    I don’t want to change the arrow,
    need to change the string.

    It is a fixed character from the article title, for example, <Next>.

    Hello homme4, thank you for your reply.

    I think you may have discovered an issue in the plugin.

    While that’s addressed, I came up with this PHP snippet which worked for me:

    <?php
    /* Previous */
    add_filter( 'tribe_the_prev_event_link', function( $link ) {
    	// Set the new string
    	$new_string = 'Previous';
    
    	// Get rid of HTML entity
    	$link = str_replace( '<span>&laquo;</span> ', '', $link );
    	
    	// Parse the element
    	$a = new SimpleXMLElement( $link );
    
    	// Build the new link
    	$link = '<a href="' . $a["href"] . '">' . $new_string . '</a>';
    	
    	return $link;
    } );
    
    /* Next */
    add_filter( 'tribe_the_next_event_link', function( $link ) {
    	// Set the new string
    	$new_string = 'Next';
    
    	// Get rid of HTML entity
    	$link = str_replace( ' <span>&raquo;</span>', '', $link );
    	
    	// Parse the element
    	$a = new SimpleXMLElement( $link );
    
    	// Build the new link
    	$link = '<a href="' . $a["href"] . '">' . $new_string . '</a>';
    	
    	return $link;
    } );

    Please see here for our guide on adding custom code snippets: https://theeventscalendar.com/knowledgebase/k/best-practices-for-implementing-custom-code-snippets/

    To clarify, you shouldn’t need to do this. What you were trying to do should have worked.

    This snippet (well, two snippets: one for “Previous” and one for “Next”) is only meant as a temporary workaround while this is addressed in the plugin itself.

    Once it’s addressed, you should be able to use functions like tribe_the_prev_event_link as you were trying to.

    Hope this helps. Please let us know how it goes.

    Best regards,
    Leland

    Thread Starter homme4

    (@homme4)

    Your snippet code worked fine and was able to replace the string.
    Thanks for replying !!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘change link title word in single-event.php’ is closed to new replies.