Skip to content

Instantly share code, notes, and snippets.

@TravisBallard
Last active December 15, 2015 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TravisBallard/5294137 to your computer and use it in GitHub Desktop.
Save TravisBallard/5294137 to your computer and use it in GitHub Desktop.
Adding custom more link to template tags in TB-Testimonials
<?php
add_action( 'tbt_template_functions', 'add_tags_to_tbt' );
/**
* add custom template tags to tbtestimonials plugin
*
* @param mixed $t - twig instance
*/
function add_tags_to_tbt( $t )
{
$t->addGlobal( 'page_link', call_user_func( 'tbt_testimonial_page_link' ) );
}
/**
* return link to testimonials page
*
*/
function tbt_testimonial_page_link()
{
if( $page = get_page_by_title( 'testimonials' ) ){
return sprintf( ' <a href="%s#testimonial-%d">Read More</a>', get_permalink( $page->ID ), get_the_ID() );
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment