Category: Wordpress Snippets

Load Bootstrap 4 CSS And JS From MaxCDN – The Right Way
[ad_1] By OutsourcedContent — on October 25, 2017 Add this to the functions.php of the active theme. /** * Load Bootstrap CSS and JS from MaxCDN – the right way * * @refer https://millionclues.com/wordpress-tips/load-css-and-js-the-right-way/ */ function mcabl1226_load_css_and_js() { // Load Boostrap CSS wp_enqueue_style( ‘bootstrap-css’, ‘https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css’ ); // Load Theme’s style.css wp_enqueue_style( ‘style’, get_stylesheet_uri() ); …

Automatically Delete Users After 7 Days In WordPress
[ad_1] This is not the type of function you would require to use very often because it offers very specific feature toautomatically delete users after predefined time. I was looking to implement this feature in a past project where my client was offering temporary access to a section on his website to many users, but…

A Bookmarklet To Load WordPress Dashboard For Any Website
[ad_1] Divi is a WordPress theme that web designers do not want you to know. It comes with a drag-and-drop theme builder. You can build beautiful looking unique websites without touching a line of code. Just choose from one of the many pre-made layouts, or pick elements and arrange them any way you like. Divi…

Find All Posts Containing Given Image In WordPress
[ad_1] By OutsourcedContent — on November 9, 2017 Pass the id of the image to the function and it will return an array with the id’s of all the posts that use the given image. /** * Find all posts that uses the given image * * @param $image_id Integer ID of the image to work on *…

Prevent WordPress From Checking Update For Plugins
[ad_1] Many developers were concerned about the data WordPress should send back to WordPress.org when checking update for plugins and themes. Some have expressed concern that private plugins developed for a specific client or website may contain some sensitive information in their headers, like contact information for the developer, etc and it should not be…

Get Raw Unfiltered Post Title In WordPress
[ad_1] By OutsourcedContent — on November 10, 2017 To retrieve the post title of a post as saved in the wp_posts table in the WordPress database use this <?php echo get_post_field( ‘post_title’, $post_id, ‘raw’ ); ?> If you use get_the_title() function, WordPress applies the ‘the_title‘ filter before returning the value. [ad_2]

Sanitize And Escape Text Input In WordPress
[ad_1] By OutsourcedContent — on November 13, 2017 For general sanitization of text input fields and text areas for plugin options and such, use: sanitize_text_field( string $string ) For escaping in general for text input fields, use: esc_attr( string $string ) @refer https://wordpress.stackexchange.com/a/66323/90061 [ad_2]

Disable RSS Feeds On Your WordPress Blog
[ad_1] WordPress is one of the best Content Management System (CMS) available and it is such a well thought out flexible system that it can be used for any type of website. And since you can create multiple different types of sites, there is always going to be some features which aren’t needed or wanted…

Smooth Scroll Page When Clicking Anchor Link – jQuery
[ad_1] By OutsourcedContent — on November 16, 2017 Add this to your jQuery file. // Smooth scroll When Clicking Anchor // @refer https://stackoverflow.com/a/7717572/8255629 var jQueryroot = $(‘html, body’); $(‘a[href^=”#”]’).click(function () { jQueryroot.animate({ scrollTop: $( $.attr(this, ‘href’) ).offset().top }, 1000); return false; }); [ad_2]

Add Bootstrap4 Form Styling To WooCommerce Checkout Fields
[ad_1] By OutsourcedContent — on November 19, 2017 Add the following code to functions.php or to a custom plugin to style WooCommerce checkout form fields with sweet Bootstrap 4 styling. /** * Add Bootstrap form styling to WooCommerce fields * * @since 1.0 * @refer http://bit.ly/2zWFMiq */ function iap_wc_bootstrap_form_field_args ($args, $key, $value) { $args[‘input_class’][] =…