1. Enqueue JavaScript and Localize Script In your plugin’s admin script enqueue function, add: php Copy code function enqueue_inline_editing_scripts() { // Enqueue jQuery if not already included wp_enqueue_script(‘jquery’); // Enqueue your custom inline editing script wp_enqueue_script(‘inline-editing-script’, PLUGIN_URL . ‘admin/js/inline-editing.js’, array(‘jquery’), ‘1.0.0’, true); // Localize script to pass AJAX URL and nonce wp_localize_script(‘inline-editing-script’, ‘inlineEditAjax’, array( ‘ajaxurl’… Continue reading Step-by-Step Guide to Implement Inline Editing in WordPress
Category: WordPress
Put WordPress Widget Inside Post or Page Via Shortcode
Below WordPress function to show a widget via wordpress shortcode. You can use this to put a widget inside of a post, page, or even a widget. function widget($atts) { global $wp_widget_factory; extract(shortcode_atts(array( ‘widget_name’ => FALSE ), $atts)); $widget_name = esc_html($widget_name); if (!is_a($wp_widget_factory->widgets[$widget_name], ‘WP_Widget’)): $wp_class = ‘WP_Widget_’.ucwords(strtolower($class)); if (!is_a($wp_widget_factory->widgets[$wp_class], ‘WP_Widget’)): return ‘<p>’.sprintf(__(“%s: Widget class not… Continue reading Put WordPress Widget Inside Post or Page Via Shortcode
WordPress Bootstrap Nav Walker Strict Standards Warning
After turning on WordPress Debug on one of my custom themes I noticed a strict standards waring regarding the Navwalker Bootstrap menu. Error: Strict Standards: Declaration of… start_lvl() should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) Fix: change function start_lvl(&$output, $depth) { to function start_lvl(&$output, $depth = 0, $args = array()) {