Support » Theme: Stargazer » WP Search MU theme integration

  • Resolved Steve D


    In a typical theme, the loop in search.php is modified to swap in and swap out the sub-site url when building the search results. I having trouble integrating with this framework. Any pointers?

Viewing 1 replies (of 1 total)
  • Sorry if my topic seemed a little vague, but I “got’r done” – I was making it way too difficult.

    By creating a search.php from the stargazer index.php, I stripped out what was un-necessary and added the switch_to_blog and restore_current_blog statements. It worked like a charm.

    For future reference, the search.php looks like this:

    <?php get_header(); // Loads the header.php template. ?>
    <main <?php hybrid_attr( 'content' ); ?>>
    	<?php if ( have_posts() ) : // Checks if any posts were found. ?>
    		<?php while ( have_posts() ) : // Begins the loop through found posts. ?>
    			<?php switch_to_blog($post->blog_id); ?>
    			<?php the_post(); // Loads the post data. ?>
    			<?php hybrid_get_content_template(); // Loads the content/*.php template. ?>
    			<?php restore_current_blog(); ?>
    		<?php endwhile; // End found posts loop. ?>
    		<?php locate_template( array( 'misc/loop-nav.php' ), true ); // Loads the misc/loop-nav.php template. ?>
    	<?php else : // If no posts were found. ?>
    		<?php locate_template( array( 'content/error.php' ), true ); // Loads the content/error.php template. ?>
    	<?php endif; // End check for posts. ?>
    </main><!-- #content -->
    <?php get_footer(); // Loads the footer.php template. ?>

    This issue is resolved.

Viewing 1 replies (of 1 total)
  • The topic ‘WP Search MU theme integration’ is closed to new replies.