ThemeShaper Forums » Thematic

[closed]

404 search and no results search forms are outside entry-content

(11 posts)
  • Started 4 years ago by helgatheviking
  • Latest reply from linds
  • This topic is not a support question
  1. why don't the 404 and no-results search pages follow the same layout as everything else? for instance the forms on both pages are outside of the entry-content div, so they don't line up automatically and you have to either style all forms or target them by id. it just seems a bit silly as the search form is (for all intents and purposes) the 'entry content' of that page.

    the form on a no-results search page does the same thing.

    Posted 4 years ago #
  2. linds
    Member

    hi, I’m running into this issue with my actual search results, they don’t fit within the content area. I notice my main posts are wrapped in a <p> tag while the search results are not which pushes them out of the content area. If I add a <p> tag around the search results in Firebug it corrects the problem.

    I’m new to thematic and have no idea where to even find the entry-content div, to add a <p> tag or new style and if that is actually how to resolve this.

    How did you go about resolving this? Any help would be greatly appreciated.

    Posted 3 years ago #
  3. Hi,
    I can't really speak for the original intentions but you can alway change it to your liking. You could try something like this. You justs need to change the markup to what you want it to be as this just recreates the default markup.

    remove_action('thematic_404','thematic_404_content');
    
    add_action('thematic_404','childtheme_404_content');
    
    function childtheme_404_content () { ?>
       			<?php thematic_postheader(); ?>
    
    				<div class="entry-content">
    					<?php _e('Apologies, but we were unable to find what you were looking for. Perhaps  searching will help.', 'thematic') ?>
    
    				</div><!-- .entry-content -->
    
    				<form id="error404-searchform" method="get" action="<?php bloginfo('url') ?>/">
    					<div>
    						<input id="error404-s" name="s" type="text" value="<?php echo esc_html(stripslashes(get_query_var('s'))) ?>" size="40" />
    						<input id="error404-searchsubmit" name="searchsubmit" type="submit" value="<?php _e('Find', 'thematic') ?>" />
    					</div>
    				</form>
    	<?php }
    Posted 3 years ago #
  4. As far as the search page. You could copy the search.php template from thematic to your child theme and make your edits to the version in your child theme.

    Posted 3 years ago #
  5. linds
    Member

    hi em, thanks for the reply, when you say copy search.php from thematic to the child theme, I’m not exactly sure what you mean by that, do I copy thematic’s search.php into the child’s theme functions.php or do i just copy search.php into the child theme directory along with functions.php & style.css? I’m completely new to all of this. . .

    Posted 3 years ago #
  6. Make a copy of the template file search.php and put it in your child theme directory and name it search.php

    Any WordPress template file in a child theme will be used instead of the ones found in the parent.

    Look here for more basic info on using child themes:

    http://codex.wordpress.org/Child_Themes
    http://themeshaper.com/wordpress-child-theme-basics/

    Posted 3 years ago #
  7. linds
    Member

    thanks for your help em, I solved it by adding a <p> tag to the search loop in content-extensions.php

    Posted 3 years ago #
  8. I'm glad you found a way to fix it. But I have to say that it's never recommended to edit Thematic's files directly.

    If you want to edit the search loop function. Then remove the the original function from it's action hook and create and add your own version of it.

    This would be my recommendation. Restore Thematic to it's orginal state and add this to your child theme's functions.php:

    remove_action('thematic_searchloop', 'thematic_search_loop');
    
    add_action('thematic_searchloop', 'childtheme_search_loop');
    
    function childtheme_search_loop () {
    
    		while ( have_posts() ) : the_post(); 
    
    				thematic_abovepost(); ?>
    
    				<div id="post-<?php the_ID();
    					echo '" ';
    					if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    						post_class();
    						echo '>';
    					} else {
    						echo 'class="';
    						thematic_post_class();
    						echo '">';
    					}
         				thematic_postheader(); ?>
    					<div class="entry-content">
    						<?php thematic_content(); ?>
    
    					</div><!-- .entry-content -->
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    
    			<?php 
    
    				thematic_belowpost();
    
    		endwhile;
    } // end search_loop

    You'll still need to make your edits to the loop

    Posted 3 years ago #
  9. linds
    Member

    hi, em. I corrected the file the way you suggested, though now I'm getting double search results, the first set displays correctly within the content area, then immediately after the same search results are repeated though these don’t fit within the content area, that cycle is repeated for each page of results.

    This is what my functions.php looks like at the moment:

    <?php
    // Add a link back to your Child Theme release page in the [theme-link] shortcode
    function childtheme_theme_link($themelink) {
        return $themelink . ' &amp; <a class="Sugar Cane" href="http://ableparris.com/" title="A sweet Wordpress Theme" rel="designer">Sugar Cane by Able Parris</a>';
    }
    add_filter('thematic_theme_link', 'childtheme_theme_link');
    
    // Search-loop edit
    remove_action('thematic_searchloop', 'thematic_search_loop');
    
    add_action('thematic_searchloop', 'childtheme_search_loop');
    
    function childtheme_search_loop () {
    
    		while ( have_posts() ) : the_post(); 
    
    				thematic_abovepost(); ?>
    
    				<div id="post-<?php the_ID();
    					echo '" ';
    					if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    						post_class();
    						echo '>';
    					} else {
    						echo 'class="';
    						thematic_post_class();
    						echo '">';
    					}
         				thematic_postheader(); ?>
    					<div class="entry-content"><p>
    						<?php thematic_content(); ?>
    
    					</p></div><!-- .entry-content -->
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    
    			<?php 
    
    				thematic_belowpost();
    
    		endwhile;
    } // end search_loop
    
    ?>
    Posted 3 years ago #
  10. Sorry, the remove_action needs to be wrapped in a function and hooked.

    try:

    function child_remove_searchloop() {
            remove_action('thematic_searchloop', 'thematic_search_loop');
    }
    add_action('init','child_remove_searchloop');
    Posted 3 years ago #
  11. linds
    Member

    ok em, I tried that but it returned no search results.
    I tried changing your line add_action('init','child_remove_searchloop'); to add_action('init','childtheme_search_loop'); which returns results without the previous repeated results problem, BUT they are outside of the content area again. I'm not sure why, my <p> tag is still in the edit. . . Tho I don't know php, so my edit may be calling the original thematic search results again, I’m not sure.

    So this is my functions.php now:

    // Search-loop edit
    
    function child_remove_searchloop() {
            remove_action('thematic_searchloop', 'thematic_search_loop');
    }
    add_action('init','childtheme_search_loop');
    
    function childtheme_search_loop () {
    
    		while ( have_posts() ) : the_post(); 
    
    				thematic_abovepost(); ?>
    
    				<div id="post-<?php the_ID();
    					echo '" ';
    					if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    						post_class();
    						echo '>';
    					} else {
    						echo 'class="';
    						thematic_post_class();
    						echo '">';
    					}
         				thematic_postheader(); ?>
    					<div class="entry-content"><p>
    						<?php thematic_content(); ?>
    
    					</p></div><!-- .entry-content -->
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    
    			<?php 
    
    				thematic_belowpost();
    
    		endwhile;
    } // end search_loop
    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.