Removing certain links in admin header bar added by plugins - wordpress

I have instaled several plugins and they tend to add links on the admin bar that is
I have ultimate affiliate pro and it has added new and referral affiliate and other plugins like ithemes security has a link on the admin bar such that now my admin bar looks mesed up like in the image below
How can i edit this is there a plugin which can remove certain links on the admin dashboard bar without having to disable the plugins
I have tried:
checking on the screen options but there is no way to uncheck links

Here is the example of how you can remove the unwanted links from admin_bar.
function remove_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wporg'); // Remove the WordPress.org link
$wp_admin_bar->remove_menu('documentation'); // Remove the WordPress documentation link
$wp_admin_bar->remove_menu('support-forums'); // Remove the support forums link
$wp_admin_bar->remove_menu('feedback'); // Remove the feedback link
$wp_admin_bar->remove_menu('w3tc'); // If you use w3 total cache remove the performance link
$wp_admin_bar->remove_menu('my-account'); // Remove the user details tab
}
add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
You need to check the menu name and add it to the function call via add_action.

Related

How to Rename the Admin Menu From WordPress theme files or plugin?

I want to change the blue marked portfolio menu to Course. Basically I want to change---
Portfolios--->> Courses
Add New Portfolio -->> Add New Course
And When I add click on add new portfolio it is show add new portfolio. Instead of this I want to show add new course and course setting in the marked area.
I just want to edit it from theme file but unable find it out. Help..me
Try add_filter( 'post_type_labels_post', 'rename_labels' ) hook
add_filter( 'post_type_labels_post', 'rename_labels' );
function rename_labels($labels){
$labels->Portfolio='Course';
return $labels;
}
https://wordpress.stackexchange.com/questions/9211/changing-admin-menu-labels
Which plugin you have used for Adding Portfolios?
You can customize it by editing theme/plugin templates.
You will see admin folder which will contain all these files. These name can also be stored in variables so I can't respond to your query without access to FTP.

Change a homepage based on theme wordpress

I have 2 themes in my WP installation: Theme, Theme2, and separately I have 2 Homepages, one for each theme.
Is it any way for me to change a homepage based on active theme dynamically?
So, Example if i'll activate Theme2, Homepage2 becomes a main homepage?
Ideally, i want something like:
if ( current_user_can( 'manage_options' ) ) {
switch_theme('twentytwelve');
/* Activate Homepage_1 */
} else {
switch_theme('twentythirteen');
/* Activate Homepage_2 */
}
}
Change a homepage based on theme wordpress
You can follow this steps and set the homepage page as you have activated the theme.
Click on “Pages” from your dashboard.
Click the “Add New” button on the top and create a new page called, “Homepage.”
Go to “Settings” from the dashboard, and click on “Reading.”
The first option available is called “Front Page Displays.” Change it to “A static page.”
In the “Front Page” drop down, you should see your new homepage. Select it and save your changes.
Go back into “Pages” and click on your homepage.
Add the shortcodes you want to display.
Update your homepage.

WooCommerce list view

I have a WordPress site with WooCommerce installed,
The problem I'm having is on the shop page the products are by default shown as a GRID (side by side), there's a button to switch from the default GRID mode to LIST mode; but for every new client that comes on the site, they would have to manually change it!
I'd like to permanently change the default view from GRID to LIST for every person that comes on the site, but I can't find any way to do this in the code.
Does anyone have any knowledge on how to do this?
There is a plugin that can do this for you: http://wordpress.org/plugins/woocommerce-grid-list-toggle
After installing the plugin go to your dashboard: Woocommerce -> Settings -> product -> Scroll to the bottom of the page and there is an option called Default catalog view, change that from Grid to List.
There will be an option for users on the shop page to change the view from List to Grid. To hide this option add the following to the CSS:
.gridlist-toggle
{
display: none !important;
}
My solution can switch grid to list view as default on products page.
You can try this:
Connect to your FTP/public_html/wp-content/YOUR_THEME/woocommerce/global/
Edit wrapper-start.php
You will see this code
$shop_view = shopme_get_meta_value('shop_view');
if (empty($shop_view)) { $shop_view = 'view-grid'; }
if (!empty( $shop_view ) ) { $wrapper_classes[] = $shop_view; }
Replace "view-grid" to "list_view_products"
I just solved the same problem.
This is my solution how to PERNAMENTLY force WooCommerce to show product catalog only as List View.
JS
// This will remove class="grid" on page load and add class="list" to your product view
$(document).ready(function(){
$('.browse-view ul#products').removeClass('grid').addClass('list');
});
JS -- Test with Woocommerce v4.0.1
// -- Last Rev. (2020-04) --
jQuery(function($){
$('.woocommerce ul.products').removeClass('grid').addClass('list');
});
CSS
/* This will hide grid/list switcher in toolbar*/
.view-mode{display:none!important;}
Another way to do this is use this plugin: https://wordpress.org/plugins/gridlist-view-for-woocommerce/
After install go to settings WooCommerce -> Grid/List View
In Buttons tab change Default style to List and uncheck all in Buttons display
In Products Count tab uncheck Use products count

Hide Wordpress dashboard?

I'm new to wordpress and a bit confused with something. I'm trying to build a classified marketplace type of website for myself. I am NOT building this for a "client". I will probably be using a hack of several different plugins as my coding skills are not up to par. Eventually I will hopefully have lots of users who will be composed of buyers & sellers.
My question pertains to the WP dashboard. When buyers/sellers sign up for my site, will they be able to see the backend WP dashboard? I would prefer that they NOT be able to access a backend dashboard at all let alone a WP branded one. Is this possible? If so any clue as to how this might be accomplished?
thank you Brian
Normal users do not actually see the 'backend' WP dashboard. What they are seeing is a 'profile' type page meant for the original functionality of wordpres; being a blog.
If you do not want users to go to this page when they log-in, you can use a couple of hooks. Here is some code that redirects to the front page after logging-in and logging-out. This goes in your functions.php file.
add_action('login_form', 'ang_redirect_to_front_page');
add_action('wp_logout', 'go_home');
function ang_redirect_to_front_page() {
global $redirect_to;
if (!isset($_GET['redirect_to'])) {
$redirect_to = get_option('siteurl');
}
}
function go_home(){
wp_redirect( home_url() );
exit();
}
And, if your theme is still displaying the menu at the top of the screen that allows the users to go to this 'profile' area, you can go into your footer.php file and remove this:
<?php wp_footer();?>
However, if you do this, then you will not see it as the admin either.
WordPress is might not be the thing to use for that kind of website, even with a bunch of plugins. Read up on other content management systems just incase.
This link might answer your question:
http://buddypress.org/support/topic/how-to-prevent-non-admins-from-accessing-wp-admin-dashboard/
You can also add this to your theme's function.php file:
// DISABLE ADMIN BAR FOR ALL USERS
show_admin_bar( false );
If you are not too used to wordpress, use WOOCOMMERCE plugin. Its completely free and well documented

why is the <?php wp_head ?> tag creating a top margin at the top of my theme header

Hey people, I've been coming here for a while but just decided to join.
I'm new to php and I'm trying to make a website with WordPress as the CMS.
Anyway, I'm basically making my own theme because I don't want my website to look like a blog, and it's going pretty smoothly so far but theres this huge top margin gap in the browser even when I set margins to 0px.
I tried trial and error and found out that it's being caused by: <?php wp_head(); ?>
It's two different things.
1. wp_head() function
wp_head() is a template tag to print whatever plugin / theme specific function used by wordpress action. Read codex for more detail about it.
2. The admin bar
The top margin, is generated by wordpress's admin bar.
To fix this for logged in users you can do a couple of things:
Disable admin bar from the admin:
Go to admin panel
Users >> User Profile
Uncheck 'when viewing
site' on 'Show Admin Bar'
Remove the admin bar from your theme entirely:
Open your functions.php
Add this to it:
function my_function_admin_bar(){ return false; }
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
Remove only the code which creates the css:
Open your functions.php
Add this to it:
function my_filter_head() { remove_action('wp_head', '_admin_bar_bump_cb'); }
add_action('get_header', 'my_filter_head');
Note: Extensive updates are from #hitautodestruct
you neeed to call wp_footer() in your footer
just insert this line <?php wp_footer();?> into your footer.php file
If you have updated your wordpress install to the latest version.. there seems to be some bug with the admin bar...
were it would produce an inline stylesheet appended to the top of your pages.. causing the margin-top:28px
see here
1 recomendation is to put a new function into your functions.php file located in your theme folder.. this will completly remove the bar, so no users of your theme will have any of the same issues!
function my_function_admin_bar(){
return false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');
Not sure if this will help.. but worth a shot.. also turning off the admin bar while viewing the front end of the site under your profile page..

Resources