本文整理汇总了PHP中FLBuilderModel::update_post_data方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel::update_post_data方法的具体用法?PHP FLBuilderModel::update_post_data怎么用?PHP FLBuilderModel::update_post_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilderModel
的用法示例。
在下文中一共展示了FLBuilderModel::update_post_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders the layout data to be passed back to the builder.
*
* @since 1.7
* @param string $node_id The ID of a node to try and render instead of the entire layout.
* @param string $old_node_id The ID of a node that has been replaced in the layout.
* @return array
*/
public static function render($node_id = null, $old_node_id = null)
{
// Update the node ID in the post data?
if ($node_id) {
FLBuilderModel::update_post_data('node_id', $node_id);
}
// Render CSS and JS assets.
FLBuilder::render_assets();
// Register scripts needed for shortcodes and widgets.
self::register_scripts();
// Dequeue scripts and styles to only capture those that are needed.
self::dequeue_scripts_and_styles();
// Get the partial refresh data.
$partial_refresh_data = self::get_partial_refresh_data();
// Render the markup.
$html = self::render_html();
// Render scripts and styles.
$scripts_styles = self::render_scripts_and_styles();
// Render the assets.
$assets = self::render_assets();
// Return the response.
return array('partial' => $partial_refresh_data['is_partial_refresh'], 'nodeId' => $partial_refresh_data['node_id'], 'nodeType' => $partial_refresh_data['node_type'], 'oldNodeId' => $old_node_id, 'html' => $html, 'scriptsStyles' => $scripts_styles, 'css' => $assets['css'], 'js' => $assets['js']);
}
示例2: render_query
/**
* Renders layouts using a new instance of WP_Query with the provided
* args and enqueues the necessary styles and scripts. We set the global
* $wp_query variable so the builder thinks we are in the loop when content
* is rendered without having to call query_posts.
*
* @link https://codex.wordpress.org/Class_Reference/WP_Query See for a complete list of args.
*
* @since 1.7
* @param array|string $args An array or string of args to be passed to a new instance of WP_Query.
* @return void
*/
public static function render_query($args)
{
global $post;
global $wp_query;
$original_post = $post;
$wp_query = new WP_Query($args);
$post_data = FLBuilderModel::get_post_data();
// Unset the builder's post_data post ID so the global $post is used.
FLBuilderModel::update_post_data('post_id', null);
// Loop through the posts.
while ($wp_query->have_posts()) {
// Set the global post.
$wp_query->the_post();
// Make sure this isn't the same post as the original post to prevent infinite loops.
if ($original_post->ID === $post->ID) {
continue;
}
// Enqueue styles and scripts for this post.
self::enqueue_layout_styles_scripts($post->ID);
// Print the styles since we are outside of the head tag.
ob_start();
wp_print_styles();
$styles = str_replace("\n", '', ob_get_clean());
// Added stylesheets inline can mess with specificity, so we add them to the head with JS.
if (!empty($styles)) {
echo '<script>jQuery("head").prepend("' . $styles . '");</script>';
}
// Render the content.
the_content();
}
// Reset the post_id if we have one in $post_data.
if (isset($post_data['post_id'])) {
FLBuilderModel::update_post_data('post_id', $post_data['post_id']);
}
// Reset the global query.
wp_reset_query();
}
示例3: render_module_template_settings
/**
* Renders the settings lightbox for when a module template
* is added to a layout.
*
* @since 1.6.3
* @param string $parent_id A column node ID.
* @param string $type The type of module.
* @param int $position The new module position.
* @return array|void An array of layout data or nothing if called via AJAX.
*/
public static function render_module_template_settings($parent_id = null, $type = null, $position = false)
{
$post_data = FLBuilderModel::get_post_data();
$template_id = isset($post_data['template_id']) ? $post_data['template_id'] : $template_id;
$parent_id = isset($post_data['parent_id']) ? $post_data['parent_id'] : $parent_id;
$position = isset($post_data['position']) ? (int) $post_data['position'] : $position;
$module = FLBuilderModel::apply_node_template($template_id, $parent_id, $position);
// Force the global parent id.
FLBuilderModel::update_post_data('parent_id', $module->parent);
// Get the settings html.
ob_start();
self::render_module_settings($module->node, $module->type, $module->parent, true);
$settings = ob_get_clean();
// Build the response.
$response = array('layout' => self::render_layout(true), 'settings' => $settings);
// Echo or return the response.
if (defined('DOING_AJAX')) {
echo json_encode($response);
die;
} else {
return $response;
}
}
示例4: _actionSetMediumIdAfterViewsBodyShortcode
public function _actionSetMediumIdAfterViewsBodyShortcode()
{
remove_filter('the_content', 'FLBuilder::render_content');
if ($this->getActiveMediumId()) {
FLBuilderModel::update_post_data('post_id', $this->getActiveMediumId());
}
}