WordPress.org

Forums

Serene
[resolved] 404 error page (6 posts)

  1. massacre
    Member
    Posted 1 year ago #

    Hello!

    I have two search fields on 404 error page. I've check another blog, based on this theme and it's the same. Any ideas how to edit to code in order to have only one field?

    Here is the code for no-results.php

    <?php
    /**
     * @package Serene
     * @since Serene 1.0
     */
    ?>
    
    <div class="entry no-results-found">
    	<h1><?php esc_html_e( 'Hmm. Weird! Nothing found. Maybe serch again?', 'Serene' ); ?></h1>
    
    <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
    
    	<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'Serene' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
    
    <?php elseif ( is_search() ) : ?>
    
    	<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'Serene' ); ?></p>
    	<?php get_search_form(); ?> 
    
    <?php else : ?>
    
    <!--	<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'Serene' ); ?></p>
    	<?php get_search_form(); ?> -->
    
    <?php endif; ?>
    </div>
  2. Jesin A
    Member
    Posted 1 year ago #

    You have already placed HTML comments tag <!-- --> around it so it shouldn't display in the browser. Can you share your website's URL.

  3. Jesin A
    Member
    Posted 1 year ago #

    I found the problem by using this theme in a local installation.

    The 2nd search box you are seeing is the one displayed by the <a href="http://codex.wordpress.org/Function_Reference/get_sidebar">get_sidebar()</a> function.

    When this function is called without any parameters it searches for the sidebar.php file but this theme doesn't have one so from the codex

    If the theme contains no sidebar.php file then the sidebar from the default theme wp-includes/theme-compat/sidebar.php will be included.

    The solution here is to create an empty file named sidebar.php in

    /wp-content/themes/serene/sidebar.php

    this causes wordpress to display your widgets.

  4. massacre
    Member
    Posted 1 year ago #

    Thank you very much, jesin!

  5. Jesin A
    Member
    Posted 1 year ago #

    You're welcome, if the solution works can you mark this thread as resolved so that others having the same issue will find it useful.

  6. massacre
    Member
    Posted 1 year ago #

    Yes, of course! I forgot about it, thanks!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic