function page_attributes_meta_box($post) { global $pl_custom_template; $post_type_object = get_post_type_object($post->post_type); ///// CUSTOM PAGE TEMPLATE STUFF ///// $options = '<option value="">Select Template</option>'; $set = pl_meta($post->ID, PL_SETTINGS); $current = is_array($set) && isset($set['live']['custom-map']['template']['ctemplate']) ? $set['live']['custom-map']['template']['ctemplate'] : ''; $custom_template_handler = new PLCustomTemplates(); foreach ($custom_template_handler->get_all() as $index => $t) { $sel = ''; $sel = $current === $index ? 'selected' : ''; $options .= sprintf('<option value="%s" %s>%s</option>', $index, $sel, $t['name']); } printf('<p><strong>%1$s</strong></p>', __('Load PageLines Template', 'pagelines')); printf('<select name="pagelines_template" id="pagelines_template">%s</select>', $options); ///// END TEMPLATE STUFF ///// if ($post_type_object->hierarchical) { $dropdown_args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)', 'pagelines'), 'sort_column' => 'menu_order, post_title', 'echo' => 0); $dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post); $pages = wp_dropdown_pages($dropdown_args); if (!empty($pages)) { printf('<p><strong>%1$s</strong></p>', __('Parent Page', 'pagelines')); echo $pages; } } printf('<p><strong>%1$s</strong></p>', __('Page Order', 'pagelines')); printf('<input name="menu_order" type="text" size="4" id="menu_order" value="%s" /></p>', esc_attr($post->menu_order)); }
function pl_custom_bulk_admin_footer() { global $post_type; $custom_template_handler = new PLCustomTemplates(); if ($post_type == 'page' || $post_type == 'post') { $templates = $custom_template_handler->get_all(); ob_start(); ?> <select class="pl-template-selecter"> <?php printf('<option class="pl-template-select" value="none">%s</option>', __('Select a PageLines Template', 'pagelines')); printf('<option class="pl-template-select" value="none">%s</option>', __('Unset Current Template', 'pagelines')); foreach ($custom_template_handler->get_all() as $index => $t) { printf('<option class="pl-template-select" data-nicename="%s" value="%s">%s</option>', $t['name'], $index, $t['name']); } ?> </select> <?php $select = str_replace("\n", '', ob_get_clean()); ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('<option>').val('pl-template').text('<?php _e('Apply Template', 'pagelines'); ?> ').appendTo("select[name='action']"); jQuery('<option>').val('pl-template').text('<?php _e('Apply Template', 'pagelines'); ?> ').appendTo("select[name='action2']"); jQuery('<input type="hidden" class="selected-template" name="selected-template" value="none" />').appendTo( '#posts-filter') jQuery('<input type="hidden" class="selected-template-name" name="selected-template-name" value="none" />').appendTo( '#posts-filter') jQuery('<input type="hidden" class="pl-post-type" name="pl-post-type" value="<?php echo $post_type; ?> " />').appendTo( '#posts-filter') }); jQuery('.bulkactions').after('<?php echo $select; ?> ') jQuery( '.pl-template-selecter').each( function(e) { jQuery(this).on('change', function() { var sel = jQuery(this).val() var name = jQuery('option:selected', this).attr('data-nicename'); jQuery('.selected-template').val(sel) jQuery('.selected-template-name').val(name) }) }) </script> <?php } }
function export_template() { ob_start(); $tpls = new PLCustomTemplates(); ?> <label><?php _e('Select User Templates', 'pagelines'); ?> </label> <?php $btns = sprintf('<div class="checklist-btns"> <button class="btn btn-mini checklist-tool" data-action="checkall"><i class="icon icon-ok"></i> %s</button> <button class="btn btn-mini checklist-tool" data-action="uncheckall"><i class="icon icon-remove"></i> %s</button> </div>', __('Select All', 'pagelines'), __('Deselect All', 'pagelines')); $tpl_selects = ''; foreach ($tpls->get_all() as $index => $template) { $tpl_selects .= sprintf('<label class="checklist-label media" for="%s"> <div class="img"><input name="templates[]%s" id="%s" type="checkbox" checked /></div> <div class="bd"><div class="ttl">%s</div><p>%s</p></div> </label>', $index, $index, $index, $template['name'], $template['desc']); } printf('<fieldset>%s%s</fieldset>', $btns, $tpl_selects); ?> <label><?php _e('Global Settings', 'pagelines'); ?> </label> <label class="checklist-label media" for="export_global" name="export_global"> <div class="img"><input name="export_global" id="export_global" type="checkbox" checked /></div> <div class="bd"> <div class="ttl"><?php _e('Export Site Global Settings', 'pagelines'); ?> </div> <p><?php _e('This will export your sites global settings. This includes everything in the options panel, as well as settings directed at sections in your "global" regions like your header and footer.', 'pagelines'); ?> </p> </div> </label> <label><?php _e('Post Type Settings', 'pagelines'); ?> </label> <label class="checklist-label media" for="export_types"> <div class="img"><input name="export_types" id="export_types" type="checkbox" checked /></div> <div class="bd"> <div class="ttl"><?php _e('Export Post Type Settings', 'pagelines'); ?> </div> <p><?php _e('This exports settings such as the template defaults for various post types.', 'pagelines'); ?> </p> </div> </label> <label><?php _e('Theme Config Publishing', 'pagelines'); ?> </label> <?php $publish_active = is_child_theme() || pl_less_dev() ? true : false; ?> <label class="checklist-label media <?php echo !$publish_active ? 'disabled' : ''; ?> " for="publish_config"> <div class="img"><input id="publish_config" name="publish_config" type="checkbox" <?php echo !$publish_active ? 'disabled="disabled"' : ''; ?> /></div> <div class="bd"> <div class="ttl"><?php echo !$publish_active ? __('(Disabled! No child theme active)', 'pagelines') : ''; ?> <?php _e('Publish Configuration to Child Theme (No Download File)', 'pagelines'); ?> </div> <p><?php _e('Check this to publish your site configuration as a theme configuration file in your themes root directory. When a user activates your theme it will ask if it can overwrite their settings to attain a desired initial experience to the theme.', 'pagelines'); ?> </p> </div> </label> <div class="center publish-button"> <button class="btn btn-primary btn-large settings-action" data-action="opt_dump"><?php _e('Publish', 'pagelines'); ?> <span class="spamp">&</span> <?php _e('Download DMS Config', 'pagelines'); ?> </button> </div> <?php return ob_get_clean(); }