Skip to:
Content
Pages
Categories
Search
Top
Bottom

Remove search bar


  • rxcosta
    Participant

    @rxcosta

    I found the following code being suggested to remove the forum search bar:
    /*Remove forum search above forum */
    .bbp-search-form {
    display:none;
    }

    It works on some themes, but not my current theme at villagepca.org. Any other suggestions?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

  • NerdEnPose
    Participant

    @nerdenpose

    This is the basic code. There’s plugins to do it but I prefer to put this in my functions.php

    add_action('init', 'remove_admin_bar');
    
    function remove_admin_bar() {
            show_admin_bar(false);
    }

    However I prefer to only remove it if the user isn’t logged in:

    add_action('init', 'remove_admin_bar');
    
    function remove_admin_bar() {
        if (!is_user_logged_in()) {
            show_admin_bar(false);
        }
    }

    Or if you prefer to limit by user roles and editing capabilities.

    function remove_admin_bar() {
        if (!current_user_can('administrator')) {
            show_admin_bar(false);
        }
    }

    FYI: There’s a pretty popular search result recommending this for role check:

    add_action('init', 'remove_admin_bar');
    
    function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
    }

    This would check to see if the user is in the admin portion in which case you’d show the bar as well.


    Pippin Williamson
    Moderator

    @mordauk

    There’s no reason to place this in your functions.php instead of as a plugin. It is the exact same code that gets executed, except as a plugin it is easier to maintain.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar