本文整理汇总了PHP中layers_get_builder_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP layers_get_builder_pages函数的具体用法?PHP layers_get_builder_pages怎么用?PHP layers_get_builder_pages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了layers_get_builder_pages函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register_sidebars
/**
* Register Sidebars
*/
public function register_sidebars()
{
global $wp_customize, $temp_sidebars;
// Loop the Builder Pages and create their sidebars
foreach (layers_get_builder_pages() as $page) {
$this->register_builder_sidebar($page->ID, $page->post_title);
}
}
示例2: _e
</li>
<li><?php
_e('Try keep your logo file size below 500kb', 'layerswp');
?>
</li>
</ul>
</div>
</div>
</div>
<!-- Create a page to be your first Layout -->
<div class="l_admin-onboard-slide l_admin-animate l_admin-onboard-slide-inactive">
<div class="l_admin-column l_admin-span-8 l_admin-template-selector postbox">
<div class="l_admin-content">
<?php
if (layers_get_builder_pages()) {
?>
<p class="l_admin-form-item">
<label><?php
_e('Page Title', 'layerswp');
?>
</label>
<?php
echo $form_elements->input(array('type' => 'text', 'name' => 'preset_page_title', 'id' => 'preset_page_title', 'placeholder' => __('Home Page', 'layerswp'), 'value' => __('Home Page', 'layerswp'), 'class' => 'layers-text l_admin-large l_admin-push-bottom-medium'));
?>
</p>
<?php
}
// if layers_get_builder_pages();
?>
示例3: __
} else {
// Site Setup Contrats
$this->notice('good', __('Well done, your site setup is complete!', 'layerswp'));
}
?>
<div class="layers-panel layers-push-bottom">
<div class="layers-panel-title">
<h4 class="layers-heading"><?php
_e('Layers Pages', 'layerswp');
?>
</h4>
</div>
<ul class="layers-list layers-page-list">
<?php
foreach (layers_get_builder_pages() as $page) {
?>
<li>
<a class="layers-page-list-title" href="<?php
echo admin_url('post.php?post=' . $page->ID . '&action=edit');
?>
"><?php
echo $page->post_title;
?>
</a>
<span class="layers-page-edit-links">
<a href="<?php
echo admin_url('customize.php?url=' . esc_url(get_the_permalink($page->ID)));
?>
"><?php
_e('Edit Layout', 'layerswp');
示例4: layers_options_panel_menu
/**
* Add admin menu
*/
function layers_options_panel_menu()
{
$layers_options_panel = new Layers_Options_Panel();
global $submenu;
// dashboard Page
$dashboard = add_menu_page(LAYERS_THEME_TITLE, LAYERS_THEME_TITLE, 'edit_theme_options', LAYERS_THEME_SLUG . '-dashboard', 'layers_options_panel_ui', 'none', 3);
add_action('admin_print_scripts-' . $dashboard, array($layers_options_panel, 'enqueue_dashboard_scripts'));
// Get Started
add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Get Started', 'layerswp'), __('Get Started', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-get-started', 'layers_options_panel_ui');
// Add Preset Pages
add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Add New Page', 'layerswp'), __('Add New Page', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-add-new-page', 'layers_options_panel_ui');
// Layers Pages
if (layers_get_builder_pages()) {
// Only show if there are actually Layers pages.
add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Layers Pages', 'layerswp'), __('Layers Pages', 'layerswp'), 'edit_theme_options', 'edit.php?post_type=page&filter=layers');
}
// Customize
add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Customize', 'layerswp'), __('Customize', 'layerswp'), 'edit_theme_options', 'customize.php');
// Backup Page
add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Backup', 'layerswp'), __('Backup', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-backup', 'layers_options_panel_ui');
// This modifies the Layers submenu item - must be done here as $submenu
// is only created if $submenu items are added using add_submenu_page
$submenu[LAYERS_THEME_SLUG . '-dashboard'][0][0] = __('Dashboard', 'layerswp');
}
示例5: intercom_js
function intercom_js()
{
global $current_user, $wpdb, $wp_version, $wp_customize;
// Don't load in the customizer, or if we're not logged in; don't even try it.
if (!is_user_logged_in() || !is_admin() || !current_user_can('administrator')) {
return;
}
// Get current user info
$current_user = wp_get_current_user();
/**
* Basic Intercom settings
*/
$json['app_id'] = $this->app_id;
$json['user_hash'] = (string) hash_hmac('sha256', $current_user->user_email, $this->secret_key);
/**
* User centric data
*/
$json['email'] = (string) $current_user->user_email;
$json['name'] = (string) $current_user->display_name;
$json['created_at'] = strtotime($current_user->user_registered);
$json['company'] = strtotime(get_bloginfo('name'));
/**
* Child theme information
*/
$this->theme = wp_get_theme();
if ('layerswp' != $this->theme->get('TextDomain')) {
$json['Theme'] = (string) $this->theme->get('Name');
$json['Theme Author'] = (string) $this->theme->get('Author');
$json['Theme Author URL'] = (string) $this->theme->get('AuthorURI');
}
/**
* Layers specific data
*/
$this->layers_theme = wp_get_theme('layerswp');
$json['WordPress Version'] = $wp_version;
$json['Layers Version'] = $this->layers_theme->get('Version');
$json['Layers Page Count'] = (double) count(layers_get_builder_pages());
/**
* Website URL
*/
$json['Website URL'] = (string) get_home_url();
/**
* Important plugins
*/
$json['Easy Digital Downloads'] = (bool) (class_exists('Easy_Digital_Downloads') ? 1 : 0);
$json['WooCommerce'] = (bool) (class_exists('WooCommerce') ? 1 : 0);
$json['Layers Updater'] = (bool) (class_exists('Layers_Updater') || is_plugin_active_for_network('Layers_Updater') ? 1 : 0);
if (class_exists('Layers_DevKit') && defined('LAYERS_DEVKIT_VER')) {
$json['DevKit'] = LAYERS_DEVKIT_VER;
}
if (class_exists('Layers_ColorKit') && defined('LAYERS_COLORKIT_VER')) {
$json['ColorKit'] = LAYERS_COLORKIT_VER;
}
if (class_exists('Layers_WooCommerce') && defined('LAYERS_STOREKIT_VER')) {
$json['StoreKit'] = LAYERS_STOREKIT_VER;
}
if (class_exists('Layers_Showcase') && defined('LAYERS_SHOWCASE_VER')) {
$json['Showcase'] = LAYERS_SHOWCASE_VER;
}
if (class_exists('Layers_Pro') && defined('LAYERS_PRO_VER')) {
$json['Layers Pro'] = LAYERS_PRO_VER;
}
if (get_option('info_site_usage')) {
$json['Site Category'] = get_option('info_site_usage');
}
$json['Skill Level'] = get_option('layers_info_developer');
$json['Launchpad'] = class_exists('apollo_launchpad') ? 1 : 0;
$launchpad = get_option('apollo_display_options');
if (isset($launchpad['launchdate'])) {
$json['launched_at'] = strtotime($launchpad['launchdate']);
}
$json['Custom CSS'] = (bool) layers_get_theme_mod('custom-css');
// jsonify the settings
$settings_json = json_encode((object) $json, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : TRUE);
?>
<script>window.intercomSettings = <?php
echo $settings_json;
?>
;</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/<?php
echo $this->app_id;
?>
';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
<?php
}
示例6: render_builder_page_dropdown
/**
* Render the dropdown of builder pages in Customizer interface.
*/
public function render_builder_page_dropdown()
{
global $wp_customize;
if (!$wp_customize) {
return;
}
//Get builder pages.
$layers_pages = layers_get_builder_pages();
// Create builder pages dropdown.
if ($layers_pages) {
ob_start();
?>
<div class="layers-customizer-pages-dropdown">
<select>
<option value="init"><?php
_e('Builder Pages:', 'layerswp');
?>
</option>
<?php
foreach ($layers_pages as $page) {
?>
<?php
// Page URL
$edit_page_url = get_permalink($page->ID);
?>
<option value="<?php
echo esc_attr($edit_page_url);
?>
"><?php
echo $page->post_title;
?>
</option>
<?php
}
?>
</select>
</div>
<?php
// Get the Drop Down HTML
$drop_down = ob_get_clean();
// Return the Drop Down
return $drop_down;
}
}
示例7: layers_options_panel_menu
/**
* Add admin menu
*/
function layers_options_panel_menu()
{
$layers_options_panel = new Layers_Options_Panel();
global $submenu;
// dashboard Page
$dashboard = add_menu_page(LAYERS_THEME_TITLE, LAYERS_THEME_TITLE, 'edit_theme_options', LAYERS_THEME_SLUG . '-dashboard', 'layers_options_panel_ui', 'none', 3);
add_action('admin_print_scripts-' . $dashboard, array($layers_options_panel, 'enqueue_dashboard_scripts'));
// Add Preset Pages
$add_new_page = add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Add New Page', 'layerswp'), __('Add New Page', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-add-new-page', 'layers_options_panel_ui');
// Layers Pages
if (layers_get_builder_pages()) {
// Only show if there are actually Layers pages.
$layers_pages = add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Layers Pages', 'layerswp'), __('Layers Pages', 'layerswp'), 'edit_theme_options', 'edit.php?post_type=page&filter=layers');
}
// Customize
$customize = add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Customize', 'layerswp'), __('Customize', 'layerswp'), 'edit_theme_options', 'customize.php');
// Transfer Pages
$transfer = add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Transfer', 'layerswp'), __('Transfer', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-backup', 'layers_options_panel_ui');
// Get Started
$get_started = add_submenu_page(LAYERS_THEME_SLUG . '-dashboard', __('Setup', 'layerswp'), __('Setup', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-get-started', 'layers_options_panel_ui');
// This modifies the Layers submenu item - must be done here as $submenu
// is only created if $submenu items are added using add_submenu_page
if (isset($submenu['layers-dashboard'])) {
$submenu[LAYERS_THEME_SLUG . '-dashboard'][0][0] = __('Dashboard', 'layerswp');
}
// Marketplace
if (!defined('LAYERS_DISABLE_MARKETPLACE')) {
// dashboard Page
$marketplace = add_menu_page(__('Marketplace', 'layerswp'), __('Marketplace', 'layerswp'), 'edit_theme_options', LAYERS_THEME_SLUG . '-marketplace', 'layers_options_panel_ui', 'none', 4);
add_action('admin_print_scripts-' . $marketplace, array($layers_options_panel, 'enqueue_marketplace_scripts'));
$marketplace_extensions = add_submenu_page(LAYERS_THEME_SLUG . '-marketplace', __('Extensions', 'layerswp'), __('Extensions', 'layerswp'), 'edit_theme_options', 'admin.php?page=layers-marketplace&type=extensions');
$marketplace_stylekits = add_submenu_page(LAYERS_THEME_SLUG . '-marketplace', __('Style Kits', 'layerswp'), __('Style Kits', 'layerswp'), 'edit_theme_options', 'admin.php?page=layers-marketplace&type=stylekits');
// This modifies the Layers submenu item - must be done here as $submenu
// is only created if $submenu items are added using add_submenu_page
if (isset($submenu['layers-marketplace'])) {
$submenu[LAYERS_THEME_SLUG . '-marketplace'][0][0] = __('Themes', 'layerswp');
}
}
}
示例8: create_builder_page_from_preset
/**
* Ajax Create a Builder Page from a preset page
*
* This function takes on the Preset Page Data and runs the import() function
*/
public function create_builder_page_from_preset()
{
global $layers_widgets, $wpdb;
if (!check_ajax_referer('layers-migrator-preset-layouts', 'nonce', false)) {
die('You threw a Nonce exception');
}
// Nonce
remove_action('pre_post_update', 'wp_save_post_revision');
$post = array();
$import_data = array();
/**
* Check to see if we've created a builder page before
*/
$check_builder_pages = layers_get_builder_pages();
if (isset($_POST['post_title'])) {
$page_title = $_POST['post_title'];
} else {
$page_title = __('Home Page', 'layerswp');
}
/**
* Create Builder Page
*/
$import_data['post_id'] = layers_create_builder_page($page_title);
$new_page_id = $import_data['post_id'];
$new_page = get_post($import_data['post_id']);
/**
* Register sidebar
*/
$layers_widgets->register_builder_sidebar($new_page_id);
/**
* Set Import Parameters
*/
if (isset($_POST['widget_data'])) {
$import_data['widget_data'] = $_POST['widget_data'];
} else {
$import_data['widget_data'] = NULL;
}
/*
* Run Import
*/
$import_progress = $this->import($import_data, TRUE);
/**
* Maybe set home page
*/
if (count($check_builder_pages) == 0) {
update_option('page_on_front', $new_page_id);
update_option('show_on_front', 'page');
}
/**
* Create Page
*/
$page_raw_widget_data = array('post_id' => $new_page_id, 'post_title' => esc_attr($page_title), 'widget_data' => $import_data['widget_data']);
$export_data = $this->page_widget_data(json_encode($import_data['widget_data']));
update_post_meta($new_page_id, '_layers_widget_order', trim($this->page_widgets_as_content($export_data)));
update_option('layers_cron_page_backup', $new_page_id);
/*
* Send results home
*/
$results = array('post_id' => $new_page_id, 'post_title' => esc_attr($page_title), 'data_report' => $import_progress, 'customizer_location' => admin_url() . 'customize.php?url=' . esc_url(get_the_permalink($new_page_id)));
die(json_encode($results));
}
示例9: wp_get_current_user
<?php
// Fetch current user information
$user = wp_get_current_user();
?>
<?php
// Instantiate Inputs
$form_elements = new Layers_Form_Elements();
?>
<?php
// Get builder pages
$find_builder_page = layers_get_builder_pages();
?>
<section class="l_admin-area-wrapper" id="layers-add-new-page">
<?php
$this->header(__('Add New Page', 'layerswp'));
?>
<div class="l_admin-well l_admin-content">
<?php
$this->load_partial('preset-layouts');
?>
</div>
</section>
<section class="l_admin-modal-container l_admin-hide">
<div class="l_admin-vertical-center l_admin-modal">
<div class="l_admin-section-title l_admin-no-push-bottom">
示例10: wp_get_current_user
<?php
$user = wp_get_current_user();
$builder_pages = layers_get_builder_pages();
?>
<section class="layers-area-wrapper">
<?php
$this->header(__('Transfer', 'layerswp'));
?>
<div class="layers-row layers-well layers-content-large">
<div class="layers-container-large">
<div class="layers-row">
<div class="layers-column layers-panel layers-span-8">
<div class="layers-content layers-push-bottom">
<div class="layers-section-title layers-small">
<h3 class="layers-heading"><?php
_e('Transfer your pages', 'layerswp');
?>
</h3>
<p class="layers-excerpt">
<?php
_e('Convert your Layers pages into regular WordPress pages, preserving the content you have worked so hard to create.', 'layerswp');
?>
</p>
</div>
<div class="layers-load-bar">
<span class="layers-progress zero"><?php
_e('0%', 'layerswp');
示例11: create_builder_page_from_preset
/**
* Ajax Create a Builder Page from a preset page
*
* This function takes on the Preset Page Data and runs the import() function
*/
public function create_builder_page_from_preset()
{
global $layers_widgets;
$check_builder_pages = layers_get_builder_pages();
if (isset($_POST['post_title'])) {
$post_title = $_POST['post_title'];
} else {
$post_title = __('Home Page', 'layerswp');
}
// Generate builder page and return page ID
$import_data['post_id'] = layers_create_builder_page($post_title);
$new_page = get_page($import_data['post_id']);
// Register Builder Sidebar
$layers_widgets->register_builder_sidebar($import_data['post_id']);
// Add Widget Data to the import array
if (isset($_POST['widget_data'])) {
$import_data['widget_data'] = $_POST['widget_data'];
} else {
$import_data['widget_data'] = NULL;
}
// Run data import
$import_progress = $this->import($import_data);
if (count($check_builder_pages) == 0) {
update_option('page_on_front', $import_data['post_id']);
update_option('show_on_front', 'page');
}
$results = array('post_id' => $import_data['post_id'], 'post_title' => $new_page->post_title, 'data_report' => $import_progress, 'customizer_location' => admin_url() . 'customize.php?url=' . esc_url(get_the_permalink($import_data['post_id'])));
die(json_encode($results));
}
示例12: check_for_revisions
public function check_for_revisions()
{
global $wp_customize;
if (get_option('layers_init_revisions')) {
return;
}
// Get a list of the migrator
$get_layers_pages = layers_get_builder_pages(500);
if (empty($get_layers_pages)) {
return;
}
$revisions_exist = FALSE;
// Loop through the builder pages spooling up the widget data each time
foreach ($get_layers_pages as $page) {
if ('' !== get_post_meta($page->ID, '_layers_hash', true)) {
$revisions_exist = TRUE;
}
}
if (!$revisions_exist) {
add_filter('_wp_post_revision_fields', array($this, 'add_revision_fields'));
layers_backup_sidebars_widgets(TRUE);
add_option('layers_init_revisions', TRUE);
}
}