Tuesday, March 6, 2018

Remove dashboard bar to a profile from WordPress site


METHOD #1 - Plugin

Suppose that you have a site that you desire to supress the dashboard bar and admin bar to the users except the administrators.

Use "Editor Menu And Widget Access" plugin and just set the configuration like this:




-----------------------------------------------------------------------------------------------------------
METHOD #2 - Coding

@DEPRECATED:
In recent versions using others themes, the solution was not effective anymore, requiring more code digging. A better alternative solution was adopted above.


Suppose that you have a site that you desire to supress the dashboard bar and admin bar to the "subscriber" profile.
Follow the example.

1. Go to the themes' function.php file.
For instance, if the active theme is named "vale", edit:
$SITE_DIR/public_html/wp-content/themes/vale/function.php

2. Add the following

// This file is not called from WordPress. We don't like that.
! defined( 'ABSPATH' ) and exit;

add_action( 'init', 'fb_remove_admin_bar', 0 );
function fb_remove_admin_bar() {
if ( current_user_can('subscriber') || current_user_can('assinante') ) {
wp_deregister_script( 'admin-bar' );
wp_deregister_style( 'admin-bar' );
remove_action( 'init', '_wp_admin_bar_init' );
remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
// maybe also: 'wp_head'
foreach ( array( 'admin_head' ) as $hook ) {
add_action(
$hook,
create_function(
'',
"echo '';"
)
);
}
}
}


Adapted from:
https://wordpress.stackexchange.com/questions/77639/disable-the-admin-bar/77648#77648

Remove excert from WordPress standard search



The standard search box generates by default a list of titles and excerpts.

The bold text is the title, the other (smaller characters) is the excerpt.

To exclude the excerpt from the default search, check the theme the site is using.
In this example is TwentyFifteen.
Go to the theme's folder and follow the procedure below.



1. Edit content-search.php.
This file is at:

/home/mynumbers/public_html/wp-content/themes/twentyfifteen/content-search.php


2. Remove the entry in orange:

 <header class="entry-header">
  <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
 </header><!-- .entry-header -->

 <div class="entry-summary">
  <?php the_excerpt(); ?>
 </div><!-- .entry-summary -->

 <?php if ( 'post' == get_post_type() ) : ?>
NOTE: always take note of a reference from where the code was remove in order to rollback, just in case.

After this procedure, just the bold title shall appear.


virtualbox6: debian: netbeans install issues: "dpkg: warning: 'ldconfig' not found in PATH or not executable" and "pkg-deb: error: archive 'apache-netbeans_....deb' uses unknown compression for member 'control.tar.zst', giving up"

  >PROBLEMS/SOLUTIONS You desire to install  Netbeans  on a Debian O.S. using the VirtualBox v.6 because the VirtualBox v.7 fails on your...