本文整理汇总了PHP中get_row_layout函数的典型用法代码示例。如果您正苦于以下问题:PHP get_row_layout函数的具体用法?PHP get_row_layout怎么用?PHP get_row_layout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_row_layout函数的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: ci_classes
/**
* Set classes for the cover image container. These can be overridden or added to with a filter like the following:
* add_filter( 'cover_media_set_classes', 'custom_cover_classes' );
* function custom_cover_classes($classes) {
* if(is_page_template('template-landing-page.php') {
* $classes[] = 'on-landing-page';
* }
* return $classes;
* }
*
* @return string string of classes
*/
function ci_classes()
{
$classes = array();
$classes[] = 'cover-media-container';
$classes[] = 'cover-media-' . get_row_layout();
$classes = array_filter(array_map('trim', $classes));
echo trim(implode(' ', apply_filters('cover_media_set_classes', $classes)));
}
示例3: 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 '';
}
}
示例4: get_sub_field_brick_class_name
/**
* @return string
*/
public static function get_sub_field_brick_class_name()
{
$row_layout = get_row_layout();
$class_name = get_sub_field($row_layout . '_brick_class');
if (is_null($class_name)) {
die('get_sub_field_brick_instance() could not find a hidden field named ' . $row_layout . '_brick_class .');
}
return $class_name;
}
示例5: the_modules_loop
function the_modules_loop($modules_field = 'modules')
{
// Loop through rows of flexible content field
while (the_flexible_field($modules_field)) {
// Render module template based on the row layout's name
$module_name = str_replace('_', '-', get_row_layout());
the_module($module_name);
}
}
示例6: feature_grid_2_2_editor
/**
* GRID: Half-Half Editor
*
* @param $languarge
*/
function feature_grid_2_2_editor($language)
{
if (get_row_layout() == 'half-half') {
$maxWidth = get_sub_field('22_width');
$backgroundColor = 'background-color: ' . get_sub_field('22_background_color') . '; ';
$padding = 'padding: ' . get_sub_field('22_padding') . '; ';
$center = get_sub_field('22_center');
$css = '<style>' . get_sub_field('22_box_css') . '</style>';
$hash = md5(get_sub_field('grid_left_de'));
# uk-margin-large-top | uk-margin-large-bottom
$selected = get_sub_field('22_easy_margin');
if (in_array('top', $selected)) {
$top = 'uk-margin-large-top';
}
if (in_array('bottom', $selected)) {
$bottom = 'uk-margin-large-bottom';
}
if ($top != '' || $bottom != '') {
$margin = ' class="' . $top . ' ' . $bottom . '"';
}
if ($center != 'no') {
$center_1 = '<center>';
$center_2 = '</center>';
}
if (get_sub_field('22_animation_left') != 'no') {
$animation_left = get_sub_field('22_animation_left');
$a_left = 'data-uk-scrollspy="{cls:\'uk-animation-' . $animation_left . '\', repeat: false}"';
}
if (get_sub_field('22_animation_right') != 'no') {
$animation_right = get_sub_field('22_animation_right');
$a_right = 'data-uk-scrollspy="{cls:\'uk-animation-' . $animation_right . '\', repeat: false}"';
}
echo '<div id="ultraschall-box-' . $hash . '" style="' . $backgroundColor . '"' . $margin . '>';
echo '<div class="uk-container uk-container-center"
style="max-width: ' . $maxWidth . 'px;' . $backgroundColor . '' . $padding . '">';
echo '<div class="uk-grid" data-uk-grid-margin="">';
echo '<div class="uk-width-medium-1-2" ' . $a_left . ' data-uk-grid-margin="">';
echo the_sub_field('grid_left_' . $language);
echo '</div>';
echo '<div class="uk-width-medium-1-2" ' . $a_right . ' data-uk-grid-margin="">';
echo the_sub_field('grid_right_' . $language);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
}
示例7: show_article
function show_article()
{
?>
<article id="<?php
the_sub_field('id');
?>
" class="Section__article <?php
the_sub_field('class');
?>
">
<?php
if (get_row_layout() == 'html') {
Show_html();
}
?>
</article>
<?php
//
}
示例8: bw_process_queue
function bw_process_queue()
{
$content = '';
$content = get_field('intro');
if (have_rows('queue_content')) {
// loop through the rows of data
while (have_rows('queue_content')) {
the_row();
if (get_row_layout() == 'question_and_answer') {
$content .= '<div class="bw_queue_question">' . "\n";
$content .= '<div class="bw_queue_question_from">' . get_sub_field('from') . '</div>' . "\n";
$content .= '<div class="bw_queue_question_body">' . get_sub_field('question') . '</div>' . "\n";
$content .= '</div>' . "\n";
$content .= get_sub_field('answer');
} elseif (get_row_layout() == 'generic_content') {
$content .= get_sub_field('generic_content_block');
}
}
} else {
// no layouts found
}
$content .= get_field('outro');
return $content;
}
示例9: acf_get_sub_field
function acf_get_sub_field($selector, $field)
{
// sub fields
if ($field['type'] == 'repeater') {
// extract sub fields
$sub_fields = acf_extract_var($field, 'sub_fields');
if (!empty($sub_fields)) {
foreach ($sub_fields as $sub_field) {
if ($sub_field['name'] == $selector || $sub_field['key'] == $selector) {
// return
return $sub_field;
}
// if
}
// foreach
}
// if
} elseif ($field['type'] == 'flexible_content') {
// vars
$layouts = acf_extract_var($field, 'layouts');
$current = get_row_layout();
if (!empty($layouts)) {
foreach ($layouts as $layout) {
// skip layout if the current layout key does not match
if ($current && $current !== $layout['name']) {
continue;
}
// extract sub fields
$sub_fields = acf_extract_var($layout, 'sub_fields');
if (!empty($sub_fields)) {
foreach ($sub_fields as $sub_field) {
if ($sub_field['name'] == $selector || $sub_field['key'] == $selector) {
// return
return $sub_field;
}
// if
}
// foreach
}
// if
}
// foreach
}
// if
}
// if
// return
return false;
}
示例10: isset
<?php
/********************************
* Regular Content
********************************/
?>
<?php
$id = isset($id) ? $id : $post->ID;
$i = 0;
if (get_field('content', $id)) {
while (has_sub_field('content', $id)) {
?>
<?php
$layout = get_row_layout();
switch ($layout) {
case 'row':
if (get_sub_field('columns')) {
?>
<div <?php
if (get_sub_field('anchor_id')) {
?>
id="<?php
the_sub_field('anchor_id');
?>
"<?php
}
?>
<?php
if (get_sub_field('anchor_label')) {
示例11: the_sub_field
the_sub_field("block_simple_title_button_link");
?>
" class="button uppercase background-<?php
the_sub_field('block_simple_title_button_color_button');
?>
color-white font-size-16 margin-top-30 display-inline-block">
<?php
the_sub_field("block_simple_title_button_label_button");
?>
</a>
</div>
<?php
} elseif (get_row_layout() == "block_simple_button") {
// layout: Block simple avec bouton mais pas de titre
?>
<div class="site-banner background-<?php
the_sub_field('block_simple_button_background');
?>
has-padding text-center position-relative <?php
if (get_sub_field('block_simple_title_button_illustration')) {
?>
has-illustration<?php
}
?>
">
<div class="site-banner__content-inner-full site-banner__content-inner display-inline-block">
<p class="site-banner__content-inner__text color-<?php
示例12: elseif
} elseif (get_row_layout() == 'energy_savings_link') {
?>
<div class="box link bank">
<?php
the_field('bank_text', 'option');
?>
<a href="<?php
the_field('bank_link', 'option');
?>
" ></a>
<div class="clear"></div>
</div>
<?php
} elseif (get_row_layout() == 'call_before_you_dig_information') {
?>
<div class="box dig">
<?php
the_field('dig_text', 'option');
?>
<div class="clear"></div>
</div>
<?php
}
}
} else {
// no layouts found
}
?>
示例13: get_sub_field
?>
<?php
// Vars
$sectionName = get_sub_field('section_name');
$left = get_sub_field('one_third_left');
$right = get_sub_field('two_thirds_right');
echo '<section class="third-split left-text ' . $sectionName . '"><figure><figcaption class="left slide-left">' . $left . '</figcaption><span style="background-image: url(' . $right . ');"></span></figure></section>';
?>
<?php
}
?>
<?php
// No Container One Third Right Text
if (get_row_layout() == 'no_container_third_right') {
?>
<?php
// Vars
$sectionName = get_sub_field('section_name');
$left = get_sub_field('two_thirds_left');
$right = get_sub_field('one_third_right');
echo '<section class="third-split right-text ' . $sectionName . '"><figure><span style="background-image: url(' . $left . ');"></span><figcaption class="right slide-right">' . $right . '</figcaption></figure></section>';
?>
<?php
}
?>
<?php
}
示例14: array
<?php
include "template-parts/acf-modules/top-content.php";
?>
<?php
$thepages = array('tabbed_page_1', 'tabbed_page_2', 'tabbed_page_3', 'tabbed_page_4', 'tabbed_page_5', 'tabbed_page_6', 'tabbed_page_7');
echo '<div class="tabbedPageMenu"><ul class="tabbedPageMenu-list">';
foreach ($thepages as $thepage) {
if (have_rows($thepage)) {
while (have_rows($thepage)) {
the_row();
?>
<?php
if (get_row_layout() == 'tab_info') {
?>
<?php
$tab_title = get_sub_field('tab_title');
?>
<?php
$tab_hash = get_sub_field('tab_hash');
?>
<li><a class="<?php
echo $tab_hash;
?>
" href="#<?php
echo $tab_hash;
?>
示例15:
<a class="right carousel-control" href="#promo-carousel-m" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div> <!-- /carousel -->
</div>
<?php
}
?>
<!--end carousel-->
<!--Post Carousel-->
<!--Check for slide show-->
<?php
if (get_row_layout() == 'post_carousel') {
?>
<div class="news_and_events_carousel col-md-12 no-gutter content-section light-grey-bg ">
<div class="news_and_events_carousel-header">
<div class="clearfix row">
<?php
if (get_sub_field('title')) {
?>
<span class="col-md-6 col-md-offset-3"><h4><?php
the_sub_field('title');
?>
</h4></span>
<?php
}