I am creating a system in WP that I am showing the post ID next to the title, but when I do the search, it is not searching for the ID, which does not find any posts ... Does anyone know how to do for Wordpress search by ID too and not just by title?
<div class="container">
<?php if ( have_posts()) : ?>
<span class="tl-search">
<?php _e( 'Resultado de busca por: ', 'abc' ); ?><h1 class="tlt-prod"><?php the_search_query(); ?></h1>
</span>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<!-- <div id="nav-below" class="navigation">
<div class="nav-previous">
<?php next_posts_link(__( 'Próximo <span class="meta-nav">»</span>', 'contmatic')) ?></div>
<div class="nav-next">
<?php previous_posts_link(__( '<span class="meta-nav">«</span> Anterior', 'contmatic' )) ?></div>
</div> -->
<!– #nav-above –>
<?php } ?>
<?php while ( have_posts() ) : the_post() ?>
<div class="busca_search" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'abc'), the_title_attribute('echo=0') ); ?>" rel="bookmark">
<h2 class="entry-title">
<span class="id-post"> <?php the_ID(); ?> </span>
<span class="tl-post"> <?php the_title(); ?> </span>
</h2>
<?php if ( $post-> $ID == 'post' ) { ?>
<?php } ?>
<div class="entry-summary">
<?php the_excerpt( __( 'Continue lendo <span class="meta-nav">»</span>', 'contmatic' ) ); ?>
<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'contmatic' ) . '&after=</div>') ?>
</div>
<!– .entry-summary –>
<?php if ( $post->post_type == 'post' ) { ?>
<!– #entry-utility –>
<?php } ?>
</a>
</div>
<!-- <?php the_ID(); ?> -->
<?php endwhile; ?>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<div id="nav-below" class="navigation">
<div class="nav-next">
<?php previous_posts_link(__( '<span class="meta-nav">«</span> Anterior', 'contmatic' )) ?></div>
<div class="nav-previous">
<?php next_posts_link(__( 'Próximo <span class="meta-nav">»</span>', 'contmatic')) ?></div>
</div>
<!– #nav-below –>
<?php } ?>
<?php else : ?>
<div id="post-0" class="post no-results not-found">
<span class="tl-search">
<h1 class="tlt-prod">
<?php _e( 'Nada Encontrado', 'abc' ) ?>
</h1>
</span>
<div class="entry-content">
<p>
<?php _e( 'Desculpe, mas não encontramos nenhuma palavra com seu termo de busca. Por favor tente novamente.', 'abc' ); ?>
</p>
</div>
<!– .entry-content –>
</div>
<?php endif; ?>
</div>
Search is like this
<div class="conteudo-pesquisa">
<form role="search" method="get" class="formulario-pesquisa" action="<?php
echo home_url( '/' ); ?>">
<input type="search" class="input-pesquisa" placeholder="" value="<?php
echo get_search_query() ?>" name="s" required />
</form>
</div>