Hot answers tagged

9

Each of the files you have mentioned are theme files. When you upgrade WordPress itself, it will not touch any themes (or plugins) you have installed, whether or not you have modified them. If this was a theme you created yourself, then you have no worries at all. However, if this was a theme created by someone else, for example a WordPress default theme, ...


3

No it isn't. Server can not know browser width. Not sure it is even a smart idea since the width of the browser can change at any point.


2

You can do something like this : // remove the script from the queue if were are on the post ID 11 add_action('wp_enqueue_scripts', 'remove_script_specific_post'); function remove_script_specific_post(){ if( 11==get_the_ID() ){ wp_dequeue_script('my_script_handle'); } } Provided that the script has been added with wp_enqueue_script


1

Please do not put this code into production OK. So there are many things wrong with the code that need fixing before we can even begin to answer your question. Firstly we're using $_REQUEST without good reason -- $_REQUEST gives us access to all of the information sent in the request, which means that $_POST['foo'] $_REQUEST['foo'] === $_GET['foo'] and ...


1

I'm not sure why you are using exit() in yourreactivatejs()` method as this breaks the method before it even loads your script (hopefully this is for debugging purposes). I also do think that in is unnecessary to create a class to this, a simple spaghetti function would do perfectly. Anyways, if you need to use a class, the class's constructor is not ...


1

If you had for example, <img src="rdp_banner.jpg" id="logoimage"> You could just do... add_action('init','checkvisitcookie'); function checkvisitcookie() { if (isset($_COOKIE['firsttimevisit'])) {return;} setCookie('firsttimevisit','1',100*365*24*60*60); add_action('wp_footer','fadelogoout'); } function fadelogoout() { echo "<...


1

You have wp_enqueue_script( 'showMake' ); twice. Remove the last line from your sdm_load_javascript_files function and see if it works.


1

You don't quite cover how far you got and if you are familiar with basic of WP enqueue process. Focusing on parent part I the basic code would go like this: add_action( 'wp_enqueue_scripts', function () { if ( is_page() && in_array( $book_page_id, get_post_ancestors( get_the_id() ) ) ) { // enqueue stuff } } ); In your examples ...


1

Choose the right place in (rendering-)time First off, you are hooking at init, while you want to add your callback on wp_enqueue_script. Example: add_action( 'wp_enqueue_script', function() { wp_deregister_script( 'jquery' ); // Rest of logic } ); Staying up to date with core Also, you might want to use the correct version that core uses. I ...



Only top voted, non community-wiki answers of a minimum length are eligible