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


PHP td_global::is_wordpress_loop方法代码示例

本文整理汇总了PHP中td_global::is_wordpress_loop方法的典型用法代码示例。如果您正苦于以下问题:PHP td_global::is_wordpress_loop方法的具体用法?PHP td_global::is_wordpress_loop怎么用?PHP td_global::is_wordpress_loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在td_global的用法示例。


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

示例1: td_ajax_loop

function td_ajax_loop()
{
    $loopState = td_util::get_http_post_val('loopState');
    //print_r($loopState);
    $buffy = '';
    /**
     * @var WP_Query
     */
    $td_query =& td_data_source::get_wp_query($loopState['atts'], $loopState['currentPage']);
    //by ref  do the query
    if (!empty($td_query->posts)) {
        td_global::$is_wordpress_loop = true;
        ///if we are in wordpress loop; used by quotes in blocks to check if the blocks are displayed in blocks or in loop
        $td_template_layout = new td_template_layout($loopState['sidebarPosition']);
        $td_module_class = td_util::get_module_class_from_loop_id($loopState['moduleId']);
        //disable the grid for some of the modules
        $td_module_api = td_api_module::get_by_id($td_module_class);
        if ($td_module_api['uses_columns'] === false) {
            $td_template_layout->disable_output();
        }
        foreach ($td_query->posts as $post) {
            $buffy .= $td_template_layout->layout_open_element();
            if (class_exists($td_module_class)) {
                $td_mod = new $td_module_class($post);
                $buffy .= $td_mod->render();
            } else {
                td_util::error(__FILE__, 'Missing module: ' . $td_module_class);
            }
            $buffy .= $td_template_layout->layout_close_element();
            $td_template_layout->layout_next();
        }
        $buffy .= $td_template_layout->close_all_tags();
    } else {
        // no posts
    }
    $loopState['server_reply_html_data'] = $buffy;
    die(json_encode($loopState));
}
开发者ID:weerapat,项目名称:wp-daily,代码行数:38,代码来源:td_ajax.php

示例2: while

<?php

/**
 * If you are looking for the loop that's handling the single post page (single.php), check out loop-single.php
 **/
// $global_flag_to_hide_no_post_to_display - comes from page-category-big-grid.php and is a flag to hide the 'No posts to display' message if on category page there are between 1 and 5  posts
global $loop_module_id, $loop_sidebar_position, $global_flag_to_hide_no_post_to_display;
///if we are in wordpress loop; used by quotes in blocks to check if the blocks are displayed in blocks or in loop
td_global::$is_wordpress_loop = true;
$td_template_layout = new td_template_layout($loop_sidebar_position);
if (empty($loop_module_id)) {
    //not sure if we need a default here
    $loop_module_id = 1;
}
$td_module_class = td_util::get_module_class_from_loop_id($loop_module_id);
//disable the grid for some of the modules
$td_module = td_api_module::get_by_id($td_module_class);
if ($td_module['uses_columns'] === false) {
    $td_template_layout->disable_output();
}
if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo $td_template_layout->layout_open_element();
        if (class_exists($td_module_class)) {
            $td_mod = new $td_module_class($post);
            echo $td_mod->render();
        } else {
            td_util::error(__FILE__, 'Missing module: ' . $td_module_class);
        }
        echo $td_template_layout->layout_close_element();
开发者ID:tuanlibra,项目名称:thptxuanang,代码行数:31,代码来源:loop.php


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