/**
  * Load a template.
  *
  * Handles template usage so that we can use our own templates instead of the themes.
  *
  * Templates are in the 'templates' folder. projects looks for theme
  * overrides in /theme/projects/ by default
  *
  * @access public
  * @param mixed $template
  * @return string
  */
 public function template_loader($template)
 {
     global $projects, $post;
     $find = array('projects.php');
     $file = '';
     if (is_single() && 'project' == get_post_type()) {
         $file = 'single-project.php';
         $find[] = $file;
         $find[] = $this->template_url . $file;
     } elseif (is_tax('project-category')) {
         $term = get_queried_object();
         $file = 'taxonomy-' . $term->taxonomy . '.php';
         $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
         $find[] = $this->template_url . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
         $find[] = $file;
         $find[] = $this->template_url . $file;
     } elseif (is_post_type_archive('project') || is_page(projects_get_page_id('projects'))) {
         $file = 'archive-project.php';
         $find[] = $file;
         $find[] = $this->template_url . $file;
     }
     if ($file) {
         $template = locate_template($find);
         if (!$template) {
             $template = $projects->plugin_path() . '/templates/' . $file;
         }
     }
     return $template;
 }
Beispiel #2
0
 /**
  * Register the post type.
  *
  * @access public
  * @return void
  */
 public function register_post_type()
 {
     $labels = array('name' => $this->plural_name, 'singular_name' => $this->singular_name, 'add_new' => _x('Add New', $this->post_type, 'projects-by-woothemes'), 'add_new_item' => sprintf(__('Add New %s', 'projects-by-woothemes'), $this->singular_name), 'edit_item' => sprintf(__('Edit %s', 'projects-by-woothemes'), $this->singular_name), 'new_item' => sprintf(__('New %s', 'projects-by-woothemes'), $this->singular_name), 'all_items' => sprintf(_x('All %s', $this->post_type, 'projects-by-woothemes'), $this->plural_name), 'view_item' => sprintf(__('View %s', 'projects-by-woothemes'), $this->singular_name), 'search_items' => sprintf(__('Search %a', 'projects-by-woothemes'), $this->plural_name), 'not_found' => sprintf(__('No %s Found', 'projects-by-woothemes'), $this->plural_name), 'not_found_in_trash' => sprintf(__('No %s Found In Trash', 'projects-by-woothemes'), $this->plural_name), 'parent_item_colon' => '', 'menu_name' => $this->plural_name);
     $args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => apply_filters('projects_post_type_rewrite', true), 'capability_type' => 'post', 'has_archive' => ($projects_page_id = projects_get_page_id('projects')) && get_page($projects_page_id) ? get_page_uri($projects_page_id) : 'projects', 'hierarchical' => false, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt'), 'menu_position' => 5, 'menu_icon' => 'dashicons-portfolio');
     $args = apply_filters('projects_register_post_type', $args);
     register_post_type($this->post_type, (array) $args);
 }
Beispiel #3
0
 /**
  * Show a projects page description on project archives
  *
  * Hooked into projects_archive_description
  *
  * @access public
  * @subpackage	Archives
  * @return void
  */
 function projects_project_archive_description()
 {
     if (is_post_type_archive('project') && get_query_var('paged') == 0 || is_page(projects_get_page_id('projects'))) {
         $projects_page = get_post(projects_get_page_id('projects'));
         $page_content = '';
         if (isset($projects_page->post_content)) {
             $page_content = $projects_page->post_content;
         }
         $description = apply_filters('the_content', $page_content);
         if ($description) {
             echo '<div class="page-description">' . $description . '</div>';
         }
     }
 }
 /**
  * Display an admin notice, if not on the settings screen and if projects page isn't set.
  * @access public
  * @since  1.0.0
  * @return void
  */
 public function configuration_admin_notice()
 {
     if (isset($_GET['page']) && 'projects-settings-page' == $_GET['page']) {
         return;
     }
     $projects_page = projects_get_page_id('projects');
     if (-1 == $projects_page) {
         $url = add_query_arg('post_type', 'project', admin_url('edit.php'));
         $url = add_query_arg('page', 'projects-settings-page', $url);
         echo '<div class="updated fade"><p>' . sprintf(__('%sProjects by WooThemes is almost ready.%s To get started, %sconfigure your projects page%s.', 'projects-by-woothemes'), '<strong>', '</strong>', '<a href="' . esc_url($url) . '">', '</a>') . '</p></div>' . "\n";
     }
 }
Beispiel #5
0
 /**
  * wpseo_metakey function.
  * Hooked into wpseo_ hook already, so no need for function_exist
  *
  * @access public
  * @return string
  */
 public function wpseo_metakey()
 {
     return WPSEO_Meta::get_value('metakey', projects_get_page_id('projects'));
 }
 /**
  * is_projects_archive - Returns true when viewing the project type archive.
  *
  * @access public
  * @return bool
  */
 function is_projects_archive()
 {
     return is_post_type_archive('project') || is_project_taxonomy() || is_page(projects_get_page_id('projects')) ? true : false;
 }
 /**
  * Return an array of default arguments.
  * @access  private
  * @since   1.0.0
  * @return  array Default arguments.
  */
 private function _get_default_args()
 {
     return array('labels' => $this->_get_default_labels(), 'public' => true, 'hierarchical' => true, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false, 'rewrite' => array('slug' => ($projects_page_id = projects_get_page_id('projects')) && get_page($projects_page_id) ? get_page_uri($projects_page_id) : 'projects', 'with_front' => false));
 }