Hey @ben Carlo
My shortcode:
// Lazy Shortcode
function lazyimage_shortcode( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'tieude' => '',
'url' => ''
),
$atts,
'lazyimage'
);
return '<img class="lazy loading" data-src="'.esc_html__($atts['url']).'" alt="'.esc_html__($atts['tieude']).'" title="'.esc_html__($atts['tieude']).'">';
}
add_shortcode( 'lazyimage', 'lazyimage_shortcode' );
// Add TinyMCE button and plugin filters
function lazyimage_tinymce_button() {
if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
add_filter( 'mce_buttons', 'lazyimage_register_tinymce_button' );
add_filter( 'mce_external_plugins', 'lazyimage_tinymce_button_script' );
}
}
add_action( 'init', 'lazyimage_tinymce_button' );
-
This reply was modified 7 years, 11 months ago by nht2007.