/**
  *
  * @since version 1.0
  * @param $template - return based on view
  * @return page template based on view regardless if the post type doesnt even exist yet due to no posts
  */
 function template_loader($template)
 {
     $disable_archive = idea_factory_get_option('if_disable_archive', 'if_settings_advanced');
     if (idea_factory_is_archive() && 'on' !== $disable_archive) {
         if ($overridden_template = locate_template('template-ideas.php', true)) {
             $template = load_template($overridden_template);
         } else {
             $template = IDEA_FACTORY_DIR . 'templates/template-ideas.php';
         }
     }
     return $template;
 }
Esempio n. 2
0
 function scripts()
 {
     global $wp_query, $post;
     $disable_css = idea_factory_get_option('if_disable_css', 'if_settings_advanced');
     $max = $wp_query->max_num_pages;
     $paged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
     if (idea_factory_is_archive() || has_shortcode(isset($post->post_content) ? $post->post_content : null, 'idea_factory')) {
         if ('on' !== $disable_css) {
             wp_enqueue_style('dashicons');
             wp_enqueue_style('idea-factory-css', IDEA_FACTORY_URL . '/public/assets/css/idea-factory.css', IDEA_FACTORY_VERSION, true);
         }
         wp_enqueue_script('idea-factory-script', IDEA_FACTORY_URL . '/public/assets/js/idea-factory.js', array('jquery'), IDEA_FACTORY_VERSION, true);
         wp_localize_script('idea-factory-script', 'idea_factory', idea_factory_localized_args($max, $paged));
     }
 }