<?php

namespace Yoast\YoastCom\Theme;

if (!isset($template_args['class1'])) {
    $template_args['class1'] = '';
}
if (!isset($template_args['class2'])) {
    $template_args['class2'] = '';
}
$bundles = query_bundles(array('posts_per_page' => 3, 'orderby' => 'rand'));
while ($bundles->have_posts()) {
    $bundles->the_post();
    ?>
	<?php 
    $url = post_meta('url');
    if (!$url) {
        $url = get_permalink();
    }
    $percentage = post_meta('savings');
    $percentage = rtrim($percentage, '%');
    if (!$percentage || $percentage === '') {
        $percentage = '30';
    }
    ?>
	<a href="<?php 
    echo $url;
    ?>
" class="more <?php 
    echo esc_attr($template_args['class1']);
    ?>
					<blockquote><?php 
        echo kses_blockquote(post_meta('testimonial'));
        ?>
</blockquote>
				<?php 
    }
    ?>
			</article>

			<hr>
		<?php 
}
?>

		<?php 
$bundles = query_bundles(array('query_ebook_bundles' => true));
$i = 0;
?>
		<?php 
while ($bundles->have_posts()) {
    $bundles->the_post();
    $i++;
    ?>
			<article class="row island">
				<?php 
    get_template_part('html_includes/partials/ebook-bundle');
    ?>
			</article>

			<?php 
    // Don't display a seperator after the last bundle because the announcement is there already.
Пример #3
0
<?php

namespace Yoast\YoastCom\Theme;

?>
<div class="announcement announcement--pointer-top fill fill--secondary">
	<div class="row">
		<h2><?php 
echo esc_html($template_args['heading']);
?>
</h2>
		<?php 
$bundles = query_bundles(array('post__in' => $template_args['bundles'], 'posts_per_page' => 2));
?>
		<?php 
while ($bundles->have_posts()) {
    $bundles->the_post();
    ?>
			<?php 
    $url = post_meta('url');
    if (!$url) {
        $url = get_permalink();
    }
    $savings = trim(post_meta('savings'));
    if (empty($savings)) {
        $savings = '20';
    }
    ?>
			<a href="<?php 
    echo esc_url($url);
    ?>