I\'m having problems finding the right hook to use for my plugin. I\'m trying to add a message to the top of each page by having my plugin add a function. What\'s the best h
I could not find any working example online, but I got one solution and I hope it might help anyone. It is quite simple, just add jquery and do whatever you want. The below example might help anyone.
jQuery(document).ready( function($) {
$('body').prepend('Hello world
');
});
Here is the website url https://wordpress.org/support/topic/add_action-right-after-ltbodygt-tag
With the help of the above answer, I have made a plugin which directly adds content after the body tag. Here is the sample code :
var wcs_thankyou_msg = " Your coupon code is ."+""
var wcs_scratch_after_text = ""
var discount_text = ""
var offer_message = ""
var id = ""
$('body').prepend(''+offer_message+''+wcs_top_text+''+wcs_top_text_h2+'');
});
The most amazing thing is that I don't know how I have done the above code in an easy way, pulling the data dynamic right after the body tag. I hope my answer will help someone and give a better idea. Live working example : http://codecanyon.net/item/woocommerce-coupon-scratch-discount/9235287