Changing where my author box is printed

You could change the function to echo like this: echo apply_filters(‘the_content’, $content); and then in your template, right before the comments template, place the call to your author box function like this: author_info_box(); also, you would need to remove the add_action(‘the_content’, ‘author_info_box’); Full function example: function author_info_box() { global $post; // Detect if it is … Read more

Register new user, assign custom role then send email

TO really fit your needs, I think it’s better to rewrite some part of wp_insert_user() function, some part can interrest you $user_email = apply_filters( ‘pre_user_email’, $raw_user_email ); And : $illegal_logins = (array) apply_filters( ‘illegal_user_logins’, array() ); if ( in_array( strtolower( $user_login ), array_map( ‘strtolower’, $illegal_logins ) ) ) { return new WP_Error( ‘invalid_username’, __( ‘Sorry, … Read more

How to access page variable inside action hook

There is method on product class that is called is_on_sale() which actually determines if the product is on sale or not. You can access it from global $product variable. And must echo the do_shortcode. So the whole code will be like- add_action(‘woocommerce_single_product_summary’,’add_product_signup’, 10, 2); function add_product_signup() { global $product; if( $product->is_on_sale() ) { echo do_shortcode(‘[contact-form-7 … Read more

Dynamic name of cron event

So no, I can’t see a way to grab the name of your action. However, you can pass arguments to your callback: $blog_id = get_current_blog_id(); $cron_name=”import_blog_posts_in_network_daily_”.$blog_id; if ( !wp_next_scheduled( $cron_name) ) { wp_schedule_event( time(), ‘daily’, $cron_name, array($blog_id) ); } add_action( $cron_name, array($this, ‘import_blog_posts_in_network’) ); /* public function import_blog_posts_in_network($blog_id) { // do something for blog $blog_id … Read more

Action Hook Inside WordPress Plugin Shortcode

It’s not entirely clear what your ultimate goal is, but a simple way to catch a form submission is to hook init and check if something is set: function wpd_check_post_vars(){ if( isset( $_POST[‘first_name’] ) ){ // do something } } add_action( ‘init’, ‘wpd_check_post_vars’ ); There’s no connection here between the action and your Shortcode, it’s … Read more

Is this the correct way to enqueue style sheets from parent theme and then from child theme in wordpress?

You can try below code. I think there is no need to use wp_enqueue_scripts twice to enqueue the parent and child theme style sheets separately. Also the use of echo get_stylesheet_uri( ); in the enqueue_child_theme_styles function doesn’t make any sense. function my_theme_enqueue_styles() { $parent_style=”styles”; wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’, array(‘enough_base’) ); wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . … Read more