Exemplo n.º 1
0
function redirector()
{
    // Redirect 404 Errors
    if (is_404() || is_search() || is_archive()) {
        header("Location: " . URL . "");
    }
    $options = get_option('consultation_options');
    // Redirect Intro & Outro Categories
    if (is_category($options['cat_close']) || is_category($options['cat_open']) || is_category($options['cat_results'])) {
        header("Location: " . URL . "");
    }
    // Redirect Categories to Intro Posts
    if (is_category()) {
        $cur_cat_id = getCurrentCatID();
        //global $cnt;
        query_posts('cat=' . $options['cat_open']);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                global $post;
                if (in_category($cur_cat_id)) {
                    header("Location: " . URL . "/?p=" . $post->ID);
                }
            }
        }
        wp_reset_query();
    }
    if (!empty($_GET['ec'])) {
        exporter();
    }
}
 * the rest of the loop that is shared.
 *
 * Without further ado, the loop:
 */
?>
     
<?php 
function getCurrentCatID()
{
    global $wp_query;
    if (is_category() || is_single()) {
        $cat_ID = get_query_var('cat');
    }
    return $cat_ID;
}
$cat1 = getCurrentCatID();
?>

     <?php 
if (is_category()) {
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    query_posts(array('post_type' => array('photo', 'post'), 'paged' => $paged, 'cat' => $cat1));
}
while (have_posts()) {
    the_post();
    ?>

<?php 
    /* How to display posts of the Gallery format. The gallery category is the old way. */
    ?>