• Hello,
    I have successfully converted my sidebar into a horizontal drop down menu with a search box. However, on certain pages (clicking on a blog post, archives, categories and search results) the search box doesn’t show up in my sidebar. It does show on the “main” page and the “pages” page. I have very little knowledge of php. I don’t see any errors, but wonder if I may have missed something by editing sidebar. Help!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter visualcraftsman

    (@visualcraftsman)

    I have spent hours reading forum support and searching for “get_search_form” information but haven’t found anything useful. I did not customize the search either…its from the default theme. Sigh.

    Thread Starter visualcraftsman

    (@visualcraftsman)

    I guess I can always hard code the search form with searchForm.php…anyone out there like to comment? My interesting but lonely dialog with myself is starting to depress me.

    I’ll take a shot at it. Can you post a link to your site?

    Thread Starter visualcraftsman

    (@visualcraftsman)

    Absolutely! You’ll see the blog’s navigation in the middle of the page.
    https://www.visualcraftsman.com/test/blog/
    Thanks!

    Hey,

    I looked at the source code for your Main page and the Categories Archive page (/test/blog/?cat=1).

    The source code for the Main page is this:

    <div id="sideBar">
    		<ul id="sideNav">
    
    			<li class="noLink"></li>
    
    			<!--deleted li with php calls to remove p from ul-->
    
    			<li><a href="index.php">main</a></li>
    
    			<li class="pagenav"><a href="#">pages</a><ul><li class="page_item page-item-2"><a href="https://www.visualcraftsman.com/test/blog/?page_id=2" title="About">About</a></li>
    </ul></li>
    			<li><a href="#">archives</a>
    				<ul>
    					<li><a href='https://www.visualcraftsman.com/test/blog/?m=200902' title='February 2009'>February 2009</a></li>
    				</ul>
    			</li>
    
    			<li class="categories"><a href="#">categories</a><ul>	<li class="cat-item cat-item-1"><a href="https://www.visualcraftsman.com/test/blog/?cat=1" title="View all posts filed under Uncategorized">Uncategorized</a> (1)
    </li>
    </ul></li>
    
    		</ul>
    		<div id="fill"></div>
    		<div id="search"><form method="get" id="searchForm" action="https://www.visualcraftsman.com/test/blog/" >
    	<label class="hidden" for="s">Search for:</label>
    	<div><input type="text" value="" name="s" id="s" />
    	<input type="submit" id="searchSubmit" value="search" />
    	</div>
    	</form></div>
    
    	</div>

    The source code for your Categories Archive page is this:

    <div id="sideBar">
    		<ul id="sideNav">
    
    			<li class="noLink"></li>
    
    			<!--deleted li with php calls to remove p from ul-->
    
    			<li><a href="index.php">main</a></li>
    
    			<li class="pagenav"><a href="#">pages</a><ul><li class="page_item page-item-2"><a href="https://www.visualcraftsman.com/test/blog/?page_id=2" title="About">About</a></li>
    </ul></li>
    			<li><a href="#">archives</a>
    				<ul>
    					<li><a href='https://www.visualcraftsman.com/test/blog/?m=200902' title='February 2009'>February 2009</a></li>
    				</ul>
    			</li>
    
    			<li class="categories"><a href="#">categories</a><ul>	<li class="cat-item cat-item-1 current-cat"><a href="https://www.visualcraftsman.com/test/blog/?cat=1" title="View all posts filed under Uncategorized">Uncategorized</a> (1)
    </li>
    </ul></li>
    
    	</div>

    The difference in the latter is you don’t have the closing </ul> tag prior to where you want your search form to appear. This would possibly explain why it won’t appear on an archive page, but is okay on the Main page.

    Most likely all you need to do is look at your sidebar.php code and make sure the <ul> tags are placed appropriately in relation to the categories function tag.

    If you need to go further, post your sidebar.php code.

    Hope this helps!

    Or, specifically, where you have your code for <div id="sidbar">.

    Thread Starter visualcraftsman

    (@visualcraftsman)

    Thanks worth…appreciate the second eye. I checked sidebar and the markup looked fine to me.

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    ?>
    	<div id="sideBar">
    		<ul id="sideNav">
    
    			<li class="noLink"></li>
    
    			<!--deleted li with php calls to remove p from ul-->
    
    			<li><a href="index.php">main</a></li>
    
    			<?php wp_list_pages('title_li=<a href="#">pages</a>' ); ?>
    
    			<li><a href="#">archives</a>
    				<ul>
    				<?php wp_get_archives('type=monthly'); ?>
    				</ul>
    			</li>
    
    			<?php wp_list_categories('show_count=1&title_li=<a href="#">categories</a>'); ?>
    
    			<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    
    		</ul>
    		<div id="fill"></div>
    		<div id="search"><?php get_search_form(); ?></div>
    
    		<?php } ?>
    
    	</div>
    Thread Starter visualcraftsman

    (@visualcraftsman)

    and “get_sidebar” is called in exactly the same place on each page.
    -vc

    Okay, this is good…

    In the sidebar.php, change this:

    <?php wp_list_categories('show_count=1&title_li=<a href="#">categories</a>'); ?>
    
    			<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    
    		</ul>
    		<div id="fill"></div>
    		<div id="search"><?php get_search_form(); ?></div>
    
    		<?php } ?>
    
    	</div>

    To this:

    <?php wp_list_categories('show_count=1&title_li=<a href="#">categories</a>'); ?>
    
    		</ul>
    		<div id="fill"></div>
    		<div id="search"><?php get_search_form(); ?></div>
    
    	</div>

    We just removed the conditional start and end tags on either side of the search form that restricted the form’s display to the ‘home’ page, and ‘page’ pages. It excluded category and archive pages. By removing the tag, it doesn’t restrict anything, which is I think what you want.

    It also takes care of the missing </ul> end tag, which was originally marooned along with the search box inside the conditional tags.

    Let me know if this worked!

    Thread Starter visualcraftsman

    (@visualcraftsman)

    Worked like a charm! Apparently, I didn’t know the if statement was restricting the search form on certain pages. THANK YOU!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Search Form Not Showing Up’ is closed to new replies.