Title: Loki180's Replies | WordPress.org

---

# Loki180

  [  ](https://wordpress.org/support/users/loki180/)

 *   [Profile](https://wordpress.org/support/users/loki180/)
 *   [Topics Started](https://wordpress.org/support/users/loki180/topics/)
 *   [Replies Created](https://wordpress.org/support/users/loki180/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/loki180/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/loki180/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/loki180/engagements/)
 *   [Favorites](https://wordpress.org/support/users/loki180/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Adding a search to custom theme](https://wordpress.org/support/topic/adding-a-search-to-custom-theme/)
 *  Thread Starter [Loki180](https://wordpress.org/support/users/loki180/)
 * (@loki180)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/adding-a-search-to-custom-theme/#post-5692196)
 * Sorry for all these posts guys, trying to update as I go along. It is working
   much better now, just one issue with the single.php file
 * Once a user has searched for a word or phrase it spits out a list of the things
   it has found, like expected, but once a user clicks on the one they are looking
   for nothing is displayed other than the title
 * the fault is with the single.php but i am not sure why it is not displaying.
 *     ```
       <?php
   
       get_header(); ?>
   
       	<div id="primary" class="content-area">
       		<main id="main" class="site-main" role="main">
       			<p>This is single.php</p>
       				<h3><a href='<?php the_permalink(); ?>'><?php the_title(); ?></a></h3>
       				<p><?php the_content(); ?></p>
       		<hr>
       		</main><!-- .site-main -->
       	</div><!-- .content-area -->
   
       <?php get_footer(); ?>
       ```
   
 * That is the single.php is but the_content(); is not showing up
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Adding a search to custom theme](https://wordpress.org/support/topic/adding-a-search-to-custom-theme/)
 *  Thread Starter [Loki180](https://wordpress.org/support/users/loki180/)
 * (@loki180)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/adding-a-search-to-custom-theme/#post-5692193)
 * Hi guys,
 * So I have been going through the twenttyTifteen theme pulling out all of the 
   search code.
 * So far i have the search bar displayed from the widgets, but once I type anything
   in it goes to another page saying
    Search Results For: xxxx
 * But only if I have searched for something that is on the site, if I searched 
   for something thats not on the site then the page is just blank.
 * I have so far
    page.php content-search.php search.php content.php single.php 
   content-page.php
 * all from the theme into my own theme, but with no victory.
 * I have added this to the functions.php to make widgets work
 *     ```
       function twentyfifteen_widgets_init() {
       	register_sidebar( array(
       		'name'          => __( 'Widget Area', 'twentyfifteen' ),
       		'id'            => 'sidebar-1',
       		'description'   => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ),
       		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
       		'after_widget'  => '</aside>',
       		'before_title'  => '<h2 class="widget-title">',
       		'after_title'   => '</h2>',
       	) );
       }
       add_action( 'widgets_init', 'twentyfifteen_widgets_init' );
       ```
   
 * I am unsure on if the functions.php needs anything else for the search to work?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Single permalink returning one custom post](https://wordpress.org/support/topic/single-permalink-returning-one-custom-post/)
 *  Thread Starter [Loki180](https://wordpress.org/support/users/loki180/)
 * (@loki180)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/single-permalink-returning-one-custom-post/#post-5623739)
 * Sorry about the above, This one will be better to understand!
 * The blow code is from the
 * single-work.php
 *     ```
       $args = array(
           "post_type" => "work"
         );
   
         $the_query = new WP_Query($args);
       ?>
   
       <?php if (have_posts() ) : while ($the_query->have_posts() ) : $the_query->the_post(); ?>
   
       <h1><?php the_field("name_of_website"); ?></h1>
       <img class="image-area' src="<?php the_field("image"); ?>'>
       <p><?php the_field("description"); ?></p>
   
       <?php endwhile; ?>
       <?php wp_reset_postdata(); ?>
       <?php endif; ?>
       ```
   
 * The below code is from the portfolio of the clickable field image
 *     ```
       <?php
   
                     $args = array(
                       'post_type' => 'work'
                     );
   
                     $the_query = new WP_Query($args);
                   ?>
   
                   <?php if (have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
   
                     <a href='<?php the_permalink(); ?>'>
                       <li>
                         <img class='image-area' src='<?php the_field('image'); ?>'>
                       </li>
                     </a>
   
                   <?php endwhile; ?>
                   <?php wp_reset_postdata(); ?>
                   <?php endif; ?>
       ```
   
 * When I click on the image WordPress displays all the custom posts and fields 
   from Work I want it to only display the one clicked, I can not remember how to
   do it!

Viewing 3 replies - 1 through 3 (of 3 total)