Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $imgDimensions, $substrExcerpt, $itemCaption, $shortname, $paged, $wp_query;
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
- $pageInfo = get_post_meta($post->ID, 'max_show_gallery_info', true);
- // get the gallery name
- $taxonomy_name = get_post_meta($post->ID, 'max_select_gallery', true);
- // Test leading numeric title sort
- function my_post_sort($a,$b) {
- $akey = $a->post_title;
- if (preg_match('/^(\d+) /',$akey,$matches)) {
- $akey = sprintf('%010d ',$matches[0]) . $akey;
- }
- $bkey = $b->post_title;
- if (preg_match('/^(\d+) /',$bkey,$matches)) {
- $bkey = sprintf('%010d ',$matches[0]) . $bkey;
- }
- if ($akey == $bkey) {
- $cmp = 0;
- }
- $cmp = ($akey < $bkey) ? -1 : 1;
- print_r("akey:$akey bkey:$bkey cmp:$cmp<br />");
- return $cmp;
- }
- query_posts("post_type=gallery&".GALLERY_TAXONOMY."&posts_per_page=-1&caller_get_posts=1&orderby=title&order=ASC");
- if (have_posts()) {
- echo '<h2>Sorted by title</h2>';
- while (have_posts()) {
- the_post();
- the_title();echo "<br />";
- }
- rewind_query;
- echo '<br /><h2>After numeric sort</h2>';
- usort($wp_query->posts,'my_post_sort');
- while (have_posts()) {
- the_post();
- the_title();echo "<br />";
- }
- echo '<br /><br />';
- }
- ?>
- <ul id="portfolioList" class="clearfix portfolio-list">
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <li class="item <?php echo max_get_post_lightbox_class() ?>">
- <span class="shadow">
- <?php
- // get the gallery item
- max_get_post_custom_image();
- if($itemCaption === true) {
- // check if caption option is selected
- if ( get_option_max( 'image_show_caption' ) == 'true' ) {
- ?>
- <div class="item-caption">
- <strong><?php echo get_the_title() ?></strong><br />
- <?php
- // check if there is a excerpt
- if( max_get_the_excerpt() ){
- max_get_the_excerpt(true);
- }
- ?>
- </div>
- <?php
- }
- }
- ?>
- </span>
- </li>
- <?php endwhile; ?>
- <?php else : ?>
- <h2><?php _e('No Entries found','pictree') ?></h2>
- </ul>
- <?php
- /* Display navigation to next/previous pages when applicable */
- if (function_exists("max_pagination")) {
- max_pagination();
- }
- ?>
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement