0

I've installed tablepress and created some tables as a database. I've created a new page for example with name DEMO. And the table name is also DEMO. I've inserted the table on that page since it displays the relevant information.

The problem is that, on the front page, I've integrated Search Box. When we put the page nsme DEMO in the search box and hit Search, it displays the results as posts or similar posts. I want it to display only that page in full using the exact page ID.

Please help, here is the search.php

<div id="primary" class="content-area">
    <div id="content" class="site-content" role="main">

    <?php if ( have_posts() ) : ?>

        <header class="page-header">
            <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentythirteen' ), get_search_query() ); ?></h1>
        </header>

        <?php /* The loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>

        <?php twentythirteen_paging_nav(); ?>

    <?php else : ?>
        <?php get_template_part( 'content', 'none' ); ?>
    <?php endif; ?>

    </div><!-- #content -->
</div><!-- #primary -->
  • Awww, thank you so much. I've replaced the_excerpt with the_content and now it's working great. Thank you again :) – Waseem Khan Feb 24 '15 at 11:35
  • One more last thing, I want to create a pop up, for example, when I put something in search box and hit SEARCH, it should display results in a popup. – Waseem Khan Feb 24 '15 at 11:40
  • For that you will need to handle your server request over ajax. I think this is a bit outside of the scope of this thread. There are loads of articles about this. Example: smashingmagazine.com/2011/10/18/how-to-use-ajax-in-wordpress – john23klipp Feb 24 '15 at 12:01
  • actually.. I guess you can also do that with some kind of lightwindow showing an iframe loaded results page. Not so elegant though.. – john23klipp Feb 24 '15 at 12:10
0

How will you know that the returned page / post is the one that the user is looking for? In any case, have a look at content-search.php (theme twentyfifteen). If you replace 'the_excerpt' with 'the_content', it will show you the full page.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.