WordPress.org

Ready to get started?Download WordPress

Forums

Search.php problem; blank page (6 posts)

  1. stijlvollemannen
    Member
    Posted 3 years ago #

    I didn't change anything to the code, except for some translations... However the search isn't working and I have no idea what the issue is.

    Can anyone help?

    My website: http://stijlvollemannen.nl

    <?php require(TEMPLATEPATH . '/content-before.php'); ?>
    
        <div id="content">
    
            <?php $theme->hook('content_before'); ?>
    
        	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                    <h2 class="generic"><?php _e( 'Zoekresultaten voor:', 'flexithemes' ); ?> <?php echo get_search_query(); ?></h2>
                    <?php
                    $layout_options_prefix = 'search';
                    require(TEMPLATEPATH . '/loop.php');
                }  else {
                    ?>
                    <h2 class="generic"><?php _e( 'Niets gevonden', 'flexithemes' ); ?></h2>
                    <div class="entry">
                        <?php printf( __( 'Sorry, je zoekopdracht gaf geen resultaat: %s. Probeer het opnieuw met een andere zoekopdracht.', 'flexithemes' ), '<strong>' . get_search_query() . '</strong>' ); ?>
                    </div>
                    <div id="searchwrap">
                        <?php get_search_form(); ?>
                    </div>
                    <?php
                }
            ?>
    
            <?php $theme->hook('content_after'); ?>
    
        </div> <!--/content--> 
    
    <?php require(TEMPLATEPATH . '/content-after.php'); ?>
  2. dremeda
    Sucuri Wizard
    Posted 3 years ago #

    Hi,

    Do you have a searchform.php in your theme?

  3. stijlvollemannen
    Member
    Posted 3 years ago #

    Yes, I do...

    <?php $search_text = empty($_GET['s']) ? __('Zoeken') : get_search_query(); ?>
    <div id="search">
        <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
            <input type="text" value="<?php echo $search_text; ?>"
                name="s" id="s"  onblur="if (this.value == '')  {this.value = '<?php echo $search_text; ?>';}"
                onfocus="if (this.value == '<?php echo $search_text; ?>') {this.value = '';}" />
            <input type="image" src="<?php bloginfo('template_url'); ?>/images/search.png" title="<?php _e('Search'); ?>" class="search-image" />
        </form>
    </div>
  4. stijlvollemannen
    Member
    Posted 3 years ago #

    Totally clueless what to do here....

  5. stijlvollemannen
    Member
    Posted 3 years ago #

    I've deactivated All Categories SEO and this gave an error when searching;

    Parse error: syntax error, unexpected '}' in /home/content/03/7140503/html/wp-content/themes/Vega/search.php on line 12

    This is the code for search.php; what to do where?

    <?php require(TEMPLATEPATH . '/content-before.php'); ?>
    
        <div id="content">
    
            <?php $theme->hook('content_before'); ?>
    
        	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                    <h2 class="generic"><?php _e( 'Zoekresultaten voor:', 'flexithemes' ); ?> <?php echo get_search_query(); ?></h2>
                    <?php
                    $layout_options_prefix = 'search';
                    require(TEMPLATEPATH . '/loop.php');
                }  else {
                    ?>
                    <h2 class="generic"><?php _e( 'Niets gevonden', 'flexithemes' ); ?></h2>
                    <div class="entry">
                        <?php printf( __( 'Sorry, je zoekopdracht gaf geen resultaat: %s. Probeer het opnieuw met een andere zoekopdracht.', 'flexithemes' ), '<strong>' . get_search_query() . '</strong>' ); ?>
                    </div>
                    <div id="searchwrap">
                        <?php get_search_form(); ?>
                    </div>
                    <?php
                }
            ?>
    
            <?php $theme->hook('content_after'); ?>
    
        </div> <!--/content--> 
    
    <?php require(TEMPLATEPATH . '/content-after.php'); ?>
  6. Cirkut
    Member
    Posted 3 years ago #

    I know this is a late answer, but your loop involves a colon and brackets, which do not mix. After while ( have_posts() ), you should use a { instead of a colon. The code should then stop producing an error.

    I post this in case anyone else stumbles upon this question like I did.

Topic Closed

This topic has been closed to new replies.

About this Topic