本文整理汇总了PHP中has_sub_field函数的典型用法代码示例。如果您正苦于以下问题:PHP has_sub_field函数的具体用法?PHP has_sub_field怎么用?PHP has_sub_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_sub_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: homeSliders
function homeSliders($name = '', $id = 0, $w = '1600', $h = '440')
{
$html = '<link rel="stylesheet" type="text/css" href="' . get_bloginfo("template_directory") . '/assets/css/flexslider.css" media="screen" />
<div class=" nopad" id="home-flexslider-wrapper">
<div class="flexslider" style="margin:0 auto;">
<ul class="slides">';
if (get_field($name, $id)) {
while (has_sub_field($name, $id)) {
$img = get_template_directory_uri() . '/tmb.php?src=' . get_sub_field('image', $id) . '&w=' . $w . '&h=' . $h . '&q=90';
$html .= '<li ><img src="' . $img . '" / >
<div class="flex-caption">
<div>
<h3>' . get_sub_field('title', $id) . '</h3>
</div>
</div>
</li>';
}
$html .= '</ul>
<div class="clear"></div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
jQuery(\'.flexslider\').flexslider({
animation: "fade",
pauseOnHover: true,
start: function(slider){}
});
});
</script>';
}
return $html;
}
示例2: _has_sub_field
/**
* Check if a given field has a sub field
* @param str $key The meta key
* @param mixed $id The post ID
* @return bool
* @uses has_sub_field()
*/
function _has_sub_field($key, $id = false)
{
if (function_exists('has_sub_field')) {
return has_sub_field($key, $id);
} else {
return false;
}
}
示例3: change_sidebar_context
/**
* Changes the context for a sidebar
*
* return void
*/
function change_sidebar_context()
{
global $post, $wp_query, $dr_orig_wp_query, $dr_query_modified;
$dr_orig_wp_query = $wp_query;
// Get relationship field, if exists
while (has_sub_field('relationship', 'option')) {
if (get_sub_field('post_type') == $post->post_type) {
$post = get_sub_field('detail_page');
query_posts(array('p' => $post->ID));
pw_filter_widgets(get_option('sidebars_widgets'));
$dr_query_modified = true;
}
}
}
示例4: ImageBlocks
function ImageBlocks($id = 0, $w = '1600', $h = '440')
{
$name = 'Image_blocks';
$html = '<div id="image-blocks-wrapper">
<div class="row" style="margin-bottom:1.5em;">';
$popupCounter = 0;
if (get_field($name, $id)) {
while (has_sub_field($name, $id)) {
$img = get_template_directory_uri() . '/tmb.php?src=' . get_sub_field('block_image', $id) . '&w=' . $w . '&h=' . $h . '&q=90';
if (get_sub_field('block_type', $id) == 'popup') {
$html .= '<div class="small-12 medium-6 large-4 columns nopad" >
<h3>' . get_sub_field('block_title', $id) . '</h3>
<a title="click to view more" onclick="jQuery(\'#popup-div' . $popupCounter . '\').foundation(\'reveal\', \'open\');"
href="javascript:return false;"
class="image-block-links" style="background-image: url(\'' . $img . '\');">
<span><div>' . get_sub_field('block_desc', $id) . ' Read More ></div></span></a></div>';
// popup content
$html .= '<div id="popup-div' . $popupCounter . '" class="reveal-modal" data-reveal>
<div class="row row-wide">
<div class="large-12 medium-12 columns" >
<h2 class="popup-title">' . get_sub_field('block_title', $id) . '</h2>
<div class="large-3 medium-3 small-12 columns nopad" class="popup-image">
<div style="background-image: url(\'' . $img . '\');" class="popup-image"></div>
</div>
<div class="large-9 medium-9 small-12 columns" >
' . get_sub_field('block_popup_content', $id) . '
</div>
</div></div>
<a class="close-reveal-modal" id="close-popup-div">×</a> </div>';
$popupCounter++;
} else {
$html .= '<div class="small-12 medium-6 large-4 columns nopad" >
<h3>' . get_sub_field('block_title', $id) . '</h3>
<a title="click to view more" href="' . get_sub_field('block_link', $id) . '"
class="image-block-links" style="background-image: url(\'' . $img . '\');">
<span><div>' . get_sub_field('block_desc', $id) . ' Read More ></div></span></a></div>';
}
}
}
$html .= '</div></div>';
return $html;
}
示例5: VideoBlocks
function VideoBlocks($id = 0, $w = '1600', $h = '440')
{
$name = 'youtube_videos';
$html = '<div id="image-blocks-wrapper">
<div class="row" style="margin-bottom:1.5em;">';
$popupCounter = 0;
if (get_field($name, $id)) {
while (has_sub_field($name, $id)) {
$html .= '
<div class="small-12 medium-6 large-4 columns nopad" >
<h3>' . get_sub_field('video_title', $id) . '</h3>
<iframe class="video-block-iframe"
src="https://www.youtube.com/embed/' . get_sub_field('video_id', $id) . '?autoplay=0">
</iframe></div>';
}
}
$html .= '</div></div>';
return $html;
}
示例6: aps_scholarship_author
function aps_scholarship_author()
{
$echo_string = "";
if (get_field('scholarship_is_author_member') == 'Yes') {
$echo_string .= '<a href="' . bp_core_get_user_domain(get_field('scholarship_author_member')['ID']) . '">' . get_field('scholarship_author') . '</a>';
} else {
$echo_string .= get_field('scholarship_author');
}
if (get_field('scholarship_are_there_secondary_authors') === "Yes") {
while (has_sub_field('scholarship_secondary_authors')) {
$echo_string .= ", ";
if (get_sub_field('scholarship_is_author_member') == 'Yes') {
$echo_string .= '<a href="' . bp_core_get_user_domain(get_sub_field('scholarship_author_member')['ID']) . '">' . get_sub_field('scholarship_author') . '</a>';
} else {
$echo_string .= get_sub_field('scholarship_author');
}
}
}
echo $echo_string;
}
示例7: plankton_all_testimonails
function plankton_all_testimonails()
{
if (get_field('testimonials')) {
while (has_sub_field('testimonials')) {
echo '<section>';
$attachment_id = get_sub_field('logo');
$size = "thumbnail";
// (thumbnail, medium, large, full or custom size)
$image = wp_get_attachment_image_src($attachment_id, $size);
?>
<h3><?php
the_sub_field('client_name');
?>
</h3>
<?php
if (get_sub_field('logo') != '') {
?>
<img class="alignleft" src="<?php
echo $image[0];
?>
" />
<?php
} else {
?>
<img src="<?php
bloginfo('stylesheet_directory');
?>
/img/mini.png" class="alignleft" />
<?php
}
the_sub_field('the_testimonial');
?>
</section>
<?php
}
}
}
示例8: the_field
<div class="container">
<h3 class="text-uppercase text-center"><?php
the_field("client_success_title");
?>
</h3>
<!-- Example row of columns -->
<div class="row">
<div class="col-md-1 col-xs-1"></div>
<?php
if (get_field('client_success_strip')) {
?>
<?php
$i = 1;
while (has_sub_field('client_success_strip')) {
?>
<div class="col-md-2 lrpad10">
<div class="panel">
<img class="center-block" src="<?php
the_sub_field('icon');
?>
" />
<h1 class="text-center"><?php
the_sub_field('price');
?>
</h1>
<h2 class="text-center"><?php
the_sub_field('title');
?>
示例9: while
top: 0px; left: 0px;width: 100%;height:100%;">
</div>
</div>
<!-- Slides Container -->
<div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 720px; height: 480px;
overflow: hidden;">
<?php
while (have_posts()) {
the_post();
?>
<?php
if (get_field('brochures_images')) {
?>
<?php
while (has_sub_field('brochures_images')) {
?>
<?php
if (get_sub_field('images')) {
?>
<div>
<img u="image" src="<?php
echo the_sub_field('images');
?>
" />
<img u="thumb" src="<?php
echo the_sub_field('images');
?>
" />
</div>
<?php
示例10: esc_html
?>
<h2><?php
echo esc_html($title);
?>
</h2>
<?php
}
?>
<?php
if ($description) {
?>
<h4><?php
echo esc_html($description);
?>
</h4>
<?php
}
?>
<?php
if ($buttons) {
while (has_sub_field('buttons')) {
GRAV_BLOCKS::get_link_html('button', 'button');
}
}
?>
</div>
</div>
</div>
<?php
}
示例11: the_sub_field
">
<div class="inner container" style="<?php
if (get_sub_field('custom_css')) {
the_sub_field('custom_css');
?>
; <?php
}
?>
">
<?php
$total_columns = count(get_sub_field('columns', $id));
?>
<?php
while (has_sub_field('columns', $id)) {
?>
<?php
switch ($total_columns) {
case 2:
$class = 'five';
break;
case 3:
$class = 'one-third';
break;
case 4:
$class = 'one-fourth';
break;
case 5:
$class = 'one-fifth';
break;
示例12: get_header
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package kp
*/
get_header();
?>
<?php
$orderby = $_GET['orderby'];
$order = $_GET['order'];
if (!isset($orderby)) {
while (has_sub_field('date')) {
$orderby = get_sub_field('start_date');
}
}
if (!isset($order)) {
$order = "asc";
}
$args = array('post_type' => 'see');
$loop = new WP_Query($args);
if ($_GET['view'] == 'calendar') {
$isSelected = " btn-selected";
} else {
$thisSelected = " btn-selected";
}
?>
示例13: while
</div>
<div class="section" id="about" >
<!--container -->
<div class="container">
<nav class="side-navigation hide-mobile">
<ul>
<li><a title="Welcome" href="#main"><span>Welcome</span></a></li>
<li><a title="Services" href="#services"><span>Services</span></a></li>
<li><a title="Testimonials" href="#clients"><span>Testimonials</span></a></li>
<li><a title="Portfolio" href="#portfolio"><span>Portfolio</span></a></li>
<li><a class="active" title="About" href="#about"><span>About</span></a></li>
<li><a title="Contact" href="#contact"><span>Contact</span></a></li>
</ul>
</nav>
<?php
while (has_sub_field('about_block')) {
?>
<h2 class="animated" data-animation="bounceInDown" data-revert="bounceOutUp">About</h2>
<div class="clear"></div>
<span class="line animated" data-animation="bounceInLeft" data-revert="bounceOutRight"> </span>
<div class="sub-head animated" data-animation="flipInX" data-revert="flipOutX">
<?php
the_sub_field('about_subtitle');
?>
</div>
<?php
}
?>
<ul>
<?php
$args = array('post_type' => 'post', 'category_name' => 'blog', 'orderby' => 'post_date', 'posts_per_page' => '1');
示例14: psp_phases
function psp_phases($id, $style = null)
{
if ($style == 'psp-shortcode') {
$psp_phases = '<div class="psp-shortcode-phases">';
} else {
$psp_phases = '<div class="psp-row">';
}
$i = 0;
$c = 0;
while (has_sub_field('phases', $id)) {
$i++;
$c++;
if ($i % 2 == 1 && $style != 'psp-shortcode') {
$psp_phases .= '</div><div class="psp-row">';
}
if ($c == 1) {
$color = 'blue';
$chex = '#3299BB';
} elseif ($c == 2) {
$color = 'teal';
$chex = '#4ECDC4';
} elseif ($c == 3) {
$color = 'green';
$chex = '#CBE86B';
} elseif ($c == 4) {
$color = 'pink';
$chex = '#FF6B6B';
} elseif ($c == 5) {
$color = 'maroon';
$chex = '#C44D58';
$c = 0;
}
$psp_phases .= '<div class="psp-phase color-' . $color . '">';
$completed = 0;
$tasks = 0;
$task_completion = 0;
$completed_tasks = 0;
if (get_sub_field('auto_progress')) {
while (has_sub_field('tasks', $id)) {
$tasks++;
$task_completion += get_sub_field('status');
if (get_sub_field('status') == '100') {
$completed_tasks++;
}
}
if ($tasks > 1) {
$completed += ceil($task_completion / $tasks);
} elseif ($tasks == 1) {
$completed = 0;
} else {
$completed += $task_completion;
}
} else {
$completed = get_sub_field('percent_complete');
}
$remaining = 100 - $completed;
$psp_phases .= '<h3>' . get_sub_field('title') . '</h3>
<div class="psp-phase-overview cf">
<div class="psp-high-level">
<ul>
<li><span>' . $completed . '%</span> Complete</h4>
<li>';
if (get_sub_field('tasks', $id)) {
$psp_phases .= '<span>' . $completed_tasks . ' of ' . $tasks . '</span> tasks completed';
} else {
$psp_phases .= '<span>No Tasks</span>';
}
$psp_phases .= '</li>
</ul>
</div>
<div class="psp-chart">
<canvas id="chart-' . $i . '" class="chart-canvas" width="350" height="350"></canvas>
</div>
<div class="psp-phase-info">
' . get_sub_field('description') . '
</div>
</div>
<script type="text/javascript">
var data' . $i . ' = [
{
value: ' . $completed . ',
color: "' . $chex . '"
},
{
value : ' . $remaining . ',
color : "#CCCCCC"
}
]
var ctx = document.getElementById("chart-' . $i . '").getContext("2d");
new Chart(ctx).Doughnut(data' . $i . ');
//.........这里部分代码省略.........
示例15: while
</article>
<?php
}
?>
<!-- tipo de bloque: Carrusel -->
<?php
if (get_sub_field('tipo') == 'carrusel') {
?>
<article class="carrusel <?php
print $clasesBloque;
?>
">
<?php
while (has_sub_field('media')) {
?>
<figure class="media">
<h2 class="titulo"><?php
the_sub_field('titulo');
?>
</h2>
<div class="texto">
<?php
the_sub_field('texto');
?>
</div>
<img class="imagen" src="<?php
the_sub_field('imagen');
?>
" alt="<?php