Advertisement
Guest User

Untitled

a guest
Sep 29th, 2011
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. <?php
  2.  
  3. global $imgDimensions, $substrExcerpt, $itemCaption, $shortname, $paged, $wp_query;
  4.  
  5. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  6.  
  7. $pageInfo = get_post_meta($post->ID, 'max_show_gallery_info', true);
  8.  
  9. // get the gallery name
  10. $taxonomy_name = get_post_meta($post->ID, 'max_select_gallery', true);
  11.  
  12. // Test leading numeric title sort
  13.  
  14. function my_post_sort($a,$b) {
  15. $akey = $a->post_title;
  16. if (preg_match('/^(\d+) /',$akey,$matches)) {
  17. $akey = sprintf('%010d ',$matches[0]) . $akey;
  18. }
  19. $bkey = $b->post_title;
  20. if (preg_match('/^(\d+) /',$bkey,$matches)) {
  21. $bkey = sprintf('%010d ',$matches[0]) . $bkey;
  22. }
  23. if ($akey == $bkey) {
  24. $cmp = 0;
  25. }
  26. $cmp = ($akey < $bkey) ? -1 : 1;
  27. print_r("akey:$akey bkey:$bkey cmp:$cmp<br />");
  28. return $cmp;
  29.  
  30. }
  31.  
  32. query_posts("post_type=gallery&".GALLERY_TAXONOMY."&posts_per_page=-1&caller_get_posts=1&orderby=title&order=ASC");
  33. if (have_posts()) {
  34. echo '<h2>Sorted by title</h2>';
  35. while (have_posts()) {
  36. the_post();
  37. the_title();echo "<br />";
  38. }
  39. rewind_query;
  40. echo '<br /><h2>After numeric sort</h2>';
  41. usort($wp_query->posts,'my_post_sort');
  42. while (have_posts()) {
  43. the_post();
  44. the_title();echo "<br />";
  45. }
  46. echo '<br /><br />';
  47. }
  48.  
  49. ?>
  50. <ul id="portfolioList" class="clearfix portfolio-list">
  51.  
  52.  
  53. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  54.  
  55.  
  56.  
  57.  
  58. <li class="item <?php echo max_get_post_lightbox_class() ?>">
  59.  
  60.  
  61.  
  62. <span class="shadow">
  63. <?php
  64.  
  65. // get the gallery item
  66. max_get_post_custom_image();
  67.  
  68. if($itemCaption === true) {
  69.  
  70. // check if caption option is selected
  71. if ( get_option_max( 'image_show_caption' ) == 'true' ) {
  72.  
  73. ?>
  74.  
  75. <div class="item-caption">
  76. <strong><?php echo get_the_title() ?></strong><br />
  77. <?php
  78. // check if there is a excerpt
  79. if( max_get_the_excerpt() ){
  80. max_get_the_excerpt(true);
  81. }
  82. ?>
  83. </div>
  84.  
  85. <?php
  86. }
  87. }
  88.  
  89. ?>
  90. </span>
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97. </li>
  98.  
  99.  
  100.  
  101. <?php endwhile; ?>
  102.  
  103. <?php else : ?>
  104.  
  105. <h2><?php _e('No Entries found','pictree') ?></h2>
  106.  
  107.  
  108.  
  109. </ul>
  110.  
  111. <?php
  112.  
  113. /* Display navigation to next/previous pages when applicable */
  114. if (function_exists("max_pagination")) {
  115.  
  116. max_pagination();
  117.  
  118. }
  119.  
  120. ?>
  121. <?php endif; ?>
  122.  
  123.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement