• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP the_field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中the_field函数的典型用法代码示例。如果您正苦于以下问题:PHP the_field函数的具体用法?PHP the_field怎么用?PHP the_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了the_field函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
        }
    }
开发者ID:Johnystardust,项目名称:ecs-247-bereikbaar,代码行数:25,代码来源:newpatient.php


示例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;
}
开发者ID:jedlovescpe2,项目名称:genesis-child-jed,代码行数:29,代码来源:most-viewed.php


示例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());
    }
}
开发者ID:jrock89,项目名称:FirstTheme,代码行数:28,代码来源:functions.php


示例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 
}
开发者ID:sebastiaandekker,项目名称:sd,代码行数:28,代码来源:gek-template.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;
}
开发者ID:jayontraps,项目名称:boc,代码行数:35,代码来源:ajax-functions.php


示例6: page_excerpt

function page_excerpt()
{
    if (class_exists('acf')) {
        if (get_field('page_excerpt')) {
            the_field('page_excerpt');
        }
    }
}
开发者ID:jchck,项目名称:jchck_,代码行数:8,代码来源:excerpt.php


示例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>';
    }
}
开发者ID:jchck,项目名称:jchck_,代码行数:15,代码来源:video.php


示例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 
    }
开发者ID:ahmedmusawir,项目名称:janes-ent,代码行数:57,代码来源:my-custom-widget.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'];
        }
开发者ID:MortenAndersen,项目名称:wpbase,代码行数:63,代码来源:acf-social.php


示例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 
    }
}
开发者ID:ashleycam3ron,项目名称:komatsu,代码行数:56,代码来源:custom_post_shortcodes.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
    }
}
开发者ID:petemurray74,项目名称:HarveysFoundationPressv5,代码行数:10,代码来源:harveys-custom-functions.php


示例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 '&nbsp';
                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>';
        }
    }
}
开发者ID:KEGroup,项目名称:budtoboss,代码行数:55,代码来源:locations.php


示例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>";
    }
}
开发者ID:amiel,项目名称:bellinghamcircusguild,代码行数:11,代码来源:helpers.php


示例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 
}
开发者ID:planktonWD,项目名称:Parkside-Quarry,代码行数:52,代码来源:event-excerpt.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');
    }
}
开发者ID:jdozierezell,项目名称:afsp,代码行数:13,代码来源:admin-functions.php


示例16: custom_fonts

function custom_fonts()
{
    $default_font_kit = '<link href="http://fonts.googleapis.com/css?family=Lato:400,700,900,400italic" rel="stylesheet" type="text/css">
		<link href="http://fonts.googleapis.com/css?family=Playfair+Display:400,400italic" rel="stylesheet" type="text/css">';
    if (is_single()) {
        if (get_field('custom_fonts')) {
            echo the_field('custom_fonts');
        } else {
            echo $default_font_kit;
        }
    } else {
        echo $default_font_kit;
    }
}
开发者ID:vincebrown,项目名称:schemin-and-themin,代码行数:14,代码来源:custom_fonts.php


示例17: address_custom_columns

function address_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "nome":
            the_field('nome', $post->ID);
            break;
        case "descricao":
            the_field('descricao', $post->ID);
            break;
        case "preco":
            the_field('preco', $post->ID);
            break;
    }
}
开发者ID:anderfilth,项目名称:EstoqueWP,代码行数:15,代码来源:produto_cpt.php


示例18: cliente_custom_columns

function cliente_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "nome":
            the_field('nome', $post->ID);
            break;
        case "email":
            the_field('email', $post->ID);
            break;
        case "telefone":
            the_field('telefone', $post->ID);
            break;
    }
}
开发者ID:anderfilth,项目名称:EstoqueWP,代码行数:15,代码来源:cliente_cpt.php


示例19: supporter_slide

    function supporter_slide()
    {
        $args = array('post_type' => 'supporter', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'date');
        $the_query = new WP_Query($args);
        ?>
	<?php 
        if ($the_query->have_posts()) {
            ?>
	<section id="jawsdays-supporter" class="footer-section jawsdays-supporter">
		<ul class="bxslider jawsdays-supporter-slider">
		<?php 
            while ($the_query->have_posts()) {
                $the_query->the_post();
                ?>
			<li><a href="<?php 
                the_field('_supporter_url');
                ?>
" target="_blank">
				<?php 
                if (has_post_thumbnail()) {
                    ?>
					<?php 
                    the_post_thumbnail('slide-thumb');
                    ?>
				<?php 
                } else {
                    ?>
					<img src="<?php 
                    echo get_template_directory_uri();
                    ?>
/images/no-image.png" alt="no-image" width="148" height="148" />
				<?php 
                }
                ?>
			</a></li>
		<?php 
            }
            ?>
		</ul>
	</section>
	<?php 
        }
        ?>
	<?php 
        wp_reset_postdata();
    }
开发者ID:jaws-ug,项目名称:jawsdays2016,代码行数:46,代码来源:slide.php


示例20: an_do_portfolio

function an_do_portfolio()
{
    $args = array('post_type' => 'portfolio');
    $portfolioItems = new WP_Query($args);
    ?>
   <section class="section-portfolio" id="portfolio">
	   <h2 class="section-headline">Portfolio</h2>
	   <div class="portfolio-items">
   <?php 
    if ($portfolioItems->have_posts()) {
        while ($portfolioItems->have_posts()) {
            $portfolioItems->the_post();
            ?>
	    <a class="portfolio-item" href="<?php 
            the_permalink();
            ?>
" style="">
			<div class="image" style="background-image:url(<?php 
            the_field('teaser_image');
            ?>
);"></div>
			<div class="overlay">
			   <h5><?php 
            the_title();
            ?>
</h5>
			   <p><?php 
            the_field('teaser_description');
            ?>
</p>
			</div>
	    </a>
	   <?php 
        }
    } else {
        echo 'No portfolio items found :(';
    }
    ?>
		</div>
	</section>
	<?php 
}
开发者ID:beardage,项目名称:genesis-allnighter,代码行数:42,代码来源:front-page.php



注:本文中的the_field函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP the_generator函数代码示例发布时间:2022-05-23
下一篇:
PHP the_excerpt_rss函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap