Title: search.php &#039;invents&#039; parent
Last modified: August 20, 2016

---

# search.php 'invents' parent

 *  [danielle_r](https://wordpress.org/support/users/danielle_r/)
 * (@danielle_r)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/searchphp-invents-parent/)
 * Hi all,
 * I’ve got this weird problem. In my child template I use three different colours
   for different items. Orange = inspiration, Blue = silence, Green = all the rest.
   Depending on the parent page the logo is displayed in orange, blue or green:
 *     ```
       <?php
       			// check which item
       			$parent_page = get_top_parent_page_id($post->ID);
       			echo "parent: ".$parent_page;
       			if($parent_page == 7){
       			?>
                   <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/inspiratie_logo.png"  width="146" height="177" alt="" />
       			<?php
       			}
       			elseif($parent_page == 10){
       			?>
                   <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/stilte_logo.png"  width="146" height="177" alt="" />
       			<?php }
       			else {
       			?>
                   <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/home_logo.png"  width="146" height="177" alt="" />
                   <?php
       			}
       			echo "</a>";
       			?>
       ```
   
 * This works fine for all items. But the search results page should have green 
   logo, but after my upgrade to 3.5.1. just now it seems to take a random parent
   but never green any more. The search form looks like this:
 *     ```
       <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ));?>">
       		<label for="s" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
       		<input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Zoek|Search', 'twentyeleven' ); ?>" />
       		<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
       	</form>
       ```
   
 * On the website: [http://www.awarenesslab.nl](http://www.awarenesslab.nl) you 
   can see that I print the parent. Why is the parent set to either 10 of 7 even
   when I search from the homepage which has 5 as a parent? And more inportantly,
   what can I do to make this right again?
    Thanks ever so much in advance for your
   help, best, danielle.

The topic ‘search.php 'invents' parent’ is closed to new replies.

## Tags

 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [search form](https://wordpress.org/support/topic-tag/search-form/)

 * 0 replies
 * 1 participant
 * Last reply from: [danielle_r](https://wordpress.org/support/users/danielle_r/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/searchphp-invents-parent/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
