image uploader for widget

I think you facing issue of save button not clickable here. If I’m right about that a tiny line of javascript will solve the problem. Modify following portion of your javascript with mine: CODE UPDATED** imageUploader.on( “select” , function(){ var image = imageUploader.state().get( “selection” ).first().toJSON(); var link = image.url; $( “input.image_link” ).val( link ).trigger(“change”); $( … Read more

Show data obtained from a function and place it in a shortocode function

I don’t really understand what you’re trying to do. Why don’t you just call the function inside the shortcode handler? This looks more like general PHP question. Say we have a variable in our functions.php or wherever you define your shortcodes: $another_var = doSomeFunctionThatReturnsData(); With modern anonymous functions, you can pass variables using the use … Read more

WP Hook Before a post is created

There’s a hook save_post, docs here: https://developer.wordpress.org/reference/hooks/save_post/ which will allow you to run some code after the post is saved. Example from there: function add_user_after_post_save( $post_id ) { // add a user? // move the post to the user? } add_action( ‘save_post’, ‘add_user_after_post_save’ ); Not sure why you’d need to call the hook immediately before … Read more

Notify the user by e-mail after the creation of a post

There’s wp_schedule_single_event: $in_ten_minutes = time() + 10 * 60; $post_id = get_the_ID(); wp_schedule_single_event( $in_ten_minutes, ‘notify_post_event’, array( $post_id ) ); or similar – I’ve no idea if it’s just the post ID you need, or whether get_the_ID() is the right way to find it when you’re handling this action. Depending on where the button is and … Read more

Display all categories including sub categories under a list ul

Do you know how recursive functions are working? Here is an example: function get_categories_list( $parent ) { $args = array( ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => false, ‘parent’ => $parent ); $current_level_categories = get_terms( $args ); $result=””; if ( $current_level_categories ) { foreach ( $current_level_categories as $cat ) { if ( $cat->name == ‘Uncategorized’ ) continue; … Read more