Esempio n. 1
0
 /**
  * Every thing that is "custom" to our CPT goes here.
  * @uses wp_localize_script()
  * @uses wp_register_style()
  * @uses wp_register_script()
  * @uses wp_enqueue_script()
  * @uses plugin_dir_url()
  * @uses admin_url()
  * @uses register_activation_hook()
  */
 public function __construct()
 {
     wp_localize_script('my-ajax-request', 'MyAjax', array('ajaxurl' => admin_url('admin-ajax.php')));
     self::$instance = $this;
     $this->dependencies['script'] = array('jquery', 'jquery-ui-core', 'jquery-ui-dialog');
     $this->dependencies['style'] = array('tt-base-style', 'inplace-edit-style');
     parent::__construct();
     add_action('init', array(&$this, 'registerPostType'));
     add_action('init', array(&$this, 'registerTaxonomy'));
     add_action('wp_footer', array(&$this, 'createPostTypeDiv'));
     add_action('wp_footer', array(&$this, 'createDeleteDiv'));
     register_activation_hook(__FILE__, array(&$this, 'registerActivation'));
     if (!is_admin()) {
         wp_register_style('tt-base-style', plugin_dir_url(__FILE__) . 'theme/css/style.css', '', 'all');
         wp_register_style('qtip-nightly-style', plugin_dir_url(__FILE__) . 'library/js/qtip-nightly/jquery.qtip.min.css', '', 'all');
         wp_register_style('inplace-edit-style', plugin_dir_url(__FILE__) . 'library/js/inplace-edit/inplace-edit.css', '', 'all');
         wp_register_script('tt-script', plugin_dir_url(__FILE__) . 'theme/js/script.js', $this->dependencies['script'], '1.0');
         wp_register_script('qtip-nightly', plugin_dir_url(__FILE__) . 'library/js/qtip-nightly/jquery.qtip.min.js', $this->dependencies['script'], '0.0.1');
         wp_register_script('jquery-ui-effects', plugin_dir_url(__FILE__) . 'library/js/jquery-ui/jquery-ui-1.8.13.effects.min.js', $this->dependencies['script'], '1.8.13');
         wp_register_script('inplace-edit-script', plugin_dir_url(__FILE__) . 'library/js/inplace-edit/inplace-edit.js', $this->dependencies['script'], '0.1');
         // We register then enqueue because we plan on moving the enqueue some where else later
         // where I don't know?
         wp_register_script('hash-script', plugin_dir_url(__FILE__) . 'theme/js/hash.js', array('jquery'), '1.0');
         wp_enqueue_script('hash-script');
         wp_register_script('cud-script', plugin_dir_url(__FILE__) . 'theme/js/cud.js', array('jquery'), '1.0');
         wp_enqueue_script('cud-script');
         wp_register_script('login-script', plugin_dir_url(__FILE__) . 'theme/js/login.js', array('jquery', 'tt-script'), '1.0');
         wp_enqueue_script('login-script');
     }
     $this->loginSetup();
 }
Esempio n. 2
0
 /**
  * __construct
  *
  * @param string $post_type
  * @param array $args
  */
 public function __construct($post_type = 'slide', $args = array())
 {
     $args = array('description' => __("Add sliders to the site carousel.", THEMENAME), 'exclude_from_search' => true, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => false, 'show_in_admin_bar' => true, 'supports' => array('title', 'editor', 'thumbnail'), 'rewrite' => false, 'query_var' => false, 'can_export' => true);
     parent::__construct($post_type, $args);
     self::add_link_metabox();
     // register shortcode to render the slider carousel
     add_shortcode('slider', array('PressGang\\Slider', 'do_shortcode'));
 }
Esempio n. 3
0
 /**
  * Render the carousel template
  *
  */
 public static function render($atts)
 {
     $atts = shortcode_atts(array('height' => 500, 'width' => 1140), $atts);
     // uniquely identify each slider on the page
     static $id = 0;
     $id++;
     // TODO enqueue bootstrap JS?
     $slides = array();
     foreach (parent::get_posts() as $slide) {
         $slide = new \TimberPost($slide);
         $slide->height = $atts['height'];
         $slide->width = $atts['width'];
         $slides[] = $slide;
     }
     $carousel['id'] = sprintf("%s-carousel-%s", self::$post_type, $id);
     $carousel['slides'] = $slides;
     if (count($slides)) {
         \Timber::render('carousel.twig', $carousel);
     }
 }
 public function register_fields()
 {
     parent::register_fields();
 }
 public function fields()
 {
     $fields = parent::fields();
     $fields[] = array('name' => __('URL'), 'desc' => __('Associate this document with a URL.  This will take precedence over any uploaded file, so leave empty if you want to use a file instead.'), 'id' => $this->options('name') . '_url', 'type' => 'text');
     $fields[] = array('name' => __('File'), 'desc' => __('Associate this document with an already existing file.'), 'id' => $this->options('name') . '_file', 'type' => 'file');
     return $fields;
 }
Esempio n. 6
0
 public function __construct()
 {
     // Register Home Page fields for front_page and posts_page only
     $homepage_metabox = array('id' => 'custom_homepage_fields', 'title' => 'Home Page Fields', 'fields' => $this->get_fields(array(array('id' => 'homepage_message', 'name' => __('Home Page Message'), 'description' => 'The message that will appear below the header image', 'type' => 'textarea', 'formatting' => 'html'), array('id' => 'homepage_spotlight', 'name' => __('Home Page Spotlight'), 'description' => 'The spotlight that will appear to the right of the home page message', 'type' => 'post_object', 'post_type' => array('spotlight')))), 'location' => array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'page', 'order_no' => 0, 'group_no' => 0), array('param' => 'page_type', 'operator' => '==', 'value' => 'front_page', 'order_no' => 1, 'group_no' => 0)), array(array('param' => 'page_type', 'operator' => '==', 'value' => 'posts_page', 'order_no' => 0, 'group_no' => 1))), 'options' => array('position' => 'acf_after_title'));
     $this->metaboxes[] = $homepage_metabox;
     // Build default post type meta fields
     parent::__construct();
 }
 /**
  * @return Make[]
  */
 public static function getAllMakes()
 {
     return parent::getAll(self::CUSTOM_POST_TYPE, __CLASS__);
 }
 public function get_objects($options = array())
 {
     $options['order'] = 'ASC';
     $options['orderby'] = 'person_orderby_name';
     $options['meta_key'] = 'person_orderby_name';
     return parent::get_objects($options);
 }