1

Just wanting to ask the forum here, on how would i remove the search field in the Wordpress theme twentytwelve.

I did find a similar topic here and tried to follow through with the suggested code instructions but unfortunately i wasn't so successful.

I also posted this question in another thread but this has since been removed. I gather since this wasn't my own topic. Being new here and this is my very first thread the moderator should have at least warned me before deleting my question and i would have been more happy to remove the question i wrote.

So here i go i will ask again and post this here in my very own thread. Hopefully i wont be removed this time and that i have asked this in the correct discussion forum.

I would appreciate what ever help you could give to me.

I have the code below

Thanks in advance.

index.php

<?php if ( current_user_can( 'edit_posts' ) ) :
        // Show a different message to a logged-in user who can add posts.
    ?>
        <header class="entry-header">
            <h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
        </header>

        <div class="entry-content">
            <p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
        </div><!-- .entry-content -->

    <?php else :
        // Show the default message to everyone else.
    ?>
        <header class="entry-header">
            <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
        </header>

        <div class="entry-content">
            <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
            <?php get_search_form(); ?>
        </div><!-- .entry-content -->
    <?php endif; // end current_user_can() check ?>

    </article><!-- #post-0 -->

<?php endif; // end have_posts() check ?>
1

get_search_form() displays the search form. So you can either remove it or comment it out.

My advice would be to create a child theme, copy the necessary template files you would need working on and edit them so your customization's don't get overwritten on theme update.

  • Thank you Mr Tunja That worked great. I just commented out this line below as you suggested. I also made a back of the file should i need it later rather than a child theme as it was quicker and easier. Regards Tony <?php /* else : // Show the default message to everyone else. */ ?> – Tonymura Dec 30 '16 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.