Creating a plugin to show a pop-up banner on every page

I used some javascript code to pop up the message, and placed it in my “Simple GDPR’ plugin https://wordpress.org/plugins/simple-gdpr/ . I got the javascript code from https://cookieconsent.insites.com/ , which details how to do it. I used the ‘after_header’ action , as in add_action(‘after_header’, ‘my_gdpr_notice’); to display the notice, plus using the ‘enqueue_scripts‘ functions to add … Read more

Description is not showing in plugin page

Try just with one paragraph: With SmartLink DU you can insert up to 5 URLs to a single link. Every time the page is loaded, one of the 5 URLs you’ve entered will be inserted in the link randomly. The only “weird” thing that I saw was that you have multiple paragraphs and they were … Read more

how to add navigation icons in specific template?

First add this in function.php file. This is font-awesome cdn function wp_enqueue_icon_stylesheet() { wp_register_style( ‘fontawesome’, ‘http:////maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css’ ); wp_enqueue_style( ‘fontawesome’); } add_action( ‘wp_enqueue_scripts’, ‘wp_enqueue_icon_stylesheet’ ); Then add this class ‘fa fa-lg fa-home’ in specific menu from backend menu Appreance->menus Then select the screen-option from top left and select/check the ‘CSS Classes’ After that put the ‘fa … Read more

How to wrap image tag into div for post only?

You have the global WP_Post object available so you can look the post type like this: function wrap_post_images_to_div( $content ) { if ( get_post()->post_type === ‘post’ ) { $pattern = ‘/(<img([^>]*)>)/i’; $replacement=”<div class=”well text-center”>$1</div>”; $content = preg_replace( $pattern, $replacement, $content ); } return $content; } add_filter( ‘the_content’, ‘wrap_post_images_to_div’ ); You can use the preg_replace_callback instead … Read more