deactivating an active plugin using if page

Instead of deactivating the plugin completely (which would deactivate it everywhere on your site) look at the plugin’s code and determine what JS and CSS it is enqueuing. Then in your theme’s functions.php you can dequeue that plugin’s JS/CSS – but only on whatever pages you want to disable the plugin on. So for example, … Read more

Remove Custom Divs from AMP pages

Thanks to Thomas’ answer to my question at StackOverflow – https://stackoverflow.com/questions/53158606/remove-div-with-a-class-without-removing-content Here’s how you can do it on WordPress for AMP. In your theme’s functions.php add the following:- add_action( ‘pre_amp_render_post’, ‘amp_vid_rmv’ ); function amp_vid_rmv() { add_filter( ‘the_content’, ‘amp_vid_div_rmv’ ); } function amp_vid_div_rmv($content) { $content = preg_replace(‘#<div class=”yt”>([\s\S]*?)</div>#’, ‘$1’, $content); return $content; } Please feel free … Read more

3 different times on my WordPress website

In short, the server shows 13h (correct in current time in São Paulo DST), but PHP shows15h and WordPress shows 12h. This is intentional, and needs additional clarification, but to expand you have: The server local time UTC timestamps Localised WP time These needs to be separate, e.g. if I host a Japanese website on … Read more

Unset session variable on page reload / setup but exclude AJAX

Try using wp_doing_ajax() like so: function unset_filter_session() { if ( ! wp_doing_ajax() ) { //Reset sessions on refresh page unset( $_SESSION[‘expenditure_filter’] ); } } UPDATE You can check the answer’s revision for this update part.. UPDATE #2 Sorry, I didn’t realize that you’re loading a page fragment (#content-area) using the jQuery.load() method. Or that you’re … Read more

Underscore – Self hosted fonts

Using @import is the way to go, you can do something like this on your stylesheet: @font-face { font-family: FontName; src: url(public_html/your-site/wp-content/themes/your-theme/fonts/FontName-Regular.ttf); font-weight: normal; } Then you simply use it as usual. p { font-family: FontName; }

Change order of custom submenu link in WP Admin?

Take a look at this function. function my_submenu_order($menu_ord) { global $submenu; // echo ‘<pre>’.print_r($submenu,true).'</pre>’; $arr = array(); $arr[] = $submenu[‘users.php’][15]; // Your Profile $arr[] = $submenu[‘users.php’][10]; // Add New $arr[] = $submenu[‘users.php’][5]; // All Users $submenu[‘users.php’] = $arr; return $menu_ord; } add_filter(‘custom_menu_order’, ‘my_submenu_order’); Add that to your functions.php. It changes the default order of the … Read more