当前位置: 首页>>代码示例>>PHP>>正文


PHP siteorigin_widget_post_selector_process_query函数代码示例

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


在下文中一共展示了siteorigin_widget_post_selector_process_query函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sow_carousel_get_next_posts_page

function sow_carousel_get_next_posts_page()
{
    if (empty($_REQUEST['_widgets_nonce']) || !wp_verify_nonce($_REQUEST['_widgets_nonce'], 'widgets_action')) {
        return;
    }
    $query = wp_parse_args(siteorigin_widget_post_selector_process_query($_GET['query']), array('post_status' => 'publish', 'posts_per_page' => 10, 'paged' => empty($_GET['paged']) ? 1 : $_GET['paged']));
    $posts = new WP_Query($query);
    ob_start();
    while ($posts->have_posts()) {
        $posts->the_post();
        ?>
		<li class="sow-carousel-item">
			<div class="sow-carousel-thumbnail">
				<?php 
        if (has_post_thumbnail()) {
            $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'sow-carousel-default');
            ?>
					<a href="<?php 
            the_permalink();
            ?>
" style="background-image: url(<?php 
            echo sow_esc_url($img[0]);
            ?>
)">
						<span class="overlay"></span>
					</a>
				<?php 
        } else {
            ?>
					<a href="<?php 
            the_permalink();
            ?>
" class="sow-carousel-default-thumbnail"><span class="overlay"></span></a>
				<?php 
        }
        ?>
			</div>
			<h3><a href="<?php 
        the_permalink();
        ?>
"><?php 
        the_title();
        ?>
</a></h3>
		</li>
	<?php 
    }
    wp_reset_postdata();
    $result = array('html' => ob_get_clean());
    header('content-type: application/json');
    echo json_encode($result);
    exit;
}
开发者ID:WordPressArt,项目名称:conisia,代码行数:53,代码来源:so-post-carousel-widget.php

示例2: sow_carousel_get_next_posts_page

function sow_carousel_get_next_posts_page()
{
    if (empty($_REQUEST['_widgets_nonce']) || !wp_verify_nonce($_REQUEST['_widgets_nonce'], 'widgets_action')) {
        return;
    }
    $query = wp_parse_args(siteorigin_widget_post_selector_process_query($_GET['query']), array('post_status' => 'publish', 'posts_per_page' => 10, 'paged' => empty($_GET['paged']) ? 1 : $_GET['paged']));
    $posts = new WP_Query($query);
    ob_start();
    include 'tpl/carousel-post-loop.php';
    $result = array('html' => ob_get_clean());
    header('content-type: application/json');
    echo json_encode($result);
    exit;
}
开发者ID:futurelabnz,项目名称:wp-futurelab,代码行数:14,代码来源:post-carousel.php

示例3: wp_kses_post

<?php

$widget_title = wp_kses_post($instance['widget_title']);
$query = siteorigin_widget_post_selector_process_query($instance['posts']);
$the_query = new WP_Query($query);
?>


<?php 
if ($widget_title) {
    ?>
    <h3 class="widget-title">
        <span><?php 
    echo $widget_title;
    ?>
</span>
    </h3>
<?php 
}
?>


<div class="soua-main">
        <?php 
while ($the_query->have_posts()) {
    $the_query->the_post();
    ?>
        <div class="soua-accordion">
            <a class="soua-accordion-title"> <?php 
    the_title();
    ?>
开发者ID:Nirajjcu,项目名称:minime3d,代码行数:31,代码来源:faqs-template.php

示例4: siteorigin_widget_post_selector_process_query

<?php

/**
 * @var $carousel_settings
 * @var $settings
 * @var $posts
 */
$query_args = siteorigin_widget_post_selector_process_query($posts);
// Use the processed post selector query to find posts.
$loop = new WP_Query($query_args);
// Loop through the posts and do something with them.
if ($loop->have_posts()) {
    ?>

    <div class="db-posts-carousel db-container"  <?php 
    foreach ($carousel_settings as $key => $val) {
        ?>
        <?php 
        if (!empty($val)) {
            ?>
            data-<?php 
            echo $key . '="' . esc_attr($val) . '"';
            ?>
        <?php 
        }
        ?>
    <?php 
    }
    ?>
>
开发者ID:dungtd91,项目名称:bones,代码行数:30,代码来源:default.php

示例5: siteorigin_widget_post_selector_get_posts_action

/**
 * The get posts ajax action
 */
function siteorigin_widget_post_selector_get_posts_action()
{
    if (empty($_REQUEST['_widgets_nonce']) || !wp_verify_nonce($_REQUEST['_widgets_nonce'], 'widgets_action')) {
        return;
    }
    $query = stripslashes($_POST['query']);
    $query = wp_parse_args(siteorigin_widget_post_selector_process_query($query), array('post_status' => 'publish', 'posts_per_page' => 10));
    if (!empty($_POST['ignore_pagination'])) {
        $query['posts_per_page'] = 100;
    }
    $posts = new WP_Query($query);
    // Create the result
    $result = array('found_posts' => $posts->found_posts, 'posts' => array());
    foreach ($posts->posts as $post) {
        $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID));
        $result['posts'][] = array('title' => $post->post_title, 'id' => $post->ID, 'thumbnail' => !empty($thumbnail) ? $thumbnail[0] : plugin_dir_url(__FILE__) . '../css/img/thumbnail-placeholder.png', 'editUrl' => admin_url('post.php?post=' . $post->ID . '&action=edit'));
    }
    header('content-type: application/json');
    echo json_encode($result);
    exit;
}
开发者ID:KJaddoe,项目名称:CSCMRA-Project,代码行数:24,代码来源:post-selector.php

示例6: widget

 /**
  * @param array $args
  * @param array $instance
  */
 function widget($args, $instance)
 {
     if (empty($instance['template'])) {
         return;
     }
     if (is_admin()) {
         return;
     }
     static $depth = 0;
     $depth++;
     if ($depth > 1) {
         // Because of infinite loops, don't render this post loop if its inside another
         $depth--;
         echo $args['before_widget'] . $args['after_widget'];
         return;
     }
     $query_args = $instance;
     //If Widgets Bundle post selector is available and a posts query has been saved using it.
     if (function_exists('siteorigin_widget_post_selector_process_query') && !empty($instance['posts'])) {
         $query_args = siteorigin_widget_post_selector_process_query($instance['posts']);
         $query_args['additional'] = empty($instance['additional']) ? array() : $instance['additional'];
     } else {
         if (!empty($instance['posts'])) {
             $query_args = wp_parse_args($instance['posts'], $query_args);
         }
         switch ($query_args['sticky']) {
             case 'ignore':
                 $query_args['ignore_sticky_posts'] = 1;
                 break;
             case 'only':
                 $query_args['post__in'] = get_option('sticky_posts');
                 break;
             case 'exclude':
                 $query_args['post__not_in'] = get_option('sticky_posts');
                 break;
         }
         unset($query_args['template']);
         unset($query_args['title']);
         unset($query_args['sticky']);
         if (empty($query_args['additional'])) {
             $query_args['additional'] = array();
         }
     }
     $query_args = wp_parse_args($query_args['additional'], $query_args);
     unset($query_args['additional']);
     global $wp_rewrite;
     if ($wp_rewrite->using_permalinks()) {
         if (get_query_var('paged')) {
             // When the widget appears on a sub page.
             $query_args['paged'] = get_query_var('paged');
         } elseif (strpos($_SERVER['REQUEST_URI'], '/page/') !== false) {
             // When the widget appears on the home page.
             preg_match('/\\/page\\/([0-9]+)\\//', $_SERVER['REQUEST_URI'], $matches);
             if (!empty($matches[1])) {
                 $query_args['paged'] = intval($matches[1]);
             } else {
                 $query_args['paged'] = 1;
             }
         } else {
             $query_args['paged'] = 1;
         }
     } else {
         // Get current page number when we're not using permalinks
         $query_args['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 1;
     }
     // Exclude the current post to prevent possible infinite loop
     global $siteorigin_panels_current_post;
     if (!empty($siteorigin_panels_current_post)) {
         if (!empty($query_args['post__not_in'])) {
             if (!is_array($query_args['post__not_in'])) {
                 $query_args['post__not_in'] = explode(',', $query_args['post__not_in']);
                 $query_args['post__not_in'] = array_map('intval', $query_args['post__not_in']);
             }
             $query_args['post__not_in'][] = $siteorigin_panels_current_post;
         } else {
             $query_args['post__not_in'] = array($siteorigin_panels_current_post);
         }
     }
     if (!empty($query_args['post__in']) && !is_array($query_args['post__in'])) {
         $query_args['post__in'] = explode(',', $query_args['post__in']);
         $query_args['post__in'] = array_map('intval', $query_args['post__in']);
     }
     // Create the query
     query_posts($query_args);
     echo $args['before_widget'];
     // Filter the title
     $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     if (!empty($instance['title'])) {
         echo $args['before_title'] . $instance['title'] . $args['after_title'];
     }
     global $more;
     $old_more = $more;
     $more = empty($instance['more']);
     self::$rendering_loop = true;
     if (strpos('/' . $instance['template'], '/content') !== false) {
         while (have_posts()) {
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:basic.php

示例7: elseif

} elseif ($instance['design']['columns'] == 2) {
    $cols = ' iw-medium-6 iw-small-12';
} elseif ($instance['design']['columns'] == 3) {
    $cols = ' iw-large-4 iw-medium-6 iw-small-12';
} elseif ($instance['design']['columns'] == 4) {
    $cols = ' iw-large-3 iw-medium-6 iw-small-12';
}
if (!empty($instance['title'])) {
    echo $args['before_title'] . esc_html($instance['title']) . $args['after_title'];
}
?>

<?php 
// Setting up posts query
$post_selector_pseudo_query = $instance['posts'];
$processed_query = siteorigin_widget_post_selector_process_query($post_selector_pseudo_query);
$query_result = new WP_Query($processed_query);
?>

<?php 
// Looping through the posts
if ($query_result->have_posts()) {
    ?>

	<div class="iw-row" data-equalizer>

		<?php 
    while ($query_result->have_posts()) {
        $query_result->the_post();
        ?>
开发者ID:ErhanLammar,项目名称:all-construct.be,代码行数:30,代码来源:thumb-none.php


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