-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-testimonials.php
150 lines (124 loc) · 4.44 KB
/
page-testimonials.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**
* The template for displaying Page Testimonials.
*
* @package ThemeIsle
*
* Template Name: Testimonials
*/
get_header();
?>
<div class="wrap">
<div id="testimonials">
<div class="title-border">
<h3>Testimonials</h3>
</div><!--/.title-border-->
<div class="testimonials-boxes">
<?php
$args = array (
'post_type' => 'testimonials',
'posts_per_page' => '3',
'ignore_sticky_posts' => true,
);
$testimonials = new WP_Query( $args );
if ( $testimonials->have_posts() ) {
while ( $testimonials->have_posts() ) {
$testimonials->the_post();
$testimonials_position = get_post_meta($post->ID, 'ti_testimonials_position', true);
$testimonials_company_name = get_post_meta($post->ID, 'ti_testimonials_company_name', true);
$testimonials_company_url = get_post_meta($post->ID, 'ti_testimonials_company_url', true);
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<div class="testimonials-box">
<div class="testimonial-box-entry">
<?php the_excerpt(); ?>
</div><!--/.testimonials-boxes-->
<span></span>
<div class="testimonial-box-detail">
<?php
if ( $featured_image != NULL ) {
echo '<img src="' . $featured_image[0] . '" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />';
}
?>
<b>
<?php
if ( $testimonials_company_url != NULL ) { ?>
<a href="<?php echo $testimonials_company_url; ?>" title="<?php the_title(); ?>">
<?php
if ( ( $testimonials_position && $testimonials_company_name ) == NULL ) {
$line = '';
} else {
$line = ', ';
}
the_title();
echo $line;
?>
</a>
<?php } else {
the_title();
}
?>
</b><br />
<?php
if ( ( $testimonials_position && $testimonials_company_name ) == NULL ) {
$at = '';
} else {
$at = ' at ';
}
echo $testimonials_position;
echo $at;
if ( $testimonials_company_url != false ) {
echo '<a href="'. $testimonials_company_url .'" title="'. $testimonials_company_name .'">'. $testimonials_company_name .'</a>';
} else {
echo $testimonials_company_name;
}
?>
</div><!--/.testimonial-box-detail-->
</div><!--/.testimonials-box-->
<?php }
} else {
echo '<p>No posts found.</p>';
}
wp_reset_postdata();
?>
</div><!--/.testimonials-boxes-->
<div class="testimonials-boxes">
<?php
$args = array (
'post_type' => 'testimonials',
'posts_per_page' => '3',
'ignore_sticky_posts' => true,
'offset' => '3',
);
$testimonials = new WP_Query( $args );
if ( $testimonials->have_posts() ) {
while ( $testimonials->have_posts() ) {
$testimonials->the_post();
$testimonials_position = get_post_meta($post->ID, 'ti_testimonials_position', true);
$testimonials_company_name = get_post_meta($post->ID, 'ti_testimonials_company_name', true);
$testimonials_company_url = get_post_meta($post->ID, 'ti_testimonials_company_url', true);
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<div class="testimonials-box">
<div class="testimonial-box-entry">
<?php the_excerpt(); ?>
</div><!--/.testimonials-boxes-->
<span></span>
<div class="testimonial-box-detail">
<?php
if ( $featured_image != NULL ) {
echo '<img src="' . $featured_image[0] . '" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" />';
}
?>
<b><a href="<?php echo $testimonials_company_url; ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></b>,<br />
<?php echo $testimonials_position; ?> <?php _e( 'at', 'ti' ); ?> <a href="<?php echo $testimonials_company_url; ?>" title="<?php echo $testimonials_company_name; ?>"><?php echo $testimonials_company_name; ?></a>
</div><!--/.testimonial-box-detail-->
</div><!--/.testimonials-box-->
<?php }
} else {
echo '<p>No posts found.</p>';
}
wp_reset_postdata();
?>
</div><!--/.testimonials-boxes-->
</div><!--/#testimonials-->
</div><!--/.wrap-->
<?php get_footer(); ?>