Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php get_header(); ?>
- <div id="content" class="row-fluid">
- <div id="main" class="span8" role="main">
- <?php global $query_string;
- if (isset($_GET['index']) && $_GET['s']==='Index') { // search by index
- $char = $_GET['index'];
- if (strlen($char)===1 || strlen($char)===2 || preg_match('/^\p{L}+$/u', $char)) {
- $sql = "
- SELECT DISTINCT $wpdb->posts.*
- FROM $wpdb->posts, $wpdb->postmeta
- WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
- AND $wpdb->posts.post_title COLLATE UTF8_GENERAL_CI LIKE '$char%'
- AND $wpdb->posts.post_status = 'publish'
- AND $wpdb->posts.post_type = 'post'
- AND $wpdb->posts.post_date < NOW()
- ORDER BY $wpdb->posts.post_title DESC
- ";
- $search = $wpdb->get_results($sql, OBJECT);
- } else {
- echo 'Bad request!';
- die(0);
- }
- } else { // normal search
- }
- function this_loop() {
- ?>
- <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
- <!--header-->
- <h3 class="search-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
- <!--p class="search-meta"><?php _e("Posted", "wpinit"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_date(); ?></time> <?php _e("by", "wpinit"); ?> <?php the_author_posts_link(); ?> <?php _e("in category", "wpinit"); ?> <?php the_category(', '); ?>.</p-->
- <!--/header--><!-- // article header -->
- <!--footer>
- <p class="tags"><?php the_tags('<span class="tags-title">' . __("Tags","wpinit") . ':</span> ', ' ', ''); ?></p>
- </footer--><!-- / article footer -->
- </article><!-- // article -->
- <?
- }
- if (is_array($search) && count($search)!==0) {
- echo '
- <h1>Shëndeti nga A tek Zh</h1>
- <p>Zgjidhni nga indeksi alfabetik i artikujve të Doktori im për informacione rreth sëmundjeve dhe anomalive, testeve dhe studimeve, medikamente dhe trajtime.</p>
- ';
- foreach ($search as $post) {
- setup_postdata($post);
- this_loop();
- }
- } else {
- echo '<h1>Rezultati kërkimeve</h1>';
- if (function_exists('relevanssi_didyoumean')) { relevanssi_didyoumean(get_search_query(), "<p><br/>Mos ndoshta kishit parasysh: ", "</p> ", 5);
- }
- echo '<ul id="search-results-types">';
- global $rlv_search_result_cats;
- if (is_array($rlv_search_result_cats)) {
- foreach($rlv_search_result_cats as $key => $val) {
- $name = get_the_category_by_ID($key);
- echo '<li>';
- echo '<a href="'.esc_url( home_url( '/' ) ).'?s='.get_search_query().'&cats='.$key.'">';
- echo $name . ' (' . $val . ')';
- echo '</a>';
- echo '</li>';
- }
- echo '</ul>';
- }
- if (have_posts()) {
- while (have_posts()) {
- the_post();
- this_loop();
- }
- ?>
- <nav class="wp-prev-next">
- <div class="prev"><?php previous_posts_link('« Kthehu') ?></div>
- <div class="next"><?php next_posts_link('Rezultate të tjera »') ?></div>
- </nav>
- <?php } else { ?>
- <article id="post-not-found">
- <header>
- <h1><?php _e("", "wpinit"); ?></h1>
- </header>
- <section class="post_content">
- <p><?php _e("Me vjen keq, por informacioni i kerkuar nuk gjendet ne faqe!", "wpinit"); ?></p>
- <p><?php _e("Kerkesa juaj do te plotësohet nga ne. ", "wpinit"); ?></p>
- <p><?php _e("Faleminderit", "wpinit"); ?></p>
- </section>
- <footer>
- </footer>
- </article>
- <?php } } ?>
- </div><!-- // #main -->
- <div id="sidebar" class="span4">
- <?php get_sidebar(); ?>
- </div>
- </div><!-- // #content -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement