I have a crowded admin toolbar and I’d like to remove Insights but can find no settings to do so.
How can I remove it?
Thank you.
]]>Can you kindly add your plugin’s logo to your plugin’s corresponding WP Admin Toolbar menu item? (both in the frontend and backend).
Until then, if you can provide a code snippet that will accomplish that above, that would be great.
Also, I would like to recommend replacing the word “Purge” with “Clear” throughout your plugin (please refer to the above link) as well as “Addons” with “Add-ons“, “Purge All Caches” with “Clear all Cache“, and “Purge this Url Caches” with “Clear Cache of this Page“
Thank you!
]]>The code snippet provided below changes the styling of the WP Fastest Cache admin toolbar quicklinks (backend and frontend) to match WordPress’ styling standards.
Before Applying Code Snippet: Current Quicklinks Styling
After Applying Code Snippet: WordPress Quicklinks Styling
Give it a spin!
————–
Code Snippet: (Change WP Fastest Cache Quicklinks Styling to Match WordPress Styling Standards)
function override_admin_toolbar_quicklinks_css() {
if ( is_admin_bar_showing() ) { ?>
<style type="text/css">
#wp-admin-bar-wpfc-toolbar-parent .ab-empty-item:hover {
background-color: transparent!important;
cursor: pointer!important;
color: #72aee6!important;
}
</style>
<?php }
}
add_action( 'admin_head', 'override_admin_toolbar_quicklinks_css', 20, 3 );
add_action( 'wp_head', 'override_admin_toolbar_quicklinks_css', 20, 3 );
]]>How can I stop your plugin from translating the admin toolbar links (backend and frontend)? Specifically, these links.
A code snippet for the above would be nice.
Thank you!
]]>Your plugin’s logo does not display in the admin toolbar frontend, only the backend.
Admin Toolbar (Frontend): Logo Not Displayed
Admin Toolbar (Backend): Logo Displayed
Please review and provide a fix.
Thank you!
]]>The code snippets provided below will update the WP Fastest Cache plugin links and text used in the backend and frontend to ensure homogeneity across the board and agree better with WordPress’ guidelines.
Any questions or issues, please let me know.
Enjoy!
———————
Code Snippet (Affects Backend):
/* BACKEND: Change WP Fastest Cache "Delete Cache" and "Clear Cache" Strings to "Purge Cache" */
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Clear cache files when a post or page is published' :
$translated_text = 'Purge cache files when a post or page is published';
break;
case 'Clear cache files when a post or page is updated' :
$translated_text = 'Purge cache files when a post or page is updated';
break;
case 'Delete Cache' :
$translated_text = 'Purge Cache';
break;
case 'Clear All Cache' :
$translated_text = 'Purge Cache';
break;
case 'Clearing Specific Pages' :
$translated_text = 'Purging Specific Pages';
break;
case 'Delete Cache and Minified CSS/JS' :
$translated_text = 'Purge Cache and Minified CSS/JS';
break;
case 'Minify Css' :
$translated_text = 'Minify CSS';
break;
case 'Minify Css Plus' :
$translated_text = 'Minify CSS Plus';
break;
case 'Combine Css' :
$translated_text = 'Combine CSS';
break;
case 'Minify Js' :
$translated_text = 'Minify JS';
break;
case 'Combine Js' :
$translated_text = 'Combine JS';
break;
case 'Combine Js Plus' :
$translated_text = 'Combine JS Plus';
break;
case 'More powerful minify html' :
$translated_text = 'More powerful minify HTML';
break;
case 'You can decrease the size of css files' :
$translated_text = 'You can decrease the size of CSS files';
break;
case 'More powerful minify css' :
$translated_text = 'More powerful minify CSS';
break;
case 'Reduce HTTP requests through combined css files' :
$translated_text = 'Reduce HTTP requests through combined CSS files';
break;
case 'You can decrease the size of js files' :
$translated_text = 'You can decrease the size of JS files';
break;
case 'Reduce HTTP requests through combined js files' :
$translated_text = 'Reduce HTTP requests through combined JS files';
break;
case 'You can remove the emoji inline css and wp-emoji-release.min.js' :
$translated_text = 'You can remove the emoji inline CSS and wp-emoji-release.min.js';
break;
case 'Render Blocking Js' :
$translated_text = 'Render Blocking JS';
break;
case 'Delay Js' :
$translated_text = 'Delay JS';
break;
case 'Some js sources will not be loaded until scrolling or moving the mouse' :
$translated_text = 'Some JS sources will not be loaded until scrolling or moving the mouse';
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );
/* BACKEND: Change WP Fastest Cache Admin Toolbar Main Link String from "Delete Cache" to "Fastest Cache" */
function change_admin_toolbar_main_link_backend() {
if ( is_admin_bar_showing() ) {
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent');
$args = array(
'id' => 'wpfc-toolbar-parent',
'title' => 'Fastest Cache',
'href' => '/wp-admin/admin.php?page=wpfastestcacheoptions',
);
$wp_admin_bar->add_node($args);
}}
add_action('wp_before_admin_bar_render', 'change_admin_toolbar_main_link_backend', 20, 3);
/* BACKEND: Change WP Fastest Cache Admin Toolbar Sub-Links Strings from "Clear Cache" and "Delete Cache" to "Purge Cache" */
function change_admin_toolbar_sub_links_backend() {
if ( ! is_admin() ) {
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-delete-cache');
$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-delete-cache',
'title' => 'Purge Cache',
);
$wp_admin_bar->add_node($args);
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-clear-cache-of-this-page');
$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-clear-cache-of-this-page',
'title' => 'Purge Cache of this Page',
);
$wp_admin_bar->add_node($args);
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-delete-cache-and-minified');
$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-delete-cache-and-minified',
'title' => 'Purge Cache and Minified CSS/JS',
);
$wp_admin_bar->add_node($args);
}}
add_action('wp_before_admin_bar_render', 'change_admin_toolbar_sub_links_backend', 20, 3);
/* BACKEND: Change WP Fastest Cache Admin Toolbar Ajax Spinner and Icon from "Cheetah" to Generic ("Gear") Icon */
function override_admin_toolbar_css_backend() {
if ( is_admin_bar_showing() ) { ?>
<style type="text/css">
#revert-loader-toolbar {
background-image: url(/wp-content/uploads/2024/08/ajax-loading-gif-1.gif)!important; // use the File URL of your spinner
}
/* Change plugin icon in Admin Toolbar */
#wp-admin-bar-wpfc-toolbar-parent > .ab-item::before {
// content: url(/wp-content/plugins/wp-fastest-cache/images/icon.svg)!important; /* use original plugin logo */
content: "\f111"!important; /* use custom plugin logo (gear) */
margin-top: .1em!important;
}
</style>
<?php }
}
add_action( 'admin_head', 'override_admin_toolbar_css_backend', 20, 3 );
Code Snippet (Affects Frontend):
/* FRONTEND: Change WP Fastest Cache "Delete Cache" and "Clear Cache" Strings to "Purge Cache" */
function change_admin_toolbar_main_link_frontend() {
if ( ! is_admin() ) {
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent');
$args = array(
'id' => 'wpfc-toolbar-parent',
'title' => 'Fastest Cache',
'href' => '/wp-admin/admin.php?page=wpfastestcacheoptions',
);
$wp_admin_bar->add_node($args);
}}
add_action('wp_before_admin_bar_render', 'change_admin_toolbar_main_link_frontend', 20, 3);
/* FRONTEND: Change WP Fastest Cache Admin Toolbar Sub-Links Strings from "Clear Cache" and "Delete Cache" to "Purge Cache" */
function change_admin_toolbar_sub_links_frontend() {
if ( ! is_admin() ) {
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-delete-cache');
$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-delete-cache',
'title' => 'Purge Cache',
);
$wp_admin_bar->add_node($args);
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-clear-cache-of-this-page');
$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-clear-cache-of-this-page',
'title' => 'Purge Cache of this Page',
);
$wp_admin_bar->add_node($args);
global $wp_admin_bar;
$wp_admin_bar->remove_node('wpfc-toolbar-parent-delete-cache-and-minified');
$args = array(
'parent' => 'wpfc-toolbar-parent',
'id' => 'wpfc-toolbar-parent-delete-cache-and-minified',
'title' => 'Purge Cache and Minified CSS/JS',
);
$wp_admin_bar->add_node($args);
}}
add_action('wp_before_admin_bar_render', 'change_admin_toolbar_sub_links_frontend', 20, 3);
/* FRONTEND: Change WP Fastest Cache Admin Toolbar Ajax Spinner and Icon from "Cheetah" to Generic ("Gear") Icon */
function override_admin_toolbar_css_frontend() {
if ( is_admin_bar_showing() ) { ?>
<style type="text/css">
#revert-loader-toolbar {
background-image: url(/wp-content/uploads/2024/08/ajax-loading-gif-1.gif)!important; // use the File URL of your spinner
}
/* Change plugin icon in Admin Toolbar */
#wp-admin-bar-wpfc-toolbar-parent > .ab-item::before {
// content: url(/wp-content/plugins/wp-fastest-cache/images/icon.svg)!important; /* use original plugin logo */
content: "\f111"!important; /* use custom plugin logo (gear) */
margin-top: .1em!important;
}
</style>
<?php }
}
add_action( 'wp_head', 'override_admin_toolbar_css_frontend', 20, 3 );
]]>It would be awesome if you can update your plugin’s admin toolbar links as follows:
The above changes will help improve plugin navigation efforts. Most other popular plugins behave this way.
Thank you!
]]>I have translation set up for menu and toolbar items. As far as I can determine, the menu/toolbar translations work well. If my user’s automatic language is spanish, then these items are spanish; if french, they are are french. otherwise english.
However, if a user begins in English and then displays the opening page for spanish, the menu and toolbar items remain in the default language — ie english.
Is there a way to allow a user to choose their language and override the detected language?
]]>We’re trying to remove the “Events” menu item from our WordPress toolbar using the code snippet provided below.
Unfortunately, it does not work for The Events Calendar. It does work, however, for all other plugins we’re using. We can confirm we’re using the proper Node ID for “Events.”
So, it appears The Events Calendar is not following WordPress’ coding standards for most part, which is causing this issue.
Kindly review and provide a fix.
Thank you!
—————————
function remove_toolbar_items($wp_adminbar) {
$wp_adminbar->remove_node('tribe-events');
}
add_action('admin_bar_menu', 'remove_toolbar_items', 999);
]]>