Remove a filter added by a plugin

So after some digging managed to find the asnwer and instead of removing the filter you can overrid the single_template filter to add your own custom template. add_filter( ‘single_template’, ‘my_custom_single_template’, 99, 1 ); function my_custom_single_template( $single ) { global $post; if ( isset( $post ) && $post->post_type == ‘hotel-room’ ) { $single = require_once( STYLESHEETPATH … Read more

Custom location for attached images

I would try changing your line in wp-config.php to define( ‘UPLOADS’, ‘media/blog/files’ ); // where docker is mounted Ie, get rid of the first /. Let me know if this works. EDIT If you can’t change the definition of UPLOADS you could strip out the forward slash out with code. Try changing your code to … Read more

how to retrieve uploaded url of zip files

To allow uploading files which are not in the ‘regular’ list of MIME’s you have to tell WordPress to add them to that list. As an example you find below code which adds those extensions to the already existing MIMES list. Please make a backup first /** * Source: @link https://developer.wordpress.org/reference/hooks/upload_mimes/ * */ add_filter( ‘upload_mimes’, … Read more

js file in root loading without

WordPress has no mechanism to load custom js files automatically. If your theme need that js file, then place it inside your theme folder. and link it in your template file. for example, <script src=”https://wordpress.stackexchange.com/questions/353972/<?php echo get_template_directory_uri(); ?>/assets/bootstrap.min.js”></script> In the above example, “bootstrap.min.js” file is located in my theme’s “assets” folder. the function get_template_directory_uri() return … Read more

Insert a button on a page with random number generation

all thing you have to do is use javaScript function JavaScript Example: var random_number = function(){ return Math.floor(Math.random() * 10000) + 1; }; document.getElementById(‘button_text’).onclick = function () { document.getElementById(“input_box”).innerHTML = random_number(); }; jQuery Example: $.randomBetween(0,10000);

Implement toggle switch for theme options in settings API

There are several ways to implement an options page. You can implement a quick and easy options page via Advanced Custom Fields Pro (find out more here: https://www.advancedcustomfields.com/resources/options-page/) To do things the WordPress way(without the help of plugins), you will want to follow this guide here: https://developer.wordpress.org/plugins/settings/custom-settings-page/ Once implemented, you should be able to save … Read more