wp_head() gives me some weird CSS

The fact that <style type=”text/css” media=”screen”> html { margin-top: 32px !important; } * html body { margin-top: 32px !important; } @media screen and ( max-width: 782px ) { html { margin-top: 46px !important; } * html body { margin-top: 46px !important; } } </style> is added for Admin bar by wp-core at the top of … Read more

Is there a way to read or list wp_head() contents?

I wanted to search-and-replace in the header, but Neither @majick or @Samuel Elh answers worked for me directly. So, combining their answers I got what eventually works: function start_wp_head_buffer() { ob_start(); } add_action(‘wp_head’,’start_wp_head_buffer’,0); function end_wp_head_buffer() { $in = ob_get_clean(); // here do whatever you want with the header code echo $in; // output the result … Read more

Two title tags in my header

The two title tags can be explained as that you are using a theme that is written for WordPress4.1 and actually is using 4.1. As from 4.1 you don’t need to call wp_title() in the head any more, you can make use of new title_tag theme support tag which automatically adds the wp_title() tag in … Read more

Remove meta robots tag from wp_head

add_filter(‘wpseo_robots’, ‘yoast_no_home_noindex’, 999); function yoast_no_home_noindex($string= “”) { if (is_home() || is_front_page()) { $string= “index,follow”; } return $string; } this should be fine i think.. somewhere in your theme functions.php and should do the trick.

Any advantage of using wp_scripts and is_IE when enqueuing scripts

To extend on @gmazzap suggestion on not using globals when you can use wp_scripts(), there is a shortcut for wp_scripts() for adding conditional comments called wp_script_add_data and likewise wp_style_add_data for conditional styles. So the correct way to use conditionals as of WordPress 4.2 is like this: /** * IE enqueue HTML5shiv with conditionals * @link … Read more

How can i get the name parameter defined in get_header?

There is an action get_header that you can use. In your theme’s functions.php, register a callback for that action: add_action( ‘get_header’, function( $name ) { add_filter( ‘current_header’, function() use ( $name ) { // always return the same type, unlike WP return (string) $name; }); }); You could also write a little helper class that … Read more

force enqueue script to be first in order of prominence

You just need to enqueue your scripts before plugin does it. You can do it by setting priority to 0 for your hook. For example, do the following: add_filter( ‘wp_enqueue_scripts’, ‘wpse8170_enqueue_my_scripts’, 0 ); // or if you enqueue your scripts on init action // add_action( ‘init’, ‘wpse8170_enqueue_my_scripts’, 0 ); function wpse8170_enqueue_my_scripts() { wp_enqueue_script( ‘myscript’, ‘http://path/to/my/script.js’, … Read more

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