How can I un-enqueue a javascript file in WordPress? - wordpress

I'm working with Wordpress site and a script that I have to have is breaking a plugin that I also have to have lol.
What would be the best way to have that script not run when I'm on pages that use the plugin? Every page that has the plugin has "?fl_builder" on the end of the URL
I was thinking maybe use jQuery to have the script not run if the url contains "?fl_builder"? I'm just not sure how to write it.
Any help is appreciated!

Have you tried added a $_GET variable where you call your script?
Example:
if(isset($_GET['fl_builder'])) { wp_register_script(...); }

Related

Wordpress: how to know which page is requesting a specific css file

I am helping out a friend with a slow WP. I installed hummingbird and it's telling me that some css files are slow to load (for example: https://cdnjs.cloudflare.com/ajax/libs/gsap/1.11.2/TweenMax.min.js - it takes 390ms to load). I would like to store this file locally and see if the performance improves. The problems is that I'm not sure about how to locate the file that is actually requesting this css file. Any help is appreciated.
I suggest a sweet plugin I use called String locator. It will search the whole site for a string like TweenMax.min.js. It will also search by plugin. When it find it it gives options to edit straight to the file. Hope this helps.

Published MATLAB html code to Wordpress

I want to know how can I publish my Matlab scripts into Wordpress?
I used Matlab publish function in order to get an html file which actually works when I open it with my browser.
However, my problem is when I tried to copy the html code and paste it into wordpress HTML, I don't get the same result. It looks like Wordpress cannot do the job.
What seems to be the problem there? Or do I need to install a Wordpress plugin or what?
Thank you!
You can simply use MATLAB tool for publishing MATLAB code to WordPress.
The more information is available in :
https://www.mathworks.com/matlabcentral/fileexchange/103730-publishing-tool-for-matlab-live-script-to-wordpress

Where could be inline-css in Wordpress

I am working on this webpage:http://hypoinvest.sk/ which runs on Wordpress with this theme If you check source code you can see a lot of inline-css and I want to know in which files are actually defined. Only thing what I know about it they are called by function wp_head() in header.php. I have local copy of all files on this web and I can't find any mention about some of that css rules through unix grep. Anyone suspect where these css rules could be located?
check site and let me know.
Run a search in the source code for
style-inline
As this appears to be the 'handle' designated as the first variable in the function wp_add_inline_style. The "-css" is added automatically. You'll see this on line 79 of the page source.
https://codex.wordpress.org/Function_Reference/wp_add_inline_style
You want to check your page back-end site where you put content ,
I think are you using any compose or editor to create page on edit page.
check it edit option it has some inline css.

async wp_head() content manually

I'm doing some SEO page load stuff, and one of the things that google suggest is adding asyng to the script tags to they load the page faster.
Heres the suggestions:
https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fhardscapedesigns.com%2F&tab=desktop
Most of the stuff I'm trying to edit is generated by wp_head function. Does anyone know how I can add async to those script tags, I'm not able to find the exact place to edit that HTML. I know there some plugins that supposably do this, but I'd rather do it manually since they seem to break my site
Just add the async keyword in your script tags. Using a plugin for such petty tasks is very wastefull.
Your script tags should look something like this-
<link async type="javascript/text" href="THE_URL"/>

How does one inject variables into page templates from a custom Drupal module?

We've created a custom module for organizing and publishing our newsletter content.
The issue I'm running into now -- and I'm new to theming and Drupal module development, so it could just be a knowledge issue as opposed to a Drupal issue -- is how to get each newsletter themed.
At this point the URL structure of our newsletter will be:
/newsletters/{newsletter-name}/{edition-name}/{issue-date} which means that we can create template files in our theme using filenames like page-newsletters-{newsletter-name}-{edition-name}.tpl.php, which is great. The one issue I'm running into is that all of the content comes through in the $content variable of the theme. I'd like to have it come through as different variables (so that I can, inside the theme, place certain content in certain areas.)
Is there a proper way for doing this?
Edit: To answer some questions: The issue is a node (there are issue, edition and newsletter nodes) and the path is being set using hook_menu with wildcards and a router.
The best answer I could find was to add a check inside of phptemplate_preprocess_page to send the vars back to the module and have them be updated.
Like so:
function phptemplate_preprocess_page(&$vars) {
if (module_exists('test_module')) {
_test_module_injector($vars);
}
}
then in my test_module.module file I created this function:
function _test_module_injector(&$vars) {
$vars[] = call_to_other_functions_to_load_vars();
}
It seemed to work. I wish there was a way to do this without having to touch the theme's template.php file, but otherwise this works well.
If there were better documentation for template preprocess functions, Drupal would be a lot more accessible - as it is, you need to piece together the information from a lot of different explanations. One place to start is here:
http://drupal.org/node/223430
but if you take the time to work through the tutorial below, you'll find you can do most things:
http://11heavens.com/theming-the-contact-form-in-Drupal-6
This is an old post, and the OP's issues seems to have been solved.
However, just for others finding this through Google (or otherwise):
Install the 'Devel' module: http://drupal.org/project/devel
Also the 'Devel Themer' module: http://drupal.org/project/devel_themer
Use Devel Themer to go through the $content variable and find what you need to pull out.
There are a bunch of Devel/Themer docs/tuts out there, but its usage is pretty straightforward. Note, though, that some stuff in there will need to be sanitized before printing in the theme.
The suggestion to show the node as a View and then modifying the view templates sounds pretty crazy, though it'll work.

Resources