Unlock the Secret to Effortless Website Magic: Build Your First WordPress Plugin Today!
The code strips HTML and shortcodes using wp_strip_all_tags()
and strip_shortcodes()
, counts words, and estimates reading time. Output is localized with esc_attr__()
and _n()
. The function is registered with add_filter()
.
With this plugin activated, each post will now also display the reading time:
Loading assets the WordPress way
To style your badge, enqueue a stylesheet using the wp_enqueue_scripts
action:
function qrt_enqueue_assets() {
wp_enqueue_style(
'qrt-style',
plugin_dir_url( __FILE__ ) . 'style.css',
array(),
'1.0'
);
}
add_action( 'wp_enqueue_scripts', 'qrt_enqueue_assets' );
Create a style.css
file in the same folder: