Esempio n. 1
0
 function max_get_custom_prev_next($term_ids, $order_by = 'date', $order = 'DESC', $post_type = "gallery", $taxonomy = GALLERY_TAXONOMY)
 {
     global $post;
     // query all other posts from the current post categories
     $_nav_posts = max_query_term_posts(9999, $term_ids, $post_type, $order_by, $taxonomy, $order);
     foreach ($_nav_posts as $_index => $_value) {
         $_id_array[] = $_value->ID;
     }
     // prepare some values
     $_search_id = $post->ID;
     $_first_id = current($_id_array);
     $_last_id = $_id_array[sizeof($_id_array) - 1];
     $_current_key = array_search($_search_id, $_id_array);
     $_current_value = $_id_array[$_current_key];
     $_prev_id = "";
     $_next_id = "";
     // get next post_id
     if ($_search_id != $_last_id) {
         $_next_id = $_current_key + 1;
         $_next_value = $_id_array[$_next_id];
     }
     // get prev post_id
     if ($_search_id != $_first_id && !empty($_prev_id)) {
         $_prev_id = $_current_key - 1;
         $_prev_value = $_id_array[$_prev_id];
     }
     $_return_values = array('prev_id' => @$_prev_value, 'next_id' => @$_next_value);
     return $_return_values;
 }
Esempio n. 2
0
                        } else {
                            // Image url is set
                            $imgUrl = $imageURL;
                        }
                    }
                }
            }
        }
        ?>

			<?php 
        $img_output = "";
        // Get Background image for pages
        if ($show_page_fullsize == 'true' && !$isPost) {
            if ($_background_type == 'slideshow' && $random_post && !is_category() && !is_tax() && !is_archive() && !is_404() && !is_tag() && !is_search()) {
                $random_post = max_query_term_posts(-1, $_gallery_array, 'gallery', 'rand');
                if (have_posts()) {
                    while (have_posts()) {
                        the_post();
                        // Random image from featured homepage gallery
                        $imgUrl_temp = max_get_post_image_url(get_the_ID(), "full");
                        $imgUrl = $imgUrl_temp[0];
                        echo '<a class="item" href="' . $imgUrl . '"></a>';
                    }
                }
            } else {
                if ($imageURL == "") {
                    // Random image from featured homepage gallery
                    $imgUrl_temp = max_get_post_image_url($random_post[0]->ID, "full");
                    $imgUrl = $imgUrl_temp[0];
                } else {