本文整理汇总了PHP中have_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP have_rows函数的具体用法?PHP have_rows怎么用?PHP have_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了have_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zgm_flexible_content
function zgm_flexible_content()
{
global $post;
global $postid;
global $pagetemplateclass;
global $template;
$postid = $post->ID;
// get the global post and set the post id for use in get field calls and get_the_title()
$template = explode('.', basename(get_page_template()))[0];
// get template base name minus extension
$pagetemplateclass = '';
// set default for section class
$showAlways = false;
// set default for always show based on pre-existing setup incase felx content isnt set
$gracefull = true;
// check if the flexible content field has rows of data
ob_start();
if (have_rows('page_builder', $postid)) {
$gracefull = false;
// loop through the rows of data
while (have_rows('page_builder', $postid)) {
the_row();
// locate and insert templates for layouts
locate_template('templates/flexible/' . get_row_layout() . '.php', true, false);
}
}
ob_end_flush();
// end flex content
}
示例2: page_testimonials
function page_testimonials()
{
?>
<div class="container-fluid section-spacing background-color-dark-blue">
<div class="container wrap">
<div class="row">
<?php
if (have_rows('reviews')) {
while (have_rows('reviews')) {
the_row();
// Testimonial
$review = get_sub_field('review');
$author = get_sub_field('author');
$content_out = sprintf('
<blockquote class="text-italic col-md-8 col-md-offset-2">
<div class="quote-content"><p>“%s”</p></div>
<div class="quote-author text-left">%s</div>
</blockquote>', $review, $author);
echo $content_out;
}
}
?>
</div>
</div>
</div>
<?php
}
示例3: byadr_layout_builder
function byadr_layout_builder()
{
$lb = get_field('activar_layout_builder');
if ($lb) {
if (have_rows('layout_builder')) {
while (have_rows('layout_builder')) {
the_row();
// TEXT BLOCK
require get_template_directory() . '/inc/acf/lb-text-block.php';
// QUOTE
require get_template_directory() . '/inc/acf/lb-quote.php';
// GALLERY
require get_template_directory() . '/inc/acf/lb-gallery.php';
// VIDEO
require get_template_directory() . '/inc/acf/lb-video.php';
// IMAGE
require get_template_directory() . '/inc/acf/lb-image.php';
// MOSAICO
require get_template_directory() . '/inc/acf/lb-grid.php';
// SLIDER PRECIOS
require get_template_directory() . '/inc/acf/lb-slider.php';
// GRILLA DE IMAGENES
require get_template_directory() . '/inc/acf/lb-grilla.php';
// ZONAS DEPILACION
require get_template_directory() . '/inc/acf/lb-zonas.php';
// LISTADO DE ICONOS
require get_template_directory() . '/inc/acf/lb-icon-list.php';
// LISTADO DE PRECIOS
require get_template_directory() . '/inc/acf/lb-price-list.php';
}
}
} else {
echo get_template_part('template-part/content', 'default');
}
}
示例4: ss_include_slick_carousel
function ss_include_slick_carousel()
{
if (have_rows('slick_carousel_slider')) {
// repeater field: Slick Carousel Repeater
echo '<div class="wrap carousel-slider">';
echo '<div id="slider" class="carousel responsive-carousel">';
while (have_rows('slick_carousel_slider')) {
the_row();
// loop through the repeater field
$image = get_sub_field('image');
// get image from repeater
echo '<div>';
echo '<a rel="lightbox" class="fancybox-ss" href="';
echo $image['url'];
echo '"><img src="';
echo $image['url'];
echo '" alt="" /></a>';
echo '</div>';
}
// end loop
echo '</div>';
echo '</div>';
}
// End Carousel repeater
}
示例5: byadr_layout_builder
function byadr_layout_builder()
{
$lb = get_field('activar_layout_builder');
if ($lb) {
if (have_rows('layout_builder')) {
while (have_rows('layout_builder')) {
the_row();
// TEXT BLOCK
require get_template_directory() . '/inc/acf/lb-text-block.php';
// QUOTE
require get_template_directory() . '/inc/acf/lb-quote.php';
// GALLERY
require get_template_directory() . '/inc/acf/lb-gallery.php';
// VIDEO
require get_template_directory() . '/inc/acf/lb-video.php';
// IMAGE
require get_template_directory() . '/inc/acf/lb-image.php';
// MOSAICO
require get_template_directory() . '/inc/acf/lb-grid.php';
}
}
} else {
echo get_template_part('template-part/content', 'default');
}
}
示例6: render
public function render()
{
if (have_rows('carousel_items')) {
//acf
$otpt = '<div class="featured-carousel carousel cf">';
while (have_rows('carousel_items')) {
the_row();
$item_image = get_sub_field('item_image');
$description = get_sub_field('above_line');
$link_to = get_sub_field('link_to');
$button_text = get_sub_field('below_line');
$otpt .= '<div class="carousel-item">';
$imgDir = '\\Library\\php\\picture';
$imgObj = new $imgDir();
$imgObj->add_images_array(array($item_image['sizes']['full'], $item_image['sizes']['desktop'], $item_image['sizes']['tablet'], $item_image['sizes']['mobile']));
$imgObj->setClass('carousel-image');
$otpt .= $imgObj->templateBackground();
$otpt .= '<div class="carousel-text">';
$otpt .= '<a class="block " href="' . $link_to . '"><div class="carousel-description carousel-underline f-size-big">' . $description . '</div>';
$otpt .= '<div class="carousel-description f-size-big">' . $button_text . '</div></a>';
$otpt .= '</div>';
$otpt .= '</div>';
}
$otpt .= '</div>';
} else {
$otpt = 'repeat has no rows';
}
return $otpt;
}
示例7: __construct
function __construct()
{
if (get_sub_field('wrap') != null) {
$this->wrap = get_sub_field('wrap');
}
$i = 0;
if (have_rows('tours')) {
while (have_rows('tours')) {
the_row();
if (get_sub_field('title') != null) {
$this->tours[$i]['title'] = get_sub_field('title');
}
if (get_sub_field('description') != null) {
$this->tours[$i]['description'] = get_sub_field('description');
}
if (get_sub_field('price') != null) {
$this->tours[$i]['price'] = get_sub_field('price');
}
if (get_sub_field('duration') != null) {
$this->tours[$i]['duration'] = get_sub_field('duration');
}
if (get_sub_field('link_button') != null) {
$this->tours[$i]['link_button'] = get_sub_field('link_button');
}
$i++;
}
}
}
示例8: build_scoreset
public function build_scoreset()
{
$this->elp_content = '<section class="elp-content">';
foreach ($this->elp_categories as $category) {
//we'll need these strings to call fields from within loops
$field_base_name = strtolower(preg_replace('/\\s+/', '', $category));
$repeater_field_title = $field_base_name . '_scores';
$score_field_title = $field_base_name . '_score';
$note_field_title = $field_base_name . '_score_additional_text_and_images';
$date_field_title = $field_base_name . '_score_date';
//catgory heading for each category
$this->elp_content .= '<div class="elp-category cat-' . $field_base_name . '">';
$this->elp_content .= '<h3>' . $category . '</h3>';
//for each repeater row, three fields
while (have_rows($repeater_field_title)) {
the_row();
if (get_sub_field('show_on_front') == true) {
$this->elp_content .= '<div class="elp-date elp-' . $field_base_name . '">' . get_sub_field($date_field_title) . '</div>';
$this->elp_content .= '<div class="elp-score elp-' . $field_base_name . '">' . get_sub_field($score_field_title) . '</div>';
$this->elp_content .= '<div class="elp-score-notes elp-' . $field_base_name . '">' . get_sub_field($note_field_title) . '</div>';
}
}
//end repeater instance(s)
$this->elp_content .= '</div>';
}
$this->elp_content .= '</section>';
}
示例9: getSectionsHTML
/**
* Retrieves all the section HTML
* @param String $name The slug used for the sections. Is 'sections' by default
* @return String The final HTML
*/
public function getSectionsHTML($name, $post_id)
{
if (!$this->acf_active) {
return '';
}
if (have_rows($name, $post_id)) {
$s = 1;
$this->html = '<div id="acfpb_sections">';
while (have_rows($name, $post_id)) {
the_row();
$layout = get_row_layout();
if (method_exists(get_class(), 'getSection_' . $layout)) {
$id = 'section_' . $s;
$class = 'acfpb_section section-' . $layout;
$style = get_sub_field('bg') ? 'background-color:' . get_sub_field('bg') : '';
$contained = (bool) get_sub_field('contained', false);
if (!$this->use_bs && $contained) {
$contained = false;
}
$wrapper = get_sub_field('wrapper_class');
$this->html .= '<div id="' . $id . '" class="' . $class . '" style="' . $style . '">';
if ($contained) {
$this->html .= '<div class="container">';
}
if ($contained) {
$this->html .= '<div class="row">';
}
if ($wrapper !== '') {
$this->html .= '<div class="' . $wrapper . '">';
}
$this->html .= $this->{'getSection_' . $layout}();
if ($wrapper !== '') {
$this->html .= '</div>';
}
// Wrapper finish
if ($this->use_bs) {
$this->html .= '<div class="clearfix"></div>';
}
if ($contained) {
$this->html .= '</div>';
}
// Row finish
if ($contained) {
$this->html .= '</div>';
}
// Container finish
$this->html .= '</div>';
// Section finish
$s++;
}
}
$this->html .= '</div>';
// Main Wrapper finish
return $this->html;
} else {
return '';
}
}
示例10: getAlternateLanguages
private function getAlternateLanguages()
{
if (have_rows('quan_meta_hreflang')) {
while (have_rows('quan_meta_hreflang')) {
the_row();
echo sprintf('<link rel="alternate" href="%s" hreflang="%s" />', get_permalink(get_sub_field('quan_meta_hreflang_url')), get_sub_field('quan_meta_hreflang_code'));
}
}
}
示例11: get_new_report_count
public function get_new_report_count($repeater_field)
{
$report_with_new_status = array();
while (have_rows($repeater_field)) {
the_row();
if (get_sub_field('report_status') == 'New') {
array_push($report_with_new_status, get_sub_field('report_status'));
}
}
return count($report_with_new_status);
}
示例12: fill_slides
public function fill_slides()
{
if (have_rows('slides')) {
while (have_rows('slides')) {
the_row();
$image = get_sub_field('image');
$title = get_sub_field('slide_title');
$desc = get_sub_field('slide_description');
$this->add_slide($image, esc_js($title), trim(preg_replace('/\\s+/', ' ', $desc)), $image);
}
}
}
示例13: uf_slider_output
function uf_slider_output($sliderSlug = 'default')
{
$output = '';
if (have_rows('sliders', 'options')) {
while (have_rows('sliders', 'options')) {
the_row();
$currentSlider = get_sub_field('slider_slug', 'options');
if (get_sub_field('slider_slug', 'options') == $sliderSlug) {
while (have_rows('slides', 'options')) {
the_row();
// echo get_sub_field('caption', 'options');
}
$activeClass = 'active';
$sliderCount = 0;
$output .= '<div id="uf-slider-' . $sliderSlug . '" class="carousel slide round" data-ride="carousel">';
$output .= '<ol class="carousel-indicators">';
while (have_rows('slides', 'options')) {
the_row();
// echo get_sub_field('caption', 'options');
$output .= '<li data-target="#uf-slider-' . $sliderSlug . '" data-slide-to="' . $sliderCount . '" class="' . $activeClass . '"></li>';
$activeClass = '';
$sliderCount++;
}
$output .= '</ol>';
$activeClass = 'active';
$output .= '<div class="carousel-inner round" role="listbox">';
while (have_rows('slides', 'options')) {
the_row();
$output .= '<div class="item round ' . $activeClass . '">';
$output .= '<img src="' . acf_image_slider(get_sub_field('image', 'options'), $sliderSlug) . '" class="round">';
// $output .= print_r(get_sub_field('image', 'options'));
$output .= '<div class="carousel-caption">';
$output .= get_sub_field('caption', 'options');
$output .= '</div>';
$output .= '</div>';
$activeClass = '';
}
$output .= '</div>';
$output .= '<!-- Controls -->';
$output .= '<a class="left carousel-control" href="#uf-slider-' . $sliderSlug . '" role="button" data-slide="prev">';
$output .= '<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>';
$output .= '<span class="sr-only">Previous</span>';
$output .= '</a>';
$output .= '<a class="right carousel-control" href="#uf-slider-' . $sliderSlug . '" role="button" data-slide="next">';
$output .= '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>';
$output .= '<span class="sr-only">Next</span>';
$output .= '</a>';
$output .= '</div>';
}
}
}
return $output;
}
示例14: get_features
function get_features($language)
{
if (have_rows('feature_content')) {
while (have_rows('feature_content')) {
the_row();
//all features
feature_full($language);
feature_grid_2_2_editor($language);
}
wp_reset_query();
}
}
示例15: acf_load_goole_fonts
function acf_load_goole_fonts($field)
{
$fonts = get_field('db_fonts', 'options');
$field['choices'] = array();
if (have_rows('db_fonts', 'option')) {
while (have_rows('db_fonts', 'option')) {
the_row();
$font = get_sub_field('db_font');
$value = $font['font'];
$field['choices'][$value] = $value;
}
}
return $field;
}