Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I remove the initial search result from my WP website home page ?

Featured Replies

Hi

 

I have used a WP setup to create my new website. It has a search function in the menu/nav bar, but when you load the main url (home page) of the site it shows a 'Not Found' message, where is has apparently already done a search.

 

It doesn't do this on the other pages, but there isn't anything referring to this in index.php, actually not in page.php either as far as a I can see ?

 

If anyone can point me in the right direction of how to get rid of this I would appreciate it, really struggling.

 

I posted a few questions over the last couple of days, and subsequently worked out the answer, I'm not going to with this I'm afraid.

 

http://www.presenceunknown.co.uk/ - 'Not Found' under the 6 boxes please scroll.

 

Many thanks

 

Ash

I'm not sure on this

 

In the wp backend try going in settings, reading and select frontpage displays a static page and then select the page under the front page dropdown

  • Author

appreciate the reply but not sure how this will get rid of the search result message, isn't this just for setting CMS home page ? 'Static page' and 'Front page' - Home, is already set.

 

Why would i be getting a not found search result on the home page but not on the rest? I of course don't want a search result unless a search has been made ?

OP, could you post the code from your index.php, and someone will be able to show the code you need to remove.

  • Author

OP, could you post the code from your index.php, and someone will be able to show the code you need to remove.

 

<?php

/**

* @package WordPress

* @subpackage Enterprise

* @since Enterprise 1.0

*/

 

get_header(); ?>

 

<div id="content">

<div id="content-left">

<div id="maintext">

 

 

</div><!-- end #maintext -->

</div><!-- end #content-left -->

<div id="content-right">

<div id="sideright">

<?php get_sidebar(); ?>

</div>

</div><!-- end #content-right -->

<div class="clear"></div>

</div><!-- end #content -->

 

 

<?php get_footer(); ?>

 

PAGE.PHP is:

 

get_header(); ?>

 

<?php

if ( is_active_sidebar('before-content') ) {

get_sidebar('before-content');

}

?>

 

<div id="content">

<div id="content-left">

<div id="maintext">

 

<?php

if(!is_front_page()){

include_once (TEMPLATEPATH . '/title.php');

}

?>

<?php if ( function_exists('yoast_breadcrumb') && !is_front_page() ) {

yoast_breadcrumb('<div id="breadcrumbs">','</div>');

} ?>

 

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

 

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="entry-content">

<?php the_content(); ?>

<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'templatesquare' ), 'after' => '</div>' ) ); ?>

<?php edit_post_link( __( 'Edit', 'templatesquare' ), '<span class="edit-link">', '</span>' ); ?>

</div><!-- .entry-content -->

</div><!-- #post-## -->

 

<?php comments_template( '', true ); ?>

 

<?php endwhile; ?>

 

</div><!-- end #maintext -->

</div><!-- end #content-left -->

<div id="content-right">

<div id="sideright">

 

<?php get_sidebar('page'); ?>

 

</div>

</div><!-- end #content-right -->

<div class="clear"></div>

</div><!-- end #content -->

 

<?php

if ( is_active_sidebar('after-content') ) {

get_sidebar('after-content');

}

?>

<?php get_footer(); ?>

 

 

 

Many thanks for any help.

  • Author

its not in index.php ?

 

File are in

 

http://www.presenceunknown.co.uk/wp-content/themes/enterprise/style.css

 

the bottom part of header.php with search box;

 

<div id="topnavigation">

<div id="top-searchform">

<form method="get" action="<?php echo get_option('home'); ?>/">

<div><input type="text" name="s" value="<?php _e('search','templatesquare'); ?>" class="inputbox" onBlur="if (this.value == ''){this.value = '<?php _e('search','templatesquare'); ?>'; }" onFocus="if (this.value == '<?php _e('search','templatesquare'); ?>') {this.value = ''; }"/></div>

</form>

</div><!-- end topsearch -->

 

 

<div id="navi-top">

<?php wp_nav_menu( array(

'container' => 'ul',

'menu_class' => 'menu',

'menu_id' => 'nav',

'depth' => 0,

'theme_location' => 'mainmenu'

));

?>

</div><!-- end #navi-top -->

</div><!-- end topnavigation -->

 

<!-- END HEADER -->

Am I looking at the right error here

 

error.jpg

 

If so its because its looking for posts (loop.php)

 

Did you try what I said ??

Looking through the code, it looks like it's coming from this line of code, in page.php

 

<?php
if ( is_active_sidebar('after-content') ) {
get_sidebar('after-content');
}
?>

 

Hide that code by using the html comments tags e.g.

 

<!-- 
<?php
if ( is_active_sidebar('after-content') ) {
get_sidebar('after-content');
}
?>
-->

 

The reason I said index.php as that is normally the one it's in, as most people use index.php for the homepage, rather than page.php.

  • Author

Because its looking for posts and you dont have any

 

I'm not using it as a blog just a CMS ?

  • Author

Looking through the code, it looks like it's coming from this line of code, in page.php

 

<?php
if ( is_active_sidebar('after-content') ) {
get_sidebar('after-content');
}
?>

 

Hide that code by using the html comments tags e.g.

 

<!-- 
<?php
if ( is_active_sidebar('after-content') ) {
get_sidebar('after-content');
}
?>
-->

 

The reason I said index.php as that is normally the one it's in, as most people use index.php for the homepage, rather than page.php.

 

 

Tried hiding it as suggested but still there, I presumed if I removed coding completely then it would disappear buts it still there?

 

Thanks by the way for all the responses, I tend to post on wordpress.org and never get any answers. :D

  • Author

I'm not sure on this

 

In the wp backend try going in settings, reading and select frontpage displays a static page and then select the page under the front page dropdown

 

'then select the page under the front page dropdown'

what page ?

 

reading.jpg

Looks correct the way you have it set

 

I've just tried this on wp locally If I dont set as static page and then select the page I get the same Not found msg

 

Sorry I'm no wp expert just trying to help

 

Am I looking at the right error or not? as you keep saying about the search bar

  • Author

No i appreciate the help.

 

I want to get rid of

 

search.jpg

 

from the home page.

 

I have search box like there is in the nav bar on several websites and they don't show result without otr @not found' when nothing has been searched.

 

I understand from other responses that it might be trying to show posts ? eitherway I don't want whats in the images above and frankly don't even understand why it would be there ?

  • Author

Yes its trying to show posts

 

you could try and comment out the call to posts see if that works

 

 

taken out

 

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

 

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="entry-content">

<?php the_content(); ?>

<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'templatesquare' ), 'after' => '</div>' ) ); ?>

<?php edit_post_link( __( 'Edit', 'templatesquare' ), '<span class="edit-link">', '</span>' ); ?>

</div><!-- .entry-content -->

</div><!-- #post-## -->

 

 

from the page.php but no change ? Don't suppose you could point the right bit out please? I would appreciate it. Then maybe thats that.

Can you post your header.php and index.php if your using page.php for the home page post that aswell

 

could you wrap it in code tags <> button above, just makes it easier to read

  • Author

I've included all 3 below. The index.php has so little in it that I don't think its being used.

 

 

INDEX.PHP

 

 

<?php

/**

* @package WordPress

* @subpackage Enterprise

* @since Enterprise 1.0

*/

 

get_header(); ?>

 

<div id="content">

<div id="content-left">

<div id="maintext">

 

 

</div><!-- end #maintext -->

</div><!-- end #content-left -->

<div id="content-right">

<div id="sideright">

<?php get_sidebar(); ?>

</div>

</div><!-- end #content-right -->

<div class="clear"></div>

</div><!-- end #content -->

 

 

<?php get_footer(); ?>

 

 

 

PAGE.PHP is:

 

 

 

 

 

get_header(); ?>

 

<?php

if ( is_active_sidebar('before-content') ) {

get_sidebar('before-content');

}

?>

 

<div id="content">

<div id="content-left">

<div id="maintext">

 

<?php

if(!is_front_page()){

include_once (TEMPLATEPATH . '/title.php');

}

?>

<?php if ( function_exists('yoast_breadcrumb') && !is_front_page() ) {

yoast_breadcrumb('<div id="breadcrumbs">','</div>');

} ?>

 

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

 

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="entry-content">

<?php the_content(); ?>

<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'templatesquare' ), 'after' => '</div>' ) ); ?>

<?php edit_post_link( __( 'Edit', 'templatesquare' ), '<span class="edit-link">', '</span>' ); ?>

</div><!-- .entry-content -->

</div><!-- #post-## -->

 

<?php comments_template( '', true ); ?>

 

<?php endwhile; ?>

 

</div><!-- end #maintext -->

</div><!-- end #content-left -->

<div id="content-right">

<div id="sideright">

 

<?php get_sidebar('page'); ?>

 

</div>

</div><!-- end #content-right -->

<div class="clear"></div>

</div><!-- end #content -->

 

<?php

if ( is_active_sidebar('after-content') ) {

get_sidebar('after-content');

}

?>

<?php get_footer(); ?>

 

 

 

HEADER.PHP

 

 

<?php

/**

* The Header for our theme.

* @package WordPress

* @subpackage Enterprise

* @since Enterprise 1.0

*/

?><!DOCTYPE html>

<html <?php language_attributes(); ?>>

<head>

<meta charset="<?php bloginfo( 'charset' ); ?>" />

<title><?php

/*

* Print the <title> tag based on what is being viewed.

* We filter the output of wp_title() a bit -- see

* twentyten_filter_wp_title() in functions.php.

*/

wp_title( '|', true, 'right' );

 

?></title>

<link rel="profile" href="http://gmpg.org/xfn/11" />

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

<link href="<?php bloginfo('template_url'); ?>/prettyPhoto.css" rel="stylesheet" type="text/css" />

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />

<?php

$favicon = get_option('templatesquare_favicon');

if($favicon =="" ){

?>

<link rel="shortcut icon" href="<?php bloginfo('template_url'); ?>/images/favicon.ico" />

<?php }else{?>

<link rel="shortcut icon" href="<?php echo $favicon; ?>" />

<?php }?>

<?php

/* We add some JavaScript to pages with the comment form

* to support sites with threaded comments (when in use).

*/

if ( is_singular() && get_option( 'thread_comments' ) )

wp_enqueue_script( 'comment-reply' );

 

/* Always have wp_head() just before the closing </head>

* tag of your theme, or you will break many plugins, which

* generally use this hook to add elements to <head> such

* as styles, scripts, and meta tags.

*/

wp_head();

?>

 

<!-- ////////////////////////////////// -->

<!-- // Javascript Files // -->

<!-- ////////////////////////////////// -->

<?php

$time = get_option('templatesquare_slider_timeout');

$speed = get_option('templatesquare_slider_speed');

$slidertype = get_option('templatesquare_slider_type');

?>

 

 

 

<script type="text/javascript">

var $ = jQuery.noConflict();

jQuery(document).ready(function($) {

/* for Slider cycle */

$('#slideshow').cycle({

timeout: <?php echo $time;?>, // milliseconds between slide transitions (0 to disable auto advance)

fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...

pager: '#pager', // selector for element to use as pager container

pause: 0, // true to enable "pause on hover"

pauseOnPagerHover: 0 // true to pause when hovering over pager link

});

 

 

/* for Testimonial cycle */

$('.boxslideshow').cycle({

timeout: <?php echo $time;?>, // milliseconds between slide transitions (0 to disable auto advance)

fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...

pause: 0, // true to enable "pause on hover"

pauseOnPagerHover: 0 // true to pause when hovering over pager link

});

 

 

/* for portfolio prettyPhoto */

$("#gallery a[rel^=prettyPhoto]").prettyPhoto({theme:'dark_rounded'});

 

 

});

</script>

 

<script type="text/javascript">

Cufon.replace('h1') ('h1 a') ('h2') ('h3') ('h4') ('h5') ('h6') ('blockquote') ('.styled') ('.txtbold') ('#logo .desc') ('#logo')

</script>

 

<script type="text/javascript">

var $ = jQuery.noConflict();

$(document).ready(function() {

/* for top navigation */

$(" #navi-top ul ul ").css({display: "none"}); // Opera Fix

$(" #navi-top ul li").hover(function(){

$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(400);

},function(){

$(this).find('ul:first').css({visibility: "hidden"});

});

 

});

</script>

 

<?php

$bgtopnav = get_option('templatesquare_bgtopnav');

$bgimage = get_option('templatesquare_bgimage');

$linkcolor = get_option('templatesquare_linkcolor');

$topnavcolor = get_option('templatesquare_topnavcolor');

$hovercolor = get_option('templatesquare_hovercolor');

 

if($bgtopnav==""){ $bgtopnav = "#2ca9e4"; }

if($linkcolor==""){ $linkcolor = "#2ca9e4"; }

if($hovercolor==""){ $hovercolor = "#d2eefb"; }

if($topnavcolor==""){ $topnavcolor = "#ffffff"; }

?>

<style type="text/css">

body{ <?php if($bgimage!=""){ ?>background-image:url(<?php echo $bgimage; ?>)<?php } ?>}

#topnavigation, #navi-top ul ul{background-color:<?php echo $bgtopnav; ?>; }

#top-searchform div{border:<?php echo $bgtopnav; ?>;}

#respond .form-submit input, #logo .desc, a, a:link , a:visited, a:hover, a.more, a.more:hover, a.more-link , a.more-link:visited, .more-link, .more-rc-post{color:<?php echo $linkcolor; ?>;}

#recentcomments a, div.formcontainer form.contact-form fieldset div.form-submit input.button{color:<?php echo $linkcolor; ?>!important;}

 

#navi-top ul ul{border-bottom:5px solid <?php echo $hovercolor; ?>;}

 

#navi-top ul li a{color:<?php echo $topnavcolor; ?>;}

#navi-top ul.sub-menu li a{color:<?php echo $topnavcolor; ?>!important;}

#navi-top ul li.current-menu-item a, #navi-top ul li.current_page_item a{color:<?php echo $hovercolor; ?>;}

li.current-menu-parent a, li.current-page-parent a{color:<?php echo $hovercolor; ?>!important;}

#navi-top ul li a:hover, #navi-top ul.sub-menu li a:hover, #navi-top ul.sub-menu li.current-menu-item a, #navi-top ul.sub-menu li.current_page_item a{color:<?php echo $hovercolor; ?>!important;}

</style>

 

 

<!--[if IE 6]>

<script src="<?php bloginfo('stylesheet_directory');?>/js/DD_belatedPNG.js"></script>

<script>

DD_belatedPNG.fix('img, #logo');

</script>

 

<![endif]-->

 

</head>

 

<body>

<div id="wrapper">

<div id="container">

<div id="top">

 

<div style="text-align:center"><img src="/images/logo.gif" alt="Happy Babies Maternity"></div>

 

<div style="text-align:center">

 

<div>

<object type="application/x-shockwave-flash"

data="/images/hbm_flash.swf"

width="945" height="234">

<param name="movie" value="/images/hbm_flash.swf">

<param name="quality" value="high">

</object>

 

</div>

 

</div>

 

 

</div><!-- end top -->

 

<div class="clr"></div><!-- clear float -->

 

 

 

<div id="topnavigation">

<div id="top-searchform">

<form method="get" action="<?php echo get_option('home'); ?>/">

<div><input type="text" name="s" value="<?php _e('search','templatesquare'); ?>" class="inputbox" onBlur="if (this.value == ''){this.value = '<?php _e('search','templatesquare'); ?>'; }" onFocus="if (this.value == '<?php _e('search','templatesquare'); ?>') {this.value = ''; }"/></div>

</form>

</div><!-- end topsearch -->

 

 

<div id="navi-top">

<?php wp_nav_menu( array(

'container' => 'ul',

'menu_class' => 'menu',

'menu_id' => 'nav',

'depth' => 0,

'theme_location' => 'mainmenu'

));

?>

</div><!-- end #navi-top -->

</div><!-- end topnavigation -->

 

<!-- END HEADER -->

  • Author

Looking through the code, it looks like it's coming from this line of code, in page.php

 

<?php
if ( is_active_sidebar('after-content') ) {
get_sidebar('after-content');
}
?>

 

Hide that code by using the html comments tags e.g.

 

<!-- 
<?php
if ( is_active_sidebar('after-content') ) {
get_sidebar('after-content');
}
?>
-->

 

The reason I said index.php as that is normally the one it's in, as most people use index.php for the homepage, rather than page.php.

 

any other ideas? Really do with the helpage :-)

  • Author

Are you using a custom page ??

 

sorry to be a pain but don't know what that means mteam ?

On the edit page screen there should be a box to choose page attributes templates

is that set to default?

  • Author

On the edit page screen there should be a box to choose page attributes templates

is that set to default?

 

your a bloody genius thanks so much. No it wasn't, ofcourse I've been making loads of changes to the default and it hasn't change the page because...... it wasn't on default.

Last idea from me, post your footer.php.

 

Could you post in the code tags please, click the code.png image

 

 

edit: you fixed it,

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.