• 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: https://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'); ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    Do you have a searchform.php in your theme?

    Thread Starter stijlvollemannen

    (@stijlvollemannen)

    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>

    Thread Starter stijlvollemannen

    (@stijlvollemannen)

    Totally clueless what to do here….

    Thread Starter stijlvollemannen

    (@stijlvollemannen)

    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'); ?>

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search.php problem; blank page’ is closed to new replies.