本文整理汇总了PHP中get_template_part函数的典型用法代码示例。如果您正苦于以下问题:PHP get_template_part函数的具体用法?PHP get_template_part怎么用?PHP get_template_part使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_template_part函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bap_ajaxP_loop
function bap_ajaxP_loop($offset = '')
{
global $wp_query;
$paged = get_query_var('page') ? get_query_var('page') : 1;
$do_not_duplicate = array();
// OFFSET SETTING
if (!$offset == '' || !$offset == '0') {
$argshidepost = array('numberposts' => $offset, 'post_type' => 'post', 'post_status' => 'publish');
$hide_to_array = get_posts($argshidepost);
// HIDE OFFSETED POSTS
if ($hide_to_array) {
foreach ($hide_to_array as $post) {
$do_not_duplicate[] = $post->ID;
}
}
}
$argsmain = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'order' => 'DESC', 'post__not_in' => $do_not_duplicate);
$wp_query = new WP_Query($argsmain);
if ($wp_query->have_posts()) {
echo '<section id="' . bap_get_option_text('bap_loopContainer') . '">';
while ($wp_query->have_posts()) {
$wp_query->the_post();
get_template_part('partials/listitem');
}
echo '</section>';
}
wp_reset_postdata();
}
开发者ID:Aventyret,项目名称:bentoWP_plugin_AjaxPagin,代码行数:28,代码来源:bap_functions.php
示例2: cmb_initialize_cmb_meta_boxes
/**
* Initialize the metabox class.
*/
function cmb_initialize_cmb_meta_boxes()
{
if (!class_exists('cmb_Meta_Box')) {
get_template_part('framework/metabox/init');
get_template_part('framework/metabox/meta-custom');
}
}
开发者ID:devmoonshine,项目名称:development,代码行数:10,代码来源:meta-item.php
示例3: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$sticky = get_option('sticky_posts');
$number = empty($instance['number']) ? 1 : (int) $instance['number'];
$cat = empty($instance['category']) ? 0 : (int) $instance['category'];
if (is_single()) {
array_push($sticky, get_the_ID());
}
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
} else {
echo '<br />';
}
$featuredPosts = new WP_Query(array('posts_per_page' => $number, 'cat' => $cat, 'post__not_in' => $sticky, 'no_found_rows' => true));
while ($featuredPosts->have_posts()) {
$featuredPosts->the_post();
global $mb_content_area, $more;
$mb_content_area = 'sidebar';
get_template_part('content', get_post_format());
}
wp_reset_postdata();
echo $after_widget;
}
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:26,代码来源:widget_feature.php
示例4: doublecheeseburger_infinite_scroll_render
/**
* Custom render function for Infinite Scroll.
*/
function doublecheeseburger_infinite_scroll_render()
{
while (have_posts()) {
the_post();
get_template_part('template-parts/content', get_post_format());
}
}
开发者ID:ptums,项目名称:DoubleBaconCheeseBurger,代码行数:10,代码来源:jetpack.php
示例5: us_web_standards_infinite_scroll_render
/**
* Custom render function for Infinite Scroll.
*/
function us_web_standards_infinite_scroll_render()
{
while (have_posts()) {
the_post();
get_template_part('template-parts/content', get_post_format());
}
}
开发者ID:saracope,项目名称:us-web-standards-wordpress-theme,代码行数:10,代码来源:jetpack.php
示例6: component_s_infinite_scroll_render
/**
* Custom render function for Infinite Scroll.
*/
function component_s_infinite_scroll_render()
{
while (have_posts()) {
the_post();
get_template_part('components/content', get_post_format());
}
}
开发者ID:sixhours,项目名称:theme-pattern-library,代码行数:10,代码来源:jetpack.php
示例7: theme_posts_shortcode
/**
* Shortcode functionality to show posts.
*
* @since 1.0.0
*/
function theme_posts_shortcode($atts)
{
$output = false;
// Pull in shortcode attributes and set defaults
$defaults = array('category' => '', 'order' => 'DESC', 'orderby' => 'date', 'posts_per_page' => '10', 'tag' => '');
// Process shortcode attribtues
$atts = shortcode_atts($defaults, $atts, 'show-posts');
// Set up initial query for post
$args = array('category_name' => $atts['category'], 'order' => $atts['order'], 'orderby' => $atts['orderby'], 'posts_per_page' => $atts['posts_per_page'], 'tag' => $atts['tag'], 'ignore_sticky_posts' => 1, 'no_found_rows' => true);
$query = new WP_Query($args);
if ($query->have_posts()) {
global $wp_query;
// Backup the main query.
$saved_query = $wp_query;
// Replace the main query by reference.
$wp_query = $query;
// Capture the output so we can return it to the shortcode process.
ob_start();
echo '<div class="show-posts-wrapper">';
while ($wp_query->have_posts()) {
$wp_query->the_post();
get_template_part('content', get_post_format());
}
echo '</div>';
$output = ob_get_clean();
// Clean up after ourselves.
$wp_query = $saved_query;
wp_reset_postdata();
}
return $output;
}
开发者ID:joemcgill,项目名称:Theme-Posts-Shortcode,代码行数:36,代码来源:theme-posts-shortcode.php
示例8: my_theme_wrapper_end
function my_theme_wrapper_end()
{
echo '</div></div></section>';
echo '<div class="shop_bottom">';
get_template_part('bottom-content');
echo '</div>';
}
开发者ID:sistercylon,项目名称:loverboy-wp-local,代码行数:7,代码来源:functions.php
示例9: portarlington_cce_infinite_scroll_render
/**
* Custom render function for Infinite Scroll.
*/
function portarlington_cce_infinite_scroll_render()
{
while (have_posts()) {
the_post();
get_template_part('template-parts/content', get_post_format());
}
}
开发者ID:robbiegleeson,项目名称:portarlington-cce,代码行数:10,代码来源:jetpack.php
示例10: gabfire_theme_scripts
function gabfire_theme_scripts()
{
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/framework/bootstrap/css/bootstrap.min.css');
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/framework/font-awesome/css/font-awesome.min.css');
wp_enqueue_style('bootstrap-social', get_template_directory_uri() . '/css/bootstrap-social.css');
wp_enqueue_style('colorbox-css', get_template_directory_uri() . '/css/colorbox.css');
wp_enqueue_style('animate-css', get_template_directory_uri() . '/css/animate.css');
//wp_enqueue_style('owl-carousel', get_template_directory_uri() .'/css/owl.carousel.css');
//wp_enqueue_style('flat-ui', get_stylesheet_directory_uri() .'/css/flat-ui.css'); // adding FLAT UI to main header query
wp_enqueue_style('datatables-css', '//cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css');
wp_enqueue_style('theme-style', get_stylesheet_uri(), false);
// NEW: Add Ion Icons
wp_enqueue_style('ion-icons', get_template_directory_uri() . '/framework/ion-icons/css/ionicons.min.css');
get_template_part('css/customizedcss', '');
wp_enqueue_script('jquery');
wp_enqueue_script('bootstrap', get_template_directory_uri() . '/framework/bootstrap/js/bootstrap.min.js');
wp_enqueue_script('modernizr', get_template_directory_uri() . '/inc/js/modernizr.custom.js');
wp_enqueue_script('responsive-nav', get_template_directory_uri() . '/inc/js/responsive-menu.js');
//wp_enqueue_script('wow', get_template_directory_uri() .'/inc/js/wow.min.js');
//wp_enqueue_script('shuffle', get_template_directory_uri() .'/inc/js/jquery.shuffle.min.js');
wp_enqueue_script('jquery-colorbox', get_template_directory_uri() . '/inc/js/jquery.colorbox-min.js');
//wp_enqueue_script('owl-carousel', get_template_directory_uri() .'/inc/js/owl.carousel.min.js');
//wp_enqueue_script('stellar', get_template_directory_uri() .'/inc/js/stellar.js');
//wp_enqueue_script('froogaloop', '//f.vimeocdn.com/js/froogaloop2.min.js');
//wp_enqueue_script('youtube-api', '//www.youtube.com/player_api');
wp_enqueue_script('datatables-js', '//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js');
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
if (file_exists(get_stylesheet_directory() . '/custom.css')) {
wp_enqueue_style('custom-style', get_stylesheet_directory_uri() . '/custom.css');
} elseif (file_exists(get_template_directory_uri() . '/custom.css')) {
wp_enqueue_style('custom-style', get_template_directory_uri() . '/custom.css');
}
}
开发者ID:wpmonty,项目名称:99-demos,代码行数:35,代码来源:functions.php
示例11: crum_search_form
function crum_search_form($form)
{
ob_start();
get_template_part('templates/searchform');
$form = ob_get_clean();
return $form;
}
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:7,代码来源:components.php
示例12: sfhiv_preview_shortcode
function sfhiv_preview_shortcode($atts, $content = null)
{
global $post;
extract(shortcode_atts(array('id' => false, 'title' => false, 'replace_title' => false, 'replace_content' => false, 'template' => 'preview'), $atts));
$preview_post = false;
$return_content = "";
if (isset($title)) {
$preview_post = get_page_by_title($title);
}
if (isset($id) && !$preview_post) {
$num = (int) $id;
$preview_post = get_post($num);
}
if ($preview_post) {
$org_post = $post;
$post = $preview_post;
if ($replace_title) {
$post->post_title = $replace_title;
}
if ($content != null) {
$post->post_content = $content;
$post->post_excerpt = $content;
}
if ($replace_content) {
$post->post_content = $replace_content;
$post->post_excerpt = $replace_content;
}
ob_start();
get_template_part($template, $post->post_type);
$return_content = ob_get_clean();
$post = $org_post;
}
return $return_content;
}
开发者ID:nickdotreid,项目名称:SFHIV-Wordpress-Theme,代码行数:34,代码来源:preview-shortcode.php
示例13: checkout_render_infinite_posts
function checkout_render_infinite_posts()
{
while (have_posts()) {
the_post();
get_template_part('partials/content-standard');
}
}
开发者ID:qhuit,项目名称:UrbanPekor,代码行数:7,代码来源:jetpack.php
示例14: x_get_view
function x_get_view($stack, $base, $extension = '')
{
$file = $stack . '_' . $base . (empty($extension) ? '' : '-' . $extension);
do_action('x_before_view_' . $file);
get_template_part('framework/views/' . $stack . '/' . $base, $extension);
do_action('x_after_view_' . $file);
}
开发者ID:datracka,项目名称:datalook.io,代码行数:7,代码来源:helper.php
示例15: ebor_testimonial_shortcode
/**
* The Shortcode
*/
function ebor_testimonial_shortcode($atts)
{
extract(shortcode_atts(array('pppage' => '999', 'filter' => 'all', 'type' => 'carousel-3col'), $atts));
/**
* Initial query args
*/
$query_args = array('post_type' => 'testimonial', 'posts_per_page' => $pppage);
if (!($filter == 'all')) {
if (function_exists('icl_object_id')) {
$filter = (int) icl_object_id($filter, 'testimonial_category', true);
}
$query_args['tax_query'] = array(array('taxonomy' => 'testimonial_category', 'field' => 'id', 'terms' => $filter));
}
/**
* Finally, here's the query.
*/
global $wp_query;
$wp_query = new WP_Query($query_args);
ob_start();
get_template_part('loop/loop-testimonial', $type);
wp_reset_postdata();
$output = ob_get_contents();
ob_end_clean();
return $output;
}
开发者ID:tommusrhodus,项目名称:Ebor-Framework,代码行数:28,代码来源:vc_testimonial_block.php
示例16: zp_custom_blog_page
function zp_custom_blog_page()
{
global $post, $paged;
$include = genesis_get_option('blog_cat');
$exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
if (get_query_var('paged')) {
$paged = get_query_var('paged');
} elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
//* Arguments
$args = array('cat' => $include, 'category__not_in' => $exclude, 'posts_per_page' => genesis_get_option('blog_cat_num'), 'paged' => $paged);
query_posts($args);
if (have_posts()) {
while (have_posts()) {
the_post();
do_action('genesis_before_entry');
printf('<article %s>', genesis_attr('entry'));
// check post format and call template
$format = get_post_format();
get_template_part('content', $format);
do_action('genesis_after_entry_content');
//do_action( 'genesis_entry_footer' );
echo '</article>';
do_action('genesis_after_entry');
}
}
//* Genesis navigation
genesis_posts_nav();
//* Restore original query
wp_reset_query();
}
开发者ID:lukasalbrecht,项目名称:www.genesis-playground.dev,代码行数:34,代码来源:home.php
示例17: ultra_panels_missing_widgets_carousel
/**
* Render the carousel widget
*/
function ultra_panels_missing_widgets_carousel($instance, $args)
{
$js_suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_style('ultra-demo-carousel-basic', get_template_directory_uri() . '/demo/carousel/css/style.css', array(), SITEORIGIN_THEME_VERSION);
wp_enqueue_script('ultra-demo-carousel-basic', get_template_directory_uri() . '/demo/carousel/js/carousel' . $js_suffix . '.js', array('jquery'), SITEORIGIN_THEME_VERSION);
get_template_part('demo/carousel/carousel');
}
开发者ID:conao,项目名称:huso-theme,代码行数:10,代码来源:panels-missing-widgets.php
示例18: ae_get_template_part
function ae_get_template_part($slug, $name)
{
if ($slug) {
$slug = '/includes/aecore/template/' . $slug;
}
get_template_part($slug, $name);
}
开发者ID:rinodung,项目名称:wp-question,代码行数:7,代码来源:functions.php
示例19: load_more_posts_callback
function load_more_posts_callback()
{
check_ajax_referer('pan_travel_blog', 'token');
try {
$offset = $_POST['offset'];
$number = $_POST['number'];
$loop = new WP_Query(array('post_type' => 'travel_blogs', 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'meta_value', 'meta_key' => 'travel_blog_start_date', 'offset' => $offset, 'posts_per_page' => $number));
if ($loop->have_posts()) {
while ($loop->have_posts()) {
$loop->the_post();
?>
<?php
get_template_part('parts/content', 'travelblog');
?>
<?php
}
} else {
?>
<p><?php
_e('Sorry, no posts matched your criteria.');
?>
</p>
<?php
}
wp_reset_postdata();
} catch (Exception $e) {
echo 'Errors';
}
wp_die();
}
开发者ID:spiderPan,项目名称:PanBlog,代码行数:30,代码来源:custom-ajax-handler.php
示例20: header_add_tmpl_3widgets
function header_add_tmpl_3widgets()
{
if (get_theme_mod('header_type') != '3p') {
return;
}
get_template_part('inc/template-parts/header', '3widgets');
}
开发者ID:systemo-biz,项目名称:wpbss-u3,代码行数:7,代码来源:header3bar.php
注:本文中的get_template_part函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论