• I have my custom search form.

    My problem is how to make my search form work? when I search any words on the website I created, nothing happens.

    Any body can teach me a step by step process to make my search form functioning? You can also give me a tutorial link about my problem.

    Thanks for those who may help me.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You would need to turn your search form into a plugin.

    Thread Starter verphiztual

    (@verphiztual)

    thanks for the idea…
    Actually my search form is working now.. I put this code in my search.php

    <?php if (have_posts()) { while (have_posts()) : the_post(); ?>
    <div>
    <h3><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?> from <?php echo get_post_type(); ?></a></h3>
    <?php the_excerpt(); ?>
    </div>
    <?php endwhile; } else { ?>
    <p><?php _e('Nothing found, what meets your criteria.', 'basis'); ?></p>
    <?php } ?>

    My only problem is my search result. I don’t want pages to include on my results. Just posts only.

    Then exclude them using the is_page() conditional.

    <?php if (have_posts()) { while (have_posts()) : the_post(); if( !is_page() ) :?>
    <div>
    <h3><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?> from <?php echo get_post_type(); ?></a></h3>
    <?php the_excerpt(); ?>
    </div>
    <?php endwhile; } else { endif;?>
    <p><?php _e('Nothing found, what meets your criteria.', 'basis'); ?></p>
    <?php } ?>
    Thread Starter verphiztual

    (@verphiztual)

    no success… there is an error to your code.. i tried to transfer the endif; before the endwhile; like this:
    <?php endif; endwhile; } else { ?>

    there is no error but the pages are still included… :[

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Search is not working.’ is closed to new replies.