本文整理汇总了PHP中presscore_config_base_init函数的典型用法代码示例。如果您正苦于以下问题:PHP presscore_config_base_init函数的具体用法?PHP presscore_config_base_init怎么用?PHP presscore_config_base_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了presscore_config_base_init函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: dt_woocommerce_init_template_config
/**
* Init theme config for shop.
*
*/
function dt_woocommerce_init_template_config($name = '')
{
dt_woocommerce_add_config_actions();
if ('shop' != $name) {
return;
}
$config = presscore_get_config();
$post_id = null;
if (is_shop()) {
$post_id = woocommerce_get_page_id('shop');
} else {
if (is_cart()) {
$post_id = woocommerce_get_page_id('cart');
} else {
if (is_checkout()) {
$post_id = woocommerce_get_page_id('checkout');
}
}
}
presscore_config_base_init($post_id);
if (is_product_category() || is_product_tag()) {
$post_id = woocommerce_get_page_id('shop');
if ($post_id) {
$config->set('post_id', $post_id);
presscore_config_populate_sidebar_and_footer_options();
$config->set('post_id', null);
}
}
if (!is_product()) {
add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20);
}
// replace theme breadcrumbs
add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2);
}
示例3: configure_template
protected function configure_template()
{
$this->config->set('template', 'media');
presscore_config_base_init($this->input['post_id']);
if ($this->config->get('justified_grid') && isset($this->input['sender']) && in_array($this->input['sender'], array('filter', 'paginator'))) {
$this->input['loaded_items'] = array();
}
}
示例4: configure_template
protected function configure_template()
{
$this->config->set('template', 'albums');
$this->config->set('template.layout.type', 'masonry');
presscore_config_base_init($this->input['post_id']);
if ($this->config->get('justified_grid') && isset($this->input['sender']) && in_array($this->input['sender'], array('filter', 'paginator'))) {
$this->input['loaded_items'] = array();
}
presscore_react_on_categorizer();
}
开发者ID:10asfar,项目名称:WordPress-the7-theme-demo-,代码行数:10,代码来源:class-mod-albums-ajax-content-builder.php
示例5: presscore_config_base_init
/* Template Name: Albums - masonry & grid */
/**
* Media Albums template. Uses dt_gallery post type and dt_gallery_category taxonomy.
*
* @package presscore
* @since presscore 0.1
*/
// File Security Check
if (!defined('ABSPATH')) {
exit;
}
$config = Presscore_Config::get_instance();
$config->set('template', 'albums');
$config->set('template.layout.type', 'masonry');
presscore_config_base_init();
// add content controller
add_action('presscore_before_main_container', 'presscore_page_content_controller', 15);
get_header();
if (presscore_is_content_visible()) {
?>
<!-- Content -->
<div id="content" class="content" role="main">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
// main loop
do_action('presscore_before_loop');
示例6: get_media_masonry_content
/**
* Get media posts in masonry layout.
*
*/
public static function get_media_masonry_content($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 {
/**
* Include AQResizer.
*
*/
require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
/**
* Include helpers.
*
*/
require_once PRESSCORE_DIR . '/helpers.php';
/**
* Include template actions and filters.
*
*/
require_once PRESSCORE_DIR . '/template-hooks.php';
/**
* Include paginator.
*
*/
require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
if (!class_exists('Mobile_Detect')) {
/**
* Mobile detection library.
*
*/
require_once PRESSCORE_EXTENSIONS_DIR . '/mobile-detect.php';
}
// get page
query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
$html = '';
$responce = array('success' => true);
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = Presscore_Config::get_instance();
$config->set('template', 'media');
presscore_config_base_init($post_id);
if ($config->get('justified_grid') && isset($sender) && in_array($sender, array('filter', 'paginator'))) {
$loaded_items = array();
}
ob_start();
do_action('presscore_before_loop');
$page_query = Presscore_Inc_Albums_Post_Type::get_media_template_query();
if ($page_query->have_posts()) {
while ($page_query->have_posts()) {
$page_query->the_post();
$key_in_loaded = array_search($post->ID, $loaded_items);
if (false !== $key_in_loaded) {
unset($loaded_items[$key_in_loaded]);
continue;
}
dt_get_template_part('media/media-masonry-post');
}
wp_reset_postdata();
}
$html .= ob_get_clean();
}
$next_page_link = dt_get_next_posts_url($page_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($page_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($page_query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
$pagination = ob_get_clean();
if ($pagination) {
$responce['paginationHtml'] = $pagination;
}
$responce['paginationType'] = 'paginator';
}
}
$responce['itemsToDelete'] = array_values($loaded_items);
// $responce['query'] = $page_query->query;
$responce['order'] = strtolower($config->get('order'));
//.........这里部分代码省略.........
示例7: presscore_testimonials_ajax_loading_responce
function presscore_testimonials_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));
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = presscore_get_config();
$config->set('template', 'testimonials');
$config->set('template.layout.type', 'masonry');
presscore_config_base_init();
do_action('presscore_before_loop');
$query = Presscore_Inc_Testimonials_Post_Type::get_template_query();
$html = '';
ob_start();
if ($query->have_posts()) {
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;
}
*/
// post template
get_template_part('content', 'testimonials');
}
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->get('order', '');
$responce['orderby'] = $query->get('orderby', 'date');
}
// main loop
$responce['html'] = $html;
}
return $responce;
}
示例8: presscore_get_config
/**
* Archive pages.
*
* @package vogue
* @since 1.0.0
*/
// File Security Check
if (!defined('ABSPATH')) {
exit;
}
$config = presscore_get_config();
$config->set('template', 'archive');
$config->set('layout', 'masonry');
$config->set('template.layout.type', 'masonry');
$archive_page_id = apply_filters('presscore_archive_page_id', null);
presscore_config_base_init($archive_page_id);
get_header();
?>
<!-- Content -->
<div id="content" class="content" role="main">
<?php
if (have_posts()) {
do_action('presscore_before_loop');
// backup config
$config_backup = $config->get();
// masonry container open
echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>';
while (have_posts()) {
the_post();
示例9: presscore_template_config_init
function presscore_template_config_init()
{
presscore_config_base_init();
}
示例10: 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));
if (have_posts() && !post_password_required()) {
while (have_posts()) {
the_post();
// main loop
$config = Presscore_Config::get_instance();
$config->set('template', 'blog');
$config->set('template.layout.type', 'masonry');
presscore_config_base_init();
presscore_post_meta_new_controller();
do_action('presscore_before_loop');
$orderby = $config->get('orderby');
$query_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => dt_get_paged_var(), 'order' => $config->get('order'), 'orderby' => 'name' == $orderby ? 'title' : $orderby);
$ppp = $config->get('posts_per_page');
if ($ppp) {
$query_args['posts_per_page'] = intval($ppp);
}
$display = $config->get('display');
if (!empty($display['terms_ids'])) {
$terms_ids = array_values($display['terms_ids']);
switch ($display['select']) {
case 'only':
$query_args['category__in'] = $terms_ids;
break;
case 'except':
$query_args['category__not_in'] = $terms_ids;
}
}
$query = new WP_Query($query_args);
$html = '';
ob_start();
if ($query->have_posts()) {
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();
// post template
dt_get_template_part('blog/masonry/blog-masonry-post');
}
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
//.........这里部分代码省略.........