WordPress.org

Ready to get started?Download WordPress

Forums

Increase visibility of 'Search Engines Blocked' notification in 3.2 (5 posts)

  1. Rob Barrett
    Member
    Posted 3 years ago #

    It's a shame to see the 'Search Engines Blocked' message moved away from the header - there have been a few times when I've deployed sites and overlooked unblocking the search engines. When I've then returned to the site, the header clearly reminds me of this throughout the backend, and I can solve the issue.

    Now, with this new design, it's not only been relegated to the 'Right Now' panel, but it's not been given any extra weight. In my opinion, it's an important option and requires an increase in visibility.

    Ideally, I'd prefer it to be added back to the header, but otherwise, I'd suggest highlighting it in some manner, like this:
    Screenshot

    This at least is quite easy to achieve - for anyone else interested, I added this to my theme's functions.php:

    // 'Search Engines Blocked' Highlighter
    function rbd_search_engines_blocked() {
    echo '<style type="text/css">
    #dashboard-widgets a[href="options-privacy.php"] {
    	font-weight: bold;
    	color: #FFFFFF;
    	background-color: #CC0000;
    	display: inline-block;
    	padding: 5px 10px;
    	border-radius: 5px;
    }
    </style>'; };
    add_action('admin_head', 'rbd_search_engines_blocked');
  2. Rob, I want to +1 you!!

  3. Marcel Bootsman
    Member
    Posted 3 years ago #

    I have made a tiny plugin for this: http://wordpress.org/extend/plugins/search-engines-blocked-in-header/

    It places the message back in the header.

  4. jimmerd
    Member
    Posted 3 years ago #

    Rob and Marcel: both solutions are great. The two together, even better.
    How about combining? Add a class to the link and style that in the admin header? (I want that notice to really slap me in the face; I've neglected to turn it off a time or two.)

    add_action('in_admin_header', 'nostromo_sebih');
    function nostromo_sebih() {
        if (!get_option('blog_public')) {
            $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
            $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked'));
    
            echo "<p style='float:left; position: relative; top:-4px;'><a title='$title' href='options-privacy.php' class='sebih'>$content</a></p>";
        }
    }
    
    // 'Search Engines Blocked' Highlighter
    function rbd_search_engines_blocked() {
    echo '<style type="text/css">
    a.sebih {
    	font-weight: bold;
    	color: #FFFFFF;
    	background-color: #CC0000;
    	display: inline-block;
    	padding: 5px 10px;
    	border-radius: 5px;
    }
    </style>'; };
    add_action('admin_head', 'rbd_search_engines_blocked');
  5. Rob Barrett
    Member
    Posted 3 years ago #

    Cheers, Ipstenu ;)

    Excellent work, both Marcel and Jimmerd - that does the job nicely!

    I'd suggest, though, a change to the CSS in the above code segment, now that the notification is moved to the header - it's visible throughout the site now, so I don't think it needs to be quite so prominent and distracting, just in case a site needs to be kept blocked for any reason.

    This should be enough:

    a.sebih {
        color: #A66;
        font-weight: bold;
    }

    And for anyone else using this, you could still also include the CSS rule from my first post inside the rbd_search_engines_blocked() function to make the notification really visible just when you're on the Dashboard.

Topic Closed

This topic has been closed to new replies.

About this Topic