Exemple #1
0
 function axiom_post_get_stream_page_link($url, $page)
 {
     if (!empty($url)) {
         return $url;
     }
     if (in_array($page, array('blog', 'error', 'search', 'archives_day', 'archives_month', 'archives_year', 'category', 'tag', 'author', 'attachment', 'single'))) {
         //, 'page', 'home'
         $id = axiom_get_template_page_id('blog');
         if ($id) {
             $url = get_permalink($id);
         }
     }
     return $url;
 }
Exemple #2
0
 function axiom_query_add_posts_per_page($query)
 {
     if (is_admin() || !$query->is_main_query()) {
         return;
     }
     $orderby_set = true;
     $orderby = $order = $ppp = '';
     // Check template page settings
     if ($query->get('post_type') == 'product' || $query->get('product_cat') != '' || $query->get('product_tag') != '') {
         $orderby_set = false;
         $page_id = get_option('woocommerce_shop_page_id');
     } else {
         if ($query->is_archive()) {
             $page_id = axiom_get_template_page_id('archive');
         } else {
             if ($query->is_search()) {
                 $page_id = axiom_get_template_page_id('search');
                 if (axiom_get_theme_option('use_ajax_search') == 'yes') {
                     $show_types = axiom_get_theme_option('ajax_search_types');
                     if (!empty($show_types)) {
                         $query->set('post_type', explode(',', $show_types));
                     }
                 }
             } else {
                 if ($query->is_posts_page == 1) {
                     $page_id = isset($query->queried_object_id) ? $query->queried_object_id : axiom_get_template_page_id('blog');
                 } else {
                     $page_id = 0;
                 }
             }
         }
     }
     if ($page_id > 0) {
         $post_options = get_post_meta($page_id, 'post_custom_options', true);
         if (isset($post_options['posts_per_page']) && !empty($post_options['posts_per_page']) && !axiom_is_inherit_option($post_options['posts_per_page'])) {
             $ppp = (int) $post_options['posts_per_page'];
         }
         if ($orderby_set) {
             if (isset($post_options['blog_sort']) && !empty($post_options['blog_sort']) && !axiom_is_inherit_option($post_options['blog_sort'])) {
                 $orderby = $post_options['blog_sort'];
             }
             if (isset($post_options['blog_order']) && !empty($post_options['blog_order']) && !axiom_is_inherit_option($post_options['blog_order'])) {
                 $order = $post_options['blog_order'];
             }
         }
     }
     // Check taxonomy settings
     if (!empty($query->tax_query->queried_terms)) {
         foreach ($query->tax_query->queried_terms as $tax => $terms) {
             if (!empty($terms['terms'][0])) {
                 $term = $terms['terms'][0];
                 $tax_options = axiom_taxonomy_get_inherited_properties($tax, $term);
                 if (empty($ppp) && isset($tax_options['posts_per_page']) && !empty($tax_options['posts_per_page']) && !axiom_is_inherit_option($tax_options['posts_per_page'])) {
                     $ppp = (int) $tax_options['posts_per_page'];
                 }
                 if ($orderby_set) {
                     if (isset($tax_options['blog_sort']) && !empty($tax_options['blog_sort']) && !axiom_is_inherit_option($tax_options['blog_sort'])) {
                         $orderby = $tax_options['blog_sort'];
                     }
                     if (isset($tax_options['blog_order']) && !empty($tax_options['blog_order']) && !axiom_is_inherit_option($tax_options['blog_order'])) {
                         $order = $tax_options['blog_order'];
                     }
                 }
             }
             break;
         }
     }
     // Add parameters into query
     if (empty($ppp)) {
         $ppp = (int) axiom_get_theme_option('posts_per_page');
     }
     if ($ppp > 0) {
         $query->set('posts_per_page', $ppp);
     }
     if ($orderby_set) {
         if (empty($orderby)) {
             $orderby = axiom_get_theme_option('blog_sort');
         }
         if (empty($order)) {
             $order = axiom_get_theme_option('blog_order');
         }
         axiom_query_add_sort_order($query, $orderby, $order);
     }
     // Exclude categories
     $ex = axiom_get_theme_option('exclude_cats');
     if (!empty($ex)) {
         $query->set('category__not_in', explode(',', $ex));
     }
 }
Exemple #3
0
 function axiom_tribe_events_get_stream_page_id($id, $page)
 {
     if (!empty($id)) {
         return $id;
     }
     if (axiom_strpos($page, 'tribe') !== false) {
         $id = axiom_get_template_page_id('tribe-events/default-template');
     }
     return $id;
 }
Exemple #4
0
 function axiom_team_get_stream_page_link($url, $page)
 {
     if (!empty($url)) {
         return $url;
     }
     if (axiom_strpos($page, 'team') !== false) {
         $id = axiom_get_template_page_id('team');
         if ($id) {
             $url = get_permalink($id);
         }
     }
     return $url;
 }