Comments (7)
@sidati That is an excellent idea. Thank you posting the code sample.
from minit.
@kasparsd Glad you like it,
By the way, if you have minutes, take a look to my pull request concerning the @import
css functions
https://github.com/sidati/minit/commit/3f0f618746f3a172b53582f24405977e8517a229
from minit.
I like this! I dont think we should register it with an anonymous function though. It makes it hard to remove it for those who does not want it.
from minit.
@kasparsd @ahansson89
why not adding some settings array with a filter like in JS plugins, so devs can enable or disable any core feature; something like :
$settings = apply_filters('minit_settings', array(
'admin_bar_button' => true,
'move_css_import_to_top' => true,
'comments_in_combined_file' => true,
'minify_css' => false
'exlude_externals' => false
));
from minit.
I like this idea a lot!
from minit.
That said, I think stuff like this could go in a different plugin like this: https://github.com/markoheijnen/Minit-Pro
from minit.
<?php
/*
Plugin Name: Fluch cache button
Version: 0.1.0
Description: Add an admin bar button to flush the object cache.
Author: Viktor Szépe
Plugin URI: https://github.com/szepeviktor/wordpress-plugin-construction
GitHub Plugin URI: https://github.com/szepeviktor/wordpress-plugin-construction
*/
if ( function_exists( 'wp_cache_flush' ) ) {
add_action( 'admin_bar_menu', 'o1_flush_cache_button', 100 );
}
function o1_flush_cache_button( $wp_admin_bar ) {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
if ( 'flush' === $_GET['flush-cache-button']
&& wp_verify_nonce( $_GET['_wpnonce'], 'flush-cache-button' )
) {
wp_cache_flush();
add_action( 'admin_notices', function () {
echo '<div class="notice notice-success is-dismissible"><p>Object Cache flushed.</p></div>';
} );
}
$dashboard_url = admin_url( add_query_arg( 'flush-cache-button', 'flush', 'index.php' ) );
$args = array(
'id' => 'flush_cache_button',
'title' => 'Flush Object Cache',
'href' => wp_nonce_url( $dashboard_url, 'flush-cache-button' ),
'meta' => array( 'class' => 'flush-cache-button' )
);
$wp_admin_bar->add_node( $args );
}
You only need to chage wp_cache_flush();
and rephrase messages.
from minit.
Related Issues (20)
- Empty src or href HOT 6
- Exclude 'jquery' container script HOT 2
- Publish on WordPress plugins directory HOT 2
- Support different plugin/theme paths than default ones HOT 9
- Move JS/CSS to foot of page HOT 1
- [off] As simple as minit CDN plugin HOT 2
- Eliminate render-blocking CSS - Issue HOT 2
- Inline scripts registered by 'wp_add_inline_script' are not printed
- How do I unistall the plugin HOT 2
- Include in theme instead of plugin HOT 2
- Add instructions to bump version numbers to trigger cache purge HOT 3
- Add a hook to bump the cache HOT 1
- root relative urls in css are being meesed up HOT 7
- Add support for defer to minit <script> output
- Not compatible with Simple Custom CSS HOT 1
- Exclude JS HOT 5
- Add all contributors to readme.md HOT 1
- Support custom WP_CONTENT_DIR locations HOT 10
- minit_exclude_js & re-enqueue back to header HOT 3
- Moving every helper to the Wiki HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minit.