Exemplo n.º 1
0
 public function __construct($filename = null)
 {
     $this->template_file = $filename;
     $this->layout = new \Dovetail\Core\Layout();
     if (is_Admin()) {
         /**
          * If we are actually editing the page this template belongs to. 
          */
         if ($this->template_file !== null && get_page_template($this->template_file) == get_page_template()) {
             // Remove Editor
             add_action('admin_init', array($this, 'remove_editor'));
             // Add Layout builder
             add_action('edit_form_after_title', array($this, 'layout_builder'));
             // Layout builder enquue
             add_action('admin_enqueue_scripts', array($this, 'layout_scripts'));
             add_action('admin_print_scripts', array($this, 'layout_print_scripts'));
         }
     } else {
         // Filters
         add_filter('wp_title', array($this, 'wp_title'), 10, 2);
         // Add a more descriptive title
         // Render this page
         $this->render();
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $this->theme = wp_get_theme();
     if (is_Admin()) {
         $this->load_templates();
     } else {
     }
 }
function wp_charts_load_scripts()
{
    if (!is_Admin()) {
        // WP Scripts
        wp_enqueue_script('jquery');
        // Register plugin Scripts
        wp_register_script('charts-js', plugins_url('/js/Chart.min.js', __FILE__));
        wp_register_script('wp-chart-functions', plugins_url('/js/functions.js', __FILE__), 'jquery', '', true);
        // Enqeue those suckers
        wp_enqueue_script('charts-js');
        wp_enqueue_script('wp-chart-functions');
    }
}