Supporto » Sviluppare con WordPress » problema nel file searchform.php

  • Salve, ho questo codice nella searchform.php

    <form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
      <div class="input-group">
        <input type="text" class="search-field form-control" placeholder="<?php echo esc_attr_x( 'Inserisci qui cosa vuoi cercare!', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" aria-describedby="search-form">
          <span class="input-group-btn">
            <button type="submit" class="btn btn-danger" id="search-form"><?php echo esc_attr_x( 'Search', 'submit button' ) ?>
            </button>
          </span>
      </div>
    </form>

    Se provo ad digitare qualcosa.. tipo : “Eccoci” che è una notizia che ho scritto .. la pagina search.php non mi mostra nulla e non da nessun errore.

    <?php
    get_header();
    ?>
    <div class="container">
      <div class="row">
        <div class="col-sm-8 col-md-8">
          <?php if (have_posts()): ?>
            <h1><?php printf( esc_html__( 'Search results for { %s }', 'luigiamorfini' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
            <?php
            if ( have_posts() ) :
              while ( have_posts() ) :
                the_post();
                get_template_part( 'template_parts/content', get_post_format() );
              endwhile;
              ?>
               <?php my_pagination(); ?>
              <?php
              else :
                get_template_part( 'template_parts/content', 'none' );
              endif;
              ?>
            <?php else: ?>
              <?php get_search_form(); ?>
            <?php endif; ?>
          </div>
          <div class="col-sm-4 col-md-4">
            <?php get_sidebar(); ?>
          </div>
        </div>
      </div>
      <?php get_footer(); ?>
    

    Il tema è mio .. me lo sto realizzando ho tutto finito ma mi è capitato questo problema all’ultimo. Mi dite come posso risolvere.

    Nell functions.php ho queste regole:

    add_theme_support( 'post-formats', array( 'status','quote','gallery','image','video','audio','link','aside','chat' ,'search' ) );
    	add_theme_support( 'html5', array( 'comment-list','comment-form','search-form','gallery','caption' ) );
    	

    Avete idea cosa può essere. ?

    Utilizzo wordpress 5.0.2 italiano.

    Aspetto risposte.

  • Il topic ‘problema nel file searchform.php’ è chiuso a nuove risposte.