admin管理员组文章数量:1277403
In the test environment I see this error ( ! ) Notice: Undefined variable: testimonial in D:\Projects\PWP-WP\wp-content\themes\blankslate-child\template-parts\fields\flex\bottom-page-block.php on line 123
. I know the reason for the error. What I need help with is how to get the right parameter to pass in the function echo get_the_permalink($testimonial);
Below is the PHP script generating the error.
<?php
$image1 = get_sub_field( 'image_1' );
$image2 = get_sub_field( 'image_2' );
?>
<div class="pl pr mt-row">
<div class="inside mini">
<?php if ( $headline = get_sub_field( 'headline' ) ) : ?>
<div class="mb">
<h2 class="mb0 color-purple-base">
<?php echo $headline; ?>
</h2>
</div>
<?php endif; ?>
<?php if ( $text_area = get_sub_field( 'text_area' ) ) : ?>
<article class="body-area mb">
<?php echo $text_area; ?>
</article>
<?php endif; ?>
<?php if ( $subheadline = get_sub_field( 'subheadline' ) ) : ?>
<div class="mb">
<h3 class="alt-heading mb0 h6">
<?php echo $subheadline; ?>
</h3>
</div>
<?php endif; ?>
</div><!-- inside.mini -->
<?php if($image1 || $image2): ?>
<div class="image1-image2-wrap relative mt2x">
<div class="row mb2x-row nested">
<?php if($image1): ?>
<div class="col col-xs-12 col-md-6">
<div class="bottom-image-wrap relative">
<div class="object-cover-wrap">
<picture>
<source media="(max-width: 360px)" srcset="<?php echo($image1['sizes']['xsmall']); ?>">
<source media="(max-width: 640px)" srcset="<?php echo($image1['sizes']['small']); ?>">
<source media="(max-width: 1024px)" srcset="<?php echo($image1['sizes']['medium']); ?>">
<source srcset="<?php echo($image1['sizes']['large']); ?>">
<img src="<?php echo($image1['sizes']['large']); ?>" alt="<?php echo $image1['alt']; ?>" />
</picture>
</div>
</div>
</div>
<?php endif; ?>
<?php if($image2): ?>
<div class="col col-xs-12 col-md-6">
<div class="bottom-image-wrap relative">
<div class="object-cover-wrap">
<picture>
<source media="(max-width: 360px)" srcset="<?php echo($image2['sizes']['xsmall']); ?>">
<source media="(max-width: 640px)" srcset="<?php echo($image2['sizes']['small']); ?>">
<source media="(max-width: 1024px)" srcset="<?php echo($image2['sizes']['medium']); ?>">
<source srcset="<?php echo($image2['sizes']['large']); ?>">
<img src="<?php echo($image2['sizes']['large']); ?>" alt="<?php echo $image2['alt']; ?>" />
</picture>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if ( $link = get_sub_field( 'cta' ) ) : ?>
<div class="inside mt2x">
<div class="center-xs">
<a href="<?php echo $link['url']; ?>" class="btn btn-tan" role="button" target="<?php echo $link['target']; ?>" title="<?php echo $link['title']; ?>">
<?php echo $link['title']; ?>
</a>
</div>
</div>
<?php endif; ?>
<?php
$posts = get_sub_field( 'testimonials' );
if ( $posts ) : ?>
<div class="inside mt-row">
<div id="pp-testimonial" class="testimonial-box show-arrows">
<div class="pp-quote-box center-xs relative">
<div class="pl pr">
<div class="pt hide-md"></div>
<div class="pt2x hide-xs show-md"></div>
<i class="absolute icon-quote no-touch select-none"></i>
<div id="testimonial-slider">
<?php foreach( $posts as $post) : ?>
<?php setup_postdata( $post ); ?>
<div class="slide">
<blockquote><?php echo get_the_content(); ?></blockquote>
<?php
if ( $testimonial_author = get_field( 'testimonial_-_author' ) ) :
echo "<p class='mt4 mb0'>— $testimonial_author</p>";
endif; ?>
<?php
if ( $testimonial_company = get_field( 'testimonial_-_company' ) ) :
echo "<p class='mt2 mb0 bold caps small'>$testimonial_company</p>";
endif; ?>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</div>
<div class="pb hide-md"></div>
<div class="pb2x hide-xs show-md"></div>
</div>
</div>
</div>
<div class="mt2x center-xs">
<a href="<?php echo get_the_permalink($testimonial); ?>" class="btn" role="button">
Read All Reviews
</a>
</div>
</div>
<?php endif; ?>
</div>
本文标签:
版权声明:本文标题:permalinks - Undefined variable: testimonial in D:ProjectsPWP-WPwp-contentthemesblankslate-childtemplate-partsfieldsflexbottom-p 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741247118a2365091.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论