本文整理汇总了PHP中the_field函数的典型用法代码示例。如果您正苦于以下问题:PHP the_field函数的具体用法?PHP the_field怎么用?PHP the_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ecs_newpatient_module_content_filter
function ecs_newpatient_module_content_filter($content)
{
$page = get_field('option_newpatient_page', 'option');
if (is_page($page->ID)) {
ob_start();
if (get_field('option_vacation_notice', 'option')) {
?>
<div class="info">
<?php
the_field('option_vacation_notice_text', 'option');
?>
</div>
<?php
}
gravity_form_enqueue_scripts(3, true);
gravity_form(3, false, false, false, '', true, 1);
return ob_get_clean();
} else {
return $content;
}
}
示例2: most_viewed
function most_viewed()
{
ob_start();
$posts = wmp_get_popular(array('limit' => 4, 'post_type' => 'paper', 'range' => 'all_time'));
global $post;
if (count($posts) > 0) {
foreach ($posts as $post) {
setup_postdata($post);
?>
<li><a href="<?php
the_permalink();
?>
">
<?php
if (get_field('short_title')) {
the_field('short_title');
} else {
the_title();
}
?>
</a></li>
<?php
}
}
wp_reset_query();
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
示例3: featureText
function featureText()
{
if (is_front_page()) {
the_field('feature_text');
} elseif (is_home() || is_single()) {
_e('Rock Theme Official Blog');
} elseif (is_archive()) {
_e('Rock Theme Official Blog');
_e('<br>');
single_term_title('Browsing: ');
if (is_month()) {
$monthNum = get_query_var('monthnum');
$month = date('F', mktime(0, 0, 0, $monthNum));
$year = get_query_var('year');
echo 'Posts from ' . $month . ' ' . $year;
}
} elseif (is_page_template('page-news.php') || is_page_template('page-about.php') || is_page_template('page-contact.php')) {
bloginfo('name');
_e('<br>');
the_title();
} elseif (is_404()) {
_e('Whoops, were a little lost.');
} elseif (is_search()) {
_e('Rock Theme Official Blog');
_e('<br>');
printf('Search results for: %s', get_search_query());
}
}
示例4: sd_gek
function sd_gek()
{
?>
<!-- Reviews header section -->
<div id="reviews__intro">
<section id="reviews__intro__section">
<!-- reviews header subtitle -->
<h2 class="page__subtitle"><?php
the_field('gek');
?>
</h2>
<!-- reviews header title -->
<div class="reviews__intro__section__mascotte">
</div>
</section>
</div>
<?php
}
示例5: get_wp_species_sum
function get_wp_species_sum()
{
$id = $_POST['res'];
$args = array('post_type' => 'species', 'name' => $id);
$loop = new WP_Query($args);
while ($loop->have_posts()) {
$loop->the_post();
?>
<?php
if (get_field('summary') != "") {
?>
<div class="species_summary">
<?php
the_field('summary');
?>
</div>
<?php
}
?>
<?php
}
wp_reset_query();
// Restore global post data stomped by the_post().
die;
}
示例6: page_excerpt
function page_excerpt()
{
if (class_exists('acf')) {
if (get_field('page_excerpt')) {
the_field('page_excerpt');
}
}
}
示例7: video
/**
*
* Responsive iFrame's
* Credit to Bootstrap
* @link http://getbootstrap.com/components/#responsive-embed
*
*/
function video()
{
if (get_field('video')) {
echo '<div class="r-iframe pt0 px0 relative block overflow-hidden">';
the_field('video');
echo '</div>';
}
}
示例8: widget
function widget($args, $instance)
{
$widget_id = "widget_" . $args["widget_id"];
// echo $widget_id;
/**
*
* Widget Variables
*
*/
?>
<section class="widget">
<?php
//the_field("example_field", $widget_id );
?>
<?php
//the_field("widget_button_text", $widget_id );
?>
<div class="exampleWidget">
<h2 class="widget-title"></h2>
<h3><?php
the_field('widget_title', $widget_id);
?>
</h3>
<h4><em>Location: <?php
the_field('widget_location', $widget_id);
?>
</em></h4>
<img class="img-responsive img-circle" src="<?php
the_field('widget_image', $widget_id);
?>
" alt="">
<p>
<?php
the_field('widget_text', $widget_id);
?>
</p>
<p class="text-center">
<a class="btn btn-success" href="<?php
the_field('widget_button_url', $widget_id);
?>
" title=""><?php
the_field("widget_button_text", $widget_id);
?>
</a>
</p>
</div>
</section>
<?php
}
示例9: widget
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget($args, $instance)
{
// outputs the content of the widget
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
?>
<ul class="acf__social">
<?php
if (get_field('facebook_url', 'option')) {
?>
<li><a class="facebook__link" href="<?php
the_field('facebook_url', 'options');
?>
" target="_blank">Facebook</a></li>
<?php
}
if (get_field('twitter_url', 'option')) {
?>
<li><a class="twitter__link" href="<?php
the_field('twitter_url', 'options');
?>
" target="_blank">Twitter</a></li>
<?php
}
if (get_field('instagram_url', 'option')) {
?>
<li><a class="instagram__link" href="<?php
the_field('instagram_url', 'options');
?>
" target="_blank">Instagram</a></li>
<?php
}
if (get_field('google_plus_url', 'option')) {
?>
<li><a class="google-plus__link" href="<?php
the_field('google_plus_url', 'options');
?>
" target="_blank">Google +</a></li>
<?php
}
if (get_field('linkedin_url', 'option')) {
?>
<li><a class="linkedin__link" href="<?php
the_field('linkedin_url', 'options');
?>
" target="_blank">Linkedin</a></li>
<?php
}
?>
</ul>
<?php
echo $args['after_widget'];
}
示例10: komatsu_menu_template
function komatsu_menu_template($type = '')
{
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$args = array('post_type' => 'menu', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order', 'tax_query' => array(array('taxonomy' => 'courses', 'field' => 'slug', 'terms' => $type)));
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
?>
<div class="row">
<ul class="menu">
<?php
while ($the_query->have_posts()) {
$the_query->the_post();
?>
<li id="post-<?php
the_ID();
?>
" class="col-xs-10 col-xs-offset-1 col-sm-4 col-sm-offset-0 col-md-3">
<?php
if (has_post_thumbnail()) {
?>
<?php
the_post_thumbnail('thumbnail', array('class' => 'img-responsive col-sm-12 hidden-xs'));
?>
<?php
} else {
?>
<img class="img-responsive col-sm-12 hidden-xs" src="http://placehold.it/200x200/eeeeee/888888">
<?php
}
?>
<div class="col-sm-12">
<h4><?php
the_title();
?>
</h4>
<span><?php
echo implode(', ', get_field('ingredients'));
?>
</span>
<p class="price"><?php
the_field('price');
?>
</p>
</div>
<div class="clearfix"></div>
</li>
<?php
}
wp_reset_postdata();
?>
</ul>
</div>
<?php
}
}
示例11: harv_sale_head
function harv_sale_head()
{
if (get_field('top_banner') == 'custom') {
the_field('dept_header_message');
} elseif (get_field('top_banner') == 'generic') {
// add code here to show the banner only if banner post is published
} elseif (get_field('top_banner') == 'no') {
// nothing
}
}
示例12: location_custom_loop
function location_custom_loop()
{
global $paged;
// The Query
query_posts('post_type=locations&order=ASC');
echo '<h3 style="margin-bottom:50px;">Click a city to see venue information</h3>';
if (have_posts()) {
while (have_posts()) {
the_post();
echo '<div id="maintextmrg">';
echo '<table border="0" width="500" cellspacing="0" cellpadding="0"><tbody>';
echo '<tr valign="top"><td width="350">';
echo '<div style="margin-bottom: 10px; font-weight: bold;"><a style="color: #000; text-decoration: underline;" href="javascript:InsertContent(';
echo "'";
the_field('identifier');
echo "');";
echo '">';
the_field('location');
echo '</a></div></td>';
echo '<td style="font-weight: bold;" width="250">';
the_field('dates');
echo '</td></tr>';
echo '<tr><td colspan="2">';
echo '<div id="';
the_field('identifier');
echo '" style="display:none; margin-left:30px;">';
if (get_field('venue_set')) {
echo '<a href="';
the_field('venue_link');
echo '" target="_blank">';
the_field('venue_name');
echo '</a><br>';
the_field('venue_street_address');
echo '<br>';
the_field('venue_city_state');
echo ' ';
the_field('venue_zip_code');
echo '<br>';
echo '<strong>Reservations: </strong>';
the_field('venue_phone_number');
} else {
echo '<span style="font-weight: bold;">';
echo 'Venue information coming soon.';
echo '</span>';
}
echo '<br><br>';
echo '<a href="';
the_field('ifs_link');
echo '" target="_blank"><img src="http://www.budtoboss.com/wp-content/uploads/2013/03/rsz_register-button-red.png" alt="Register for a Bud to Boss Workshop Now!" style="margin-bottom:15px;"></a>';
echo '</div>';
echo '</td></tr></tbody></table>';
echo '</div>';
}
}
}
示例13: link_to_the_field
function link_to_the_field($field, $url_field)
{
$url = get_field($url_field);
if ($url) {
echo "<a href=\"{$url}\">";
}
the_field($field);
if ($url) {
echo "</a>";
}
}
示例14: plankton_event_excerpt
function plankton_event_excerpt()
{
global $post;
global $image;
global $the_link;
$postid = get_the_ID();
$buy_now = get_field('buy_tickets_url', $postid);
?>
<h3 class="title--keyline"><a href="<?php
echo $the_link;
?>
"><?php
the_title();
?>
</a></h3>
<p class="excerpt"><?php
the_field('tagline', $postid);
?>
<br />
<?php
// grab the date amd time
if (get_field('end_date', $postid)) {
$end_date = DateTime::createFromFormat('Ymd', get_field('end_date', $postid));
$date = DateTime::createFromFormat('Ymd', get_field('date', $postid));
echo $date->format('j M') . ' - ' . $end_date->format('j M') . ', ' . get_field('time', $postid) . ', ' . get_field('price', $postid);
} else {
if (get_field('date', $postid)) {
$date = DateTime::createFromFormat('Ymd', get_field('date', $postid));
echo $date->format('D j M') . ', ' . get_field('time', $postid) . ', ' . get_field('price', $postid);
}
}
?>
</p>
<!--<a href="<?php
echo $the_link;
?>
" class="button--free-left ml mb-">Read More v</a>-->
<a class="button button--free" href="<?php
echo $the_link;
?>
">Read More</a>
</section></li>
<?php
}
示例15: support_group_columns_body
function support_group_columns_body($column)
{
global $post;
if ($column == 'city') {
echo the_field('city');
} elseif ($column == 'state') {
echo the_field('state');
} elseif ($column == 'province') {
echo the_field('province');
} elseif ($column == 'country') {
echo the_field('country');
}
}