PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/blog/wp-content/themes/redoable-lite/searchloop.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 173 lines | 123 code | 37 blank | 13 comment | 40 complexity | 84f7f2d491c81301ef43b5b61a401812 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. // This is the loop, which fetches entries from your database.
  3. // It is a very delicate piece of machinery. Be gentle!
  4. // This copy of the loop is specifgically for the search results.
  5. // Get core WP functions when loaded dynamically
  6. if (isset($_GET['rolling'])) {
  7. require (dirname(__FILE__).'/../../../wp-blog-header.php');
  8. }
  9. // Get the asides category
  10. $redo_asidescategory = 0;
  11. ?>
  12. <?php /* Headlines for archives */ if ((!is_single() and !is_home()) or is_paged()) { ?>
  13. <h2>
  14. <?php // Figure out what kind of page is being shown
  15. if (is_category()) {
  16. if ($cat != $redo_asidescategory) { printf(__('Archive for the \'%s\' Category','redo_domain'), single_cat_title('', false)); }
  17. else { single_cat_title(); } }
  18. elseif (is_day()) { printf(__('Archive for %s','redo_domain'), get_the_time(__('F jS, Y','redo_domain'))); }
  19. elseif (is_month()) { printf(__('Archive for %s','redo_domain'), get_the_time(__('F, Y','redo_domain'))); }
  20. elseif (is_year()) { printf(__('Archive for %s','redo_domain'), get_the_time(__('Y','redo_domain'))); }
  21. elseif (is_search()) { printf(__('Search Results for \'%s\'','redo_domain'), get_search_query()); }
  22. elseif (function_exists('is_tag') and is_tag()) { printf(__('Tag Archive for \'%s\'','redo_domain'), get_query_var('tag') ); }
  23. elseif (is_author()) {
  24. $post = $wp_query->post;
  25. $author = get_userdata( $post->post_author );
  26. printf(__('Author Archive for %s','redo_domain'), $author->first_name . ' ' . $author->last_name ); }
  27. elseif (is_paged() and ($paged > 1)) { printf(__('Archive Page %s','redo_domain'), $paged ); }
  28. ?>
  29. </h2>
  30. <?php } ?>
  31. <?php if (!is_single() and !is_home() and is_paged()) include (TEMPLATEPATH . '/navigation.php'); ?>
  32. <?php /* Check if there are posts */
  33. if ( have_posts() ) {
  34. /* It saves time to only perform the following if there are posts to show */
  35. // If there are 2+ users, this is a multiple-user blog
  36. // Alex: assume yes
  37. $multiple_users = true;
  38. // Get the user information
  39. get_currentuserinfo();
  40. global $user_level;
  41. // Post index for semantic classes
  42. $post_index = 1;
  43. // Check if to display asides inline or not
  44. if(is_archive() or is_search() or is_single() or (function_exists('is_tag') and is_tag())) {
  45. $redo_asidescheck = '0';
  46. } else {
  47. $redo_asidescheck = get_option('redo_asidesposition');
  48. }
  49. ?>
  50. <?php /* Start the loop */
  51. while ( have_posts() ) {
  52. the_post();
  53. // Post is an aside
  54. $post_asides = in_category($redo_asidescategory);
  55. ?>
  56. <?php /* Display only titles and date for sidebar search results */ if (get_option('redo_livesearchposition') == 0 and is_search()) { ?>
  57. <p class="entry-title"><span class="published_tiny"><?php echo get_the_time('d/m','redo_domain'); ?></span><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php echo esc_attr( sprintf( __( 'Permanent link to %s', 'redo_domain' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?></a></p>
  58. <?php } else { ?>
  59. <!-- Added to display wp-recent-links plugin -->
  60. <?php
  61. if( 'link' == $post->rp_entry_type && !is_single() ) {
  62. if ($link_counter == 0) { ?>
  63. <div class="lentry <?php if ( is_home() and $redo_asidescategory != 0 ) { echo 'rightmargin'; } ?>">
  64. <?php } // recent links open ?>
  65. <div class="published_link"><?php echo date('d/m', strtotime($post->date_added)) ?></div>
  66. <div id="link-<?php the_ID(); ?>" class="link-title">
  67. <a href="<?php echo $post->link_url; ?>"><?php echo wptexturize($post->link_text); ?></a>
  68. <?php if ('' != $post->link_caption) { ?>&#8594;
  69. <?php echo wptexturize(convert_smilies($post->link_caption)); ?><?php } ?>
  70. </div>
  71. <?php $link_counter++; ?>
  72. <?php if( function_exists('rewind_post_count') ) {
  73. rewind_post_count();
  74. }?>
  75. <?php } else {
  76. /* Standard Entries */
  77. if ($link_counter > 0) { $link_counter = 0; ?>
  78. <div class="link-header">LINK LOG</div>
  79. </div>
  80. <?php } // recent links close ?>
  81. <!-- end add for wp-recent-links plugin -->
  82. <?php /* Only display asides if sidebar asides are not active */ if(!$post_asides || $redo_asidescheck == '0') { ?>
  83. <div id="post-<?php the_ID(); ?>" class="<?php redo_post_class($post_index++, $post_asides); ?> <?php if ( is_home() and $redo_asidescategory != 0 ) { echo 'rightmargin'; } ?> ">
  84. <div class="entry-head">
  85. <?php printf( __('%1$s','redo_domain'),
  86. '<div class="published_sm" title="'. get_the_time('Y-m-d\TH:i:sO') . '">' .
  87. ( function_exists('time_since') ? sprintf(__('%s ago','redo_domain'), time_since(abs(strtotime($post->post_date_gmt . " GMT")), time())) : ( '<div class="day">' . get_the_time(__('d','redo_domain')) . '</div><div class="month">' . get_the_time(__('M','redo_domain')) . '</div>' ) )
  88. . '</div>'
  89. ); ?>
  90. <h3 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php echo esc_attr( sprintf( __( 'Permanent link to %s', 'redo_domain' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php the_title(); ?></a></h3>
  91. <?php /* Edit Link */ edit_post_link(__('Edit','redo_domain'), '<span class="editLink">','</span>'); ?>
  92. <div class="entry-meta">
  93. <div class="meta-row">
  94. <?php /* Date & Author */
  95. printf( __('%1$s','redo_domain'), sprintf(__('<span class="authordata">By %s</span>','redo_domain'), '<span class="vcard author"><a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) .'" class="url fn">' . get_the_author() . '</a></span>') );
  96. ?>
  97. <?php /* Comments */ comments_popup_link(__('Leave a&nbsp;').'<span>'.__('Comments','redo_domain').'</span>', '1&nbsp;<span>'.__('Comment','redo_domain').'</span>', '%&nbsp;<span>'.__('Comments','redo_domain').'</span>', 'commentslink', '<span>'.__('Closed','redo_domain').'</span>'); ?>
  98. </div>
  99. <div class="meta-row">
  100. <?php /* Categories */ printf(__('<span class="entry-category">Categories: %s</span>','redo_domain'), redo_nice_category(', ', ' '.__('and','redo_domain').' ') ); ?>
  101. </div>
  102. </div> <!-- .entry-meta -->
  103. </div> <!-- .entry-head -->
  104. <div class="entry-content">
  105. <?php if (is_search()) {
  106. the_excerpt();
  107. } else {
  108. the_content(__('Continue reading','redo_domain') . " '" . the_title('', '', false) . "'");
  109. } ?>
  110. <?php if( get_bloginfo('version') < 2.1 ) { ?>
  111. <?php link_pages('<p><strong>'.__('Pages:','redo_domain').'</strong> ', '</p>','number'); ?>
  112. <?php } else { ?>
  113. <?php wp_link_pages('before=<p><strong>'.__('Pages:','redo_domain').'</strong>&after=</p>&next_or_number=number')?>
  114. <?php } ?>
  115. </div> <!-- .entry-content -->
  116. </div> <!-- #post-ID -->
  117. <?php } /* End sidebar asides test */ ?>
  118. <?php } /* end sidebar search test*/ ?>
  119. <?php } // close if() for entry types ?> <!-- added for wp-recent-links plugin -->
  120. <?php } /* End The Loop */ ?>
  121. <!-- added for wp-recent-links plugin -->
  122. <?php if ($link_counter > 0) { $link_counter = 0; ?>
  123. </ul>
  124. <?php } // recent links close </ul> ?>
  125. <!-- end add -->
  126. <?php /* Insert Paged Navigation */ if (!is_single()) { include(TEMPLATEPATH . '/navigation.php'); } ?>
  127. <?php /* If there is nothing to loop */ } else { $notfound = '1'; ?>
  128. <div class="hentry four04">
  129. <div class="entry-head">
  130. <h3 class="center"><?php _e('Not Found','redo_domain'); ?></h2>
  131. </div>
  132. <div class="entry-content">
  133. <p><?php _e('Oh no! You\'re looking for something which just isn\'t here! Fear not however, errors are to be expected, and luckily there are tools on the sidebar for you to use in your search for what you need.','redo_domain'); ?></p>
  134. </div>
  135. </div> <!-- .hentry .four04 -->
  136. <?php } /* End Loop Init */ ?>