This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if paged %} | |
<p>Testimonials Page <em>{{ paged }}</em></p> | |
<div id="testimonials-page-{{ paged }}"> | |
{% for testimonial in testimonials %} | |
<div class="testimonial"> | |
<p>{{ testimonial.post_title }}</p> | |
{{ testimonial.post_content_html }} | |
</div> | |
{% endfor %} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TBTestimonialPaginate | |
{ | |
public $per_page; | |
/** | |
* magic | |
* | |
* @param mixed $per_page - testimonials to show per page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# template name: Add Testimonial Form | |
get_header(); | |
$testimonial = false; | |
$errors = array(); | |
/** | |
* testimonial data is being submitted | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# add testimonial | |
global $tbtestimonials; | |
$testimonial = array( | |
'post_type' => $tbtestimonials->post_type, | |
'post_status' => 'draft', | |
'post_title' => esc_attr( $author ), | |
'post_content' => wp_filter_kses( $content ) // no dirty stuff, k? k! | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* success message | |
* | |
*/ | |
function show_testimonial_success(){ | |
echo '<div class="success"><p>Thanks for submitting your testimonial for review!</p></div>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$testimonial = false; | |
$errors = array(); | |
/** | |
* testimonial data is being submitted | |
*/ | |
if( isset( $_POST['new_testimonial'] ) && is_array( $_POST['new_testimonial'] ) && count( $_POST['new_testimonial'] ) > 0 ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# template name: Add Testimonial Form | |
get_header(); | |
?> | |
<div id="content"> | |
<div class="entry-content"> | |
<form action="" method="post"> | |
<p> | |
<label for="testimonial-author">Name:</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* add a post/goal | |
* | |
* @param mixed $title | |
* @param mixed $content | |
* @param mixed $tags | |
*/ | |
public function add_goal( $title, $content, $tags = '' ) | |
{ | |
global $current_user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* outputting post meta must be done inside of 'the loop' | |
*/ | |
# college | |
if( false !== ( $college = get_post_meta( get_the_ID, 'college', 1 ) ) ) | |
echo $college; | |
else | |
echo 'No college'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* add custom template tags to tbtestimonials plugin | |
* | |
* @param mixed $t - twig instance | |
*/ | |
function add_tags_to_tbt( $t ){ | |
$t->addGlobal( 'testimonial_thumbnail', call_user_func( 'tbt_featured_image_tag' ) ); // #adds {{ testimonial_thumbnail }} template tag mapped to tbt_featured_image function | |
} |