WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Code inside not working when search.php doesnt find the word (3 posts)

  1. dionizioaf
    Member
    Posted 6 months ago #

    I'm developing a custom WordPress site, in Blog section i used the widget WordPress sidebar, and when a use search widget to find a word that exist in the site, it works fine, but when i search for a missing word in the site, the side breaks, all the stylesheet and JS dont get included. Any code inside the <head> loads, i insert a custom css inside the <head> to make a try but it didnt load either.

    <?php get_header(); ?>
    
            <div class="row" align="center" >
                <!-- Wrap the .navbar in .container to center it within the absolutely positioned parent. -->
                <div class="container"> <div style="height: 60px;width: 100%"></div>
                    <div style="width: 90%;text-align: left;margin-bottom: 100px;margin-top: 20px;" class="contentinfo">
    
    			<?php// if ( have_posts() ) : ?>
                                   <h1> Resultado da busca por: <?php echo $s; ?> </h1>
    
    				<?php while ( have_posts() ) : the_post(); ?>
                                                    <div class="span9" style="text-align: left;margin-top: 50px;">
                                                        <h1 style="font-size: 18.5px;"><?php the_title(); ?></h1>
                                                        <hr />
                                                        <div class="span2 post_thumb div-img-circle">
                                                            <a href="<?php the_permalink(); ?>">
                                                                <?php echo the_post_thumbnail(); ?>
                                                            </a>
                                                        </div>
                                                        <div class="span6" style="text-align: justify;">
                                                            <a href="<?php the_permalink(); ?>" style="text-decoration: none;">
    
                                                                <?php the_excerpt(); ?>
                                                            </a>
                                                            <div style="width: 100%;text-align: right">
                                                                <a href="<?php the_permalink(); ?>">Leia Mais</a>
                                                            </div>
                                                        </div>
                                                    </div>
                                    <?php endwhile;
    				//else :
                                    ?>
    <!--                                    <div class="span9" style="text-align: left;margin-top: 50px;">
                                            <h1 style="font-size: 18.5px;">Não encontramos nenhuma informação pela busca de: <?php echo $s; ?></h1>
                                        </div>-->
                                    <?php
    				//endif;
    			?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
            </div>        
    
    <?php
    get_footer();
  2. dionizioaf
    Member
    Posted 6 months ago #

    I Also remove the While leaving only

    <?php get_header(); ?>
    
            <div class="row" align="center" >
                <!-- Wrap the .navbar in .container to center it within the absolutely positioned parent. -->
                <div class="container"> <div style="height: 60px;width: 100%"></div>
                    <div style="width: 90%;text-align: left;margin-bottom: 100px;margin-top: 20px;" class="contentinfo">
    			<?php// if ( have_posts() ) : ?>
                                   <h1> Resultado da busca por: <?php echo $s; ?> </h1>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
            </div>        
    
    <?php
    get_footer();

    And still got the problem

  3. dionizioaf
    Member
    Posted 6 months ago #

    I could not solve the problem.
    I make a copy of twelve theme folder and copy the content of my custom files inside the same files in the new folder and it just work.

    Thanks anyway

Reply

You must log in to post.

About this Topic