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


PHP FLBuilderModel::get_global_posts方法代码示例

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


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

示例1: render_content

 /**
  * Renders the content for a builder layout while in the loop. 
  * This method should only be called by the_content filter as 
  * defined in fl-builder.php. To output builder content, use 
  * the_content function while in a WordPress loop. 
  *
  * @since 1.0
  * @param string $content The existing content.
  * @return string
  */
 public static function render_content($content)
 {
     $post_id = FLBuilderModel::get_post_id();
     $enabled = FLBuilderModel::is_builder_enabled();
     $rendering = $post_id === self::$post_rendering;
     $ajax = defined('DOING_AJAX');
     $in_loop = in_the_loop();
     $is_global = in_array($post_id, FLBuilderModel::get_global_posts());
     if ($enabled && !$rendering && !$ajax && ($in_loop || $is_global)) {
         // Set the post rendering ID.
         self::$post_rendering = $post_id;
         // Remove the builder's render_content filter so it's not called again.
         remove_filter('the_content', 'FLBuilder::render_content');
         // Render the content.
         ob_start();
         echo '<div class="' . self::render_content_classes() . '" data-post-id="' . $post_id . '">';
         self::render_nodes();
         echo '</div>';
         $content = ob_get_clean();
         // Reapply the builder's render_content filter.
         add_filter('the_content', 'FLBuilder::render_content');
         // Do shortcodes here since letting the WP filter run can cause an infinite loop.
         $pattern = get_shortcode_regex();
         $content = preg_replace_callback("/{$pattern}/s", 'FLBuilder::double_escape_shortcodes', $content);
         $content = do_shortcode($content);
         // Add srcset attrs to images with the class wp-image-<ID>.
         if (function_exists('wp_make_content_images_responsive')) {
             $content = wp_make_content_images_responsive($content);
         }
         // Clear the post rendering ID.
         self::$post_rendering = null;
     }
     return $content;
 }
开发者ID:komcdo,项目名称:iSSNA-WordPress,代码行数:44,代码来源:class-fl-builder.php

示例2: render_content

 /**
  * Renders the content for a builder layout while in the loop. 
  * This method should only be called by the_content filter as 
  * defined in fl-builder.php. To output builder content, use 
  * the_content function while in a WordPress loop. 
  *
  * @since 1.0
  * @param string $content The existing content.
  * @return string
  */
 public static function render_content($content)
 {
     global $wp_filter;
     $post_id = FLBuilderModel::get_post_id();
     $enabled = FLBuilderModel::is_builder_enabled();
     $rendering = $post_id === self::$post_rendering;
     $ajax = defined('DOING_AJAX');
     $in_loop = in_the_loop();
     $is_global = in_array($post_id, FLBuilderModel::get_global_posts());
     if ($enabled && !$rendering && !$ajax && ($in_loop || $is_global)) {
         // Store this post ID so we know it is currently being rendered
         // in case another method or function calls apply filters on the
         // content after this method has run which creates an infinite loop.
         self::$post_rendering = $post_id;
         // Store a reference to the current the_content filters array since
         // any modules or widgets that call apply_filters on the_content cause
         // the array pointer to move to the end. That makes it so the builder
         // content doesn't receive filters after this method runs as it should.
         $filters = $wp_filter['the_content'];
         // Remove the builder's render_content filter so it's not called again
         // by modules or widgets that call apply_filters on the content.
         remove_filter('the_content', 'FLBuilder::render_content');
         // Render the content.
         ob_start();
         echo '<div class="fl-builder-content fl-builder-content-' . $post_id . '" data-post-id="' . $post_id . '">';
         self::render_rows();
         echo '</div>';
         $content = ob_get_clean();
         // Restore the original the_content filters array.
         $wp_filter['the_content'] = $filters;
     }
     return $content;
 }
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:43,代码来源:class-fl-builder.php


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