• Hi,

    I’ve been trying to use an ajax livesearch plugin. So I made an local installation on WP 2.3 on a windows/apache/php/mysql platform. Everything is working just fine.

    But when I moved the wordpress to my hosting server, installing WP 2.3 and the same plugins, the livesearch stopped working.

    I tried with several different plugins and all returns no results when searching.

    Trying to debug the problem I managed to see a little bit of code that is not working right on my server, but it’s working fine on local machine.

    The code is like this:

    <?php $posts_per_page = 15; global $table_prefix; require('../../../wp-blog-header.php'); ?>
    <div class="LSRes"><?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    <div class="LSRow"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a>
    </div><?php } } else { ?>No Results<?php } ?>
    <div>
    <div class="LSRes"><a href="<?php bloginfo('url'); ?>/index.php?s=<?php echo wp_specialchars($s); ?>">More Results...</a></div>

    It’sa bit of piece from this plugin:
    https://www.cneophytou.com/2006/03/26/livesearch/

    The $posts is 0 when it should have data in it.

    Also I tried with this plugin:
    https://1stein.org/2007/09/11/live-search-popup/
    Where the code that actually makes the search is very similar with the previous one.

    <?php 
    
    $posts_per_page = 10;
    global $table_prefix;
    require('../../../wp-blog-header.php'); ?>
    
    <?php if ($_GET['s'] != '') {
    	if (count($posts) > 0) {
    		echo '<ul id="resultlist">';
    		foreach ($posts as $post) {
    			start_wp(); ?>
    			<li class="resultlistitem"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php
    		}
    		echo '</ul>';
    	} else {
    		echo '<p>No Results.</p>';
    	}
    }
    ?>

    Also, with this I get no results.

    I am not able to spot what would be the difference between the instalation on local and the one on the remote hosting server, both have the same plugins, the same posts…

    A little help please? ??
    Thank you!

  • The topic ‘Livesearch working on local but not online’ is closed to new replies.