Adding Plugin Assets to Header

I finally done like this: $form_styles_header = [ “1” => “forms/vendor/bootstrap/css/bootstrap.min.css”, “2” => “forms/fonts/font-awesome-4.7.0/css/font-awesome.min.css”, “3” => “forms/vendor/animate/animate.css”, “4” => “forms/vendor/css-hamburgers/hamburgers.min.css”, “5” => “forms/vendor/animsition/css/animsition.min.css”, “6” => “forms/vendor/select2/select2.min.css”, “7” => “forms/vendor/daterangepicker/daterangepicker.css”, “8” => “forms/css/util.css”, “9” => “forms/css/main.css”, “10” => “table/css/table-styles.css” ]; foreach ($form_styles_header as $no=>$form_style) { wp_enqueue_style(‘du_form_style’.$no, $d_utility_url.”/assets/”.$form_style); } where $d_utility_url is the path to my plugin. … Read more

How to load a stylesheet into wp_head from a custom widget?

There are various approaches (including this one), but you could consider, since you’re talking about a stylesheet and not a script, simply enqueueing it from the Plugin, regardless of whether the Widget is active. (Which is worse: the few bytes of Widget-specific CSS, or the server overhead to determine if the Widget is active?) Just … Read more

making a plugin that moves other plugins wp_head actions to wp_footer

Remove the action, then add it back on a different hook. I think the only concern you could have with doing this is ensuring you do that late enough for the action to have been hooked, it should possible using the plugins_loaded hook(because that runs after plugins have loaded). add_action( ‘plugins_loaded’, ‘juggle_sharethis_action’ ); function juggle_sharethis_action() … Read more

Why does WP load so many files in the head of source code? How do I optimize it?

First of all, search this site. This questions has been answered many times in the past: https://wordpress.stackexchange.com/search?q=clean+wp_head and https://wordpress.stackexchange.com/search?q=security+obscurity Secondly, there is a difference in what WP loads and what a theme and a plugin will load. Look in the theme functions file to see what the theme loads, i.e. javascripts and CSS. Look in … Read more

Remove swfobject.js in wp_head()

if you have unwanted javascript on your page, it usually comes from plugins. deactivate them, and see if the javascript is still there. if it still is, try updating wordpress, or switching to another theme. if not, activate the plugins one by one, and check which one is putting this script to your head. after … Read more

Display Something in the Header After All Styles are Loaded

Hook to wp_enqueue_scripts with a high priority number. For example: function load_my_style_wpse_90225() { wp_register_style( ‘mystyle’, get_template_directory_uri() .’/path/to/stylesheet.css’); wp_enqueue_style( ‘mystyle’ ); } add_action(‘wp_enqueue_scripts’,’load_my_style_wpse_90225′,1000); That should reasonably load last in line. Basically the same answer as here: Wooslider custom css Refernce http://codex.wordpress.org/Function_Reference/add_action

Set title of page using custom page template

For dog breeds, I added the following code to template pages, overwriting the WP SEO functions: function assignPageTitle() { // To set page title global $resultarray; return $resultarray->breed_title; } if ( uri_segment( 2 ) != ‘0’ ) { add_filter( ‘wpseo_title’, ‘assignPageTitle’ ); // WP SEO function overwritten } For a list of other WP SEO … Read more

Adding javascript to functions.php causes problems with my template

jQuery is already loaded with WordPress, so you won’t need <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”></script> When using jQuery with WordPress, you’ll likely require no-conflict wrappers : https://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers There are likely JS errors being outputted in your browser console, so giving us more info on errors can prove useful as well. There is definitely a better way – starting … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)