Exemple #1
0
    while (have_posts()) {
        the_post();
        // main loop
        ?>

		<h1><?php 
        the_title();
        ?>
</h1>
		<div class="hr hr-wide gap-big"></div>

		<div class="gallery">
		<?php 
        $opts = get_post_meta(get_the_ID(), '_dt_catalog_layout_options', true);
        $cats = get_post_meta(get_the_ID(), '_dt_catalog_layout_category', true);
        dt_category_list(array('post_type' => 'dt_catalog', 'taxonomy' => 'dt_catalog_category', 'select' => $cats['select'], 'layout' => '2_col-list', 'show' => 'on' == $opts['show_cat_filter'] ? true : false, 'layout_switcher' => false, 'terms' => isset($cats['catalog_cats']) ? $cats['catalog_cats'] : array()));
        ?>
 
        <div class="dt-ajax-content"></div>

		</div>

		<?php 
    }
}
// end main loop
?>

	</div>

	<?php 
        the_title();
        ?>
</h1>
        <div class="hr hr-wide gap-big"></div>

        <div class="gallery">

            <?php 
        if (!post_password_required()) {
            ?>
           
            <?php 
            global $post;
            $opts = get_post_meta($post->ID, '_dt_portfolio_layout_options', true);
            $cats = get_post_meta($post->ID, '_dt_portfolio_layout_category', true);
            dt_category_list(array('post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'select' => $cats['select'], 'layout' => $opts['layout'], 'layout_switcher' => 'on' == $opts['show_layout_swtch'] ? true : false, 'show' => 'on' == $opts['show_cat_filter'] ? true : false, 'terms' => isset($cats['portfolio_cats']) ? $cats['portfolio_cats'] : array()));
            ?>
            
            <div class="gallery-inner t-l dt-ajax-content"></div>

            <?php 
        } else {
            ?>
            
            <?php 
            echo get_the_password_form();
            ?>

            <?php 
        }
        ?>
            $args = array('post_type' => 'dt_gallery', 'taxonomy' => 'dt_gallery_category', 'select' => $cats['select'], 'layout' => $opts['layout'], 'count_attachments' => true, 'show' => 'on' == $opts['show_cat_filter'] ? true : false, 'layout_switcher' => false);
            $args['terms'] = array();
            if ('albums' == $cats['type'] && isset($cats['albums']) && 'all' != $cats['select']) {
                global $wpdb;
                $terms_str = implode(',', array_values($cats['albums']));
                $terms = $wpdb->get_results("\n\t\t\t\t\t\tSELECT {$wpdb->term_taxonomy}.term_id AS ID    \n\t\t\t\t\t\tFROM {$wpdb->posts}\n\t\t\t\t\t\tJOIN {$wpdb->term_relationships} ON {$wpdb->term_relationships}.object_id = {$wpdb->posts}.ID\n\t\t\t\t\t\tJOIN {$wpdb->term_taxonomy} ON {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id\n\t\t\t\t\t\tWHERE {$wpdb->posts}.post_type = 'dt_gallery'\n\t\t\t\t\t\tAND {$wpdb->posts}.post_status = 'publish'\n\t\t\t\t\t\tAND {$wpdb->posts}.ID IN ({$terms_str})\n\t\t\t\t\t\tGROUP BY {$wpdb->term_taxonomy}.term_id\n\t\t\t\t\t");
                if ($terms) {
                    foreach ($terms as $term) {
                        $args['terms'][] = intval($term->ID);
                    }
                }
                $args['post_ids'] = $cats['albums'];
            } elseif (isset($cats['albums_cats']) && 'all' != $cats['select']) {
                $args['terms'] = $cats['albums_cats'];
            }
            dt_category_list($args);
            ?>

				<div class="gallery-inner t-l dt-ajax-content"></div>

			<?php 
        } else {
            echo get_the_password_form();
        }
        ?>

        </div>

        <?php 
    }
}