本文整理汇总了PHP中presscore_get_template_part函数的典型用法代码示例。如果您正苦于以下问题:PHP presscore_get_template_part函数的具体用法?PHP presscore_get_template_part怎么用?PHP presscore_get_template_part使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了presscore_get_template_part函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: presscore_blog_ajax_loading_responce
function presscore_blog_ajax_loading_responce($ajax_data = array())
{
global $post, $wp_query, $paged, $page;
extract($ajax_data);
if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
$responce = array('success' => false, 'reason' => 'corrupted data');
} else {
require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
require_once PRESSCORE_DIR . '/template-hooks.php';
require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
// get page
query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
$html = '';
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = Presscore_Config::get_instance();
$config->set('template', 'blog');
$config->set('layout', empty($page_data['layout']) ? 'masonry' : $page_data['layout']);
presscore_config_base_init();
presscore_react_on_categorizer();
do_action('presscore_before_loop');
ob_start();
$query = presscore_get_blog_query();
if ($query->have_posts()) {
$page_layout = presscore_get_current_layout_type();
$current_post = $posts_count;
while ($query->have_posts()) {
$query->the_post();
/*
// check if current post already loaded
$key_in_loaded = array_search( $post->ID, $loaded_items );
if ( false !== $key_in_loaded ) {
unset( $loaded_items[ $key_in_loaded ] );
continue;
}
*/
presscore_populate_post_config();
switch ($page_layout) {
case 'masonry':
presscore_get_template_part('theme', 'blog/masonry/blog-masonry-post');
break;
case 'list':
// global posts counter
$config->set('post.query.var.current_post', ++$current_post);
presscore_get_template_part('theme', 'blog/list/blog-list-post');
break;
}
}
wp_reset_postdata();
}
$html .= ob_get_clean();
}
$responce = array('success' => true);
///////////////////
// pagination //
///////////////////
$next_page_link = dt_get_next_posts_url($query->max_num_pages);
if ($next_page_link) {
$responce['nextPage'] = dt_get_paged_var() + 1;
} else {
$responce['nextPage'] = 0;
}
$load_style = $config->get('load_style');
// pagination style
if (presscore_is_load_more_pagination()) {
$pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
if ($pagination) {
$responce['currentPage'] = dt_get_paged_var();
$responce['paginationHtml'] = $pagination;
} else {
$responce['currentPage'] = $post_paged;
}
$responce['paginationType'] = 'more';
} else {
if ('ajax_pagination' == $load_style) {
ob_start();
dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
$pagination = ob_get_clean();
if ($pagination) {
$responce['paginationHtml'] = $pagination;
}
$responce['paginationType'] = 'paginator';
}
}
/////////////////
// response //
/////////////////
$responce['itemsToDelete'] = array_values($loaded_items);
// $responce['query'] = $page_query->query;
$responce['order'] = $query->query['order'];
$responce['orderby'] = $query->query['orderby'];
}
// main loop
$responce['html'] = $html;
}
return $responce;
}
示例2: shortcode_html
protected function shortcode_html()
{
$dt_query = $this->get_albums_attachments(array('orderby' => $this->atts['orderby'], 'order' => $this->atts['order'], 'number' => $this->atts['number'], 'select' => $this->atts['select'], 'category' => $this->atts['category']));
$output = '';
if ($dt_query->have_posts()) {
$this->backup_post_object();
$this->backup_theme_config();
$this->setup_config();
ob_start();
do_action('presscore_before_shortcode_loop', $this->shortcode_name, $this->atts);
// masonry container open
echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-gallery-container', 'dt-photos-shortcode')) . presscore_masonry_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
while ($dt_query->have_posts()) {
$dt_query->the_post();
presscore_get_template_part('mod_albums', 'photo-masonry/photo');
}
// masonry container close
echo '</div>';
do_action('presscore_after_shortcode_loop', $this->shortcode_name, $this->atts);
$output = ob_get_contents();
ob_end_clean();
$this->restore_theme_config();
$this->restore_post_object();
}
return $output;
}
示例3: custom_loop
protected function custom_loop()
{
do_action('presscore_before_loop');
$page_query = presscore_get_filtered_posts(array('post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category'));
if ($page_query->have_posts()) {
$page_layout = presscore_get_current_layout_type();
$current_post = $this->input['posts_count'];
while ($page_query->have_posts()) {
$page_query->the_post();
// populate post config
presscore_populate_portfolio_config();
// post template
switch ($page_layout) {
case 'masonry':
presscore_get_template_part('mod_portfolio', 'masonry/project');
break;
case 'list':
// global posts counter
$this->config->set('post.query.var.current_post', ++$current_post);
presscore_get_template_part('mod_portfolio', 'list/project');
break;
}
}
wp_reset_postdata();
}
return $page_query;
}
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:27,代码来源:class-mod-portfolio-ajax-content-builder.php
示例4: archive_post_content
public function archive_post_content($html)
{
if (!$html) {
ob_start();
presscore_populate_team_config();
presscore_get_template_part('mod_team', 'team-post');
$html = ob_get_contents();
ob_end_clean();
}
return $html;
}
示例5: archive_post_content
public function archive_post_content($html)
{
if (!$html) {
ob_start();
presscore_populate_portfolio_config();
presscore_get_template_part('mod_portfolio', 'masonry/project');
$html = ob_get_contents();
ob_end_clean();
}
return $html;
}
示例6: custom_loop
protected function custom_loop()
{
do_action('presscore_before_loop');
$page_query = presscore_mod_albums_get_photos();
if ($page_query->have_posts()) {
while ($page_query->have_posts()) {
$page_query->the_post();
presscore_get_template_part('mod_albums', 'photo-masonry/photo');
}
wp_reset_postdata();
}
return $page_query;
}
示例7: archive_post_content
public function archive_post_content($html)
{
if (!$html) {
ob_start();
add_filter('presscore_get_images_gallery_hoovered-title_img_args', 'presscore_gallery_post_exclude_featured_image_from_gallery', 15, 3);
presscore_populate_album_post_config();
presscore_get_template_part('mod_albums', 'album-masonry/album');
remove_filter('presscore_get_images_gallery_hoovered-title_img_args', 'presscore_gallery_post_exclude_featured_image_from_gallery', 15, 3);
$html = ob_get_contents();
ob_end_clean();
}
return $html;
}
示例8: presscore_archive_post_content
function presscore_archive_post_content()
{
$post_type = get_post_type();
$html = apply_filters("presscore_archive_post_content-{$post_type}", '');
if ($html) {
echo $html;
} else {
if ('post' == $post_type) {
presscore_config()->set('show_details', false);
presscore_populate_post_config();
presscore_get_template_part('theme', 'blog/masonry/blog-masonry-post');
} else {
presscore_get_template_part('theme', 'content-archive');
}
}
}
示例9: custom_loop
protected function custom_loop()
{
do_action('presscore_before_loop');
$page_query = presscore_get_filtered_posts(array('post_type' => 'dt_gallery', 'taxonomy' => 'dt_gallery_category'));
if ($page_query->have_posts()) {
add_filter('presscore_get_images_gallery_hoovered-title_img_args', 'presscore_gallery_post_exclude_featured_image_from_gallery', 15, 3);
while ($page_query->have_posts()) {
$page_query->the_post();
// populate post config
presscore_populate_album_post_config();
presscore_get_template_part('mod_albums', 'album-masonry/album');
}
wp_reset_postdata();
remove_filter('presscore_get_images_gallery_hoovered-title_img_args', 'presscore_gallery_post_exclude_featured_image_from_gallery', 15, 3);
}
return $page_query;
}
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:17,代码来源:class-mod-albums-ajax-content-builder.php
示例10: shortcode
public function shortcode($atts, $content = null)
{
$attributes = $this->sanitize_attributes($atts);
if (presscore_vc_is_inline()) {
$terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_team_category'));
$dummy = '
<div class="dt_vc-shortcode_dummy dt_vc-team" style="height: 250px;">
<h5>Team</h5>
<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
</div>
';
return $dummy;
}
$output = '';
$dt_query = $this->get_posts_by_terms($attributes);
if ($dt_query->have_posts()) {
$this->backup_post_object();
$this->backup_theme_config();
$this->setup_config($attributes);
ob_start();
do_action('presscore_before_shortcode_loop', $this->shortcode_name, $attributes);
if ($attributes['full_width']) {
echo '<div class="full-width-wrap">';
}
echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>';
while ($dt_query->have_posts()) {
$dt_query->the_post();
presscore_populate_team_config();
presscore_get_template_part('mod_team', 'team-post');
}
echo '</div>';
if ($attributes['full_width']) {
echo '</div>';
}
do_action('presscore_after_shortcode_loop', $this->shortcode_name, $attributes);
$output .= ob_get_contents();
ob_end_clean();
$this->restore_theme_config();
$this->restore_post_object();
}
return $output;
}
示例11: shortcode
public function shortcode($atts, $content = null)
{
$attributes = $this->atts = $this->sanitize_attributes($atts);
// vc inline dummy
if (presscore_vc_is_inline()) {
$terms_title = _x('Display categories', 'vc inline dummy', 'the7mk2');
$terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
return $this->vc_inline_dummy(array('class' => 'dt_vc-photos_scroller', 'title' => _x('Photos scroller', 'vc inline dummy', 'the7mk2'), 'fields' => array($terms_title => $terms_list)));
}
$output = '';
$dt_query = $this->get_albums_attachments(array('orderby' => $attributes['orderby'], 'order' => 'DESC', 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
if ($dt_query->have_posts()) {
$this->backup_post_object();
$this->backup_theme_config();
$this->setup_config();
$this->add_hooks();
ob_start();
// loop
while ($dt_query->have_posts()) {
$dt_query->the_post();
echo '<li class="fs-entry">';
presscore_get_template_part('mod_albums', 'photo-masonry/photo');
echo '</li>';
}
$posts_html = ob_get_contents();
ob_end_clean();
// shape output
$output = '<div ' . $this->get_container_html_class(array('dt-photos-shortcode', 'slider-wrapper', 'shortcode-instagram', 'dt-gallery-container')) . ' ' . $this->get_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
$output .= '<div class="frame fullwidth-slider"><ul class="clearfix">' . $posts_html . '</ul></div>';
if ($attributes['arrows']) {
$output .= '<div class="prev"><i></i></div><div class="next"><i></i></div>';
}
$output .= '</div>';
// cleanup
$this->remove_hooks();
$this->restore_theme_config();
$this->restore_post_object();
}
return $output;
}
示例12: widget
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, self::$widget_defaults);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_testimonials', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_testimonials_category', 'field' => 'term_id', 'terms' => $instance['cats'])));
switch ($instance['select']) {
case 'only':
$args['tax_query'][0]['operator'] = 'IN';
break;
case 'except':
$args['tax_query'][0]['operator'] = 'NOT IN';
break;
default:
unset($args['tax_query']);
}
$p_query = new WP_Query($args);
$autoslide = absint($instance['autoslide']);
echo $before_widget . "\n";
// title
if ($title) {
echo $before_title . $title . $after_title . "\n";
}
if ($p_query->have_posts()) {
echo '<ul class="testimonials slider-content rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n";
while ($p_query->have_posts()) {
$p_query->the_post();
echo '<li>';
presscore_get_template_part('mod_testimonials', 'testimonials-post');
echo '</li>';
}
// while have posts
wp_reset_postdata();
echo '</ul>', "\n";
}
// if have posts
echo $after_widget . "\n";
}
示例13: portfolio_slider
protected function portfolio_slider()
{
$output = '';
// query
$dt_query = $this->get_posts_by_terms(array('orderby' => $this->atts['orderby'], 'order' => $this->atts['order'], 'number' => $this->atts['number'], 'select' => $this->atts['select'], 'category' => $this->atts['category']));
if ($dt_query->have_posts()) {
// setup
$this->backup_post_object();
$this->backup_theme_config();
$this->setup_config();
$this->add_hooks();
ob_start();
// loop
while ($dt_query->have_posts()) {
$dt_query->the_post();
echo '<li class="fs-entry">';
presscore_populate_portfolio_config();
presscore_get_config()->set('post.preview.media.style', 'featured_image');
presscore_get_template_part('mod_portfolio', 'masonry/project');
echo '</li>';
}
// store loop html
$posts_html = ob_get_contents();
ob_end_clean();
// shape output
$output = '<div ' . $this->get_container_html_class(array('dt-portfolio-shortcode', 'slider-wrapper')) . ' ' . $this->get_container_data_atts() . '>';
$output .= '<div class="frame fullwidth-slider"><ul class="clearfix">' . $posts_html . '</ul></div>';
if ($this->atts['arrows']) {
$output .= '<div class="prev"><i></i></div><div class="next"><i></i></div>';
}
$output .= '</div>';
// cleanup
$this->remove_hooks();
$this->restore_theme_config();
$this->restore_post_object();
}
return $output;
}
示例14: slider
public function slider()
{
$output = '';
$attributes =& $this->atts;
// query
$dt_query = $this->get_posts_by_terms(array('orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
if ($dt_query->have_posts()) {
// setup
$this->backup_post_object();
$this->backup_theme_config();
$this->setup_config();
$this->add_hooks();
ob_start();
// loop
while ($dt_query->have_posts()) {
$dt_query->the_post();
echo '<li class="fs-entry">';
presscore_get_template_part('theme', 'blog/masonry/blog-masonry-post');
echo '</li>';
}
// store loop html
$posts_html = ob_get_contents();
ob_end_clean();
// cleanup
$this->remove_hooks();
$this->restore_theme_config();
$this->restore_post_object();
// shape output
$output = '<div ' . $this->get_container_html_class(array('dt-blog-shortcode', 'slider-wrapper')) . ' ' . $this->get_container_data_atts() . '>';
$output .= '<div class="frame fullwidth-slider"><ul class="clearfix">' . $posts_html . '</ul></div>';
if ($attributes['arrows']) {
$output .= '<div class="prev"><i></i></div><div class="next"><i></i></div>';
}
$output .= '</div>';
}
return $output;
}
示例15: post_template
protected function post_template()
{
presscore_populate_portfolio_config();
presscore_get_template_part('mod_portfolio', 'masonry/project');
}