Add HTML to single post tag

I found the best solution was to add a custom field, head, and then build a short plugin to add the contents to the head tag: add_action(‘wp_head’, ‘add_HTML_head’); function add_HTML_head(){ global $post; if(!empty($post)){ // get custom field for ‘head’ $headHTML = get_post_meta($post->ID, ‘head’, true); if(!empty($headHTML)){ echo $headHTML; } } } I’ve packaged it up into … Read more

Filter out some plugin action in wp head / wp_footer

You can try this (untested): add_action( ‘wp_head’, function(){ // your conditions: if( is_home() || is_category() ) { // access the global SyntaxHighlighter object instantiated at ‘init’. global $SyntaxHighlighter; // remove your action hooks: remove_action( ‘wp_head’, array( $SyntaxHighlighter, ‘output_header_placeholder’ ), 15 ); remove_action( ‘wp_footer’, array( $SyntaxHighlighter, ‘maybe_output_scripts’ ), 15 ); } } ); to remove these … Read more

How to add iOS & fav icons to the theme?

Hook into wp_head in your functions.php file. add_action(‘wp_head’, ‘add_your_stuff’); function add_your_stuff() { ?> <link rel=”shortcut icon” href=”https://wordpress.stackexchange.com/questions/157869/<?php echo get_stylesheet_directory_uri();?>/favicon.ico” type=”image/x-icon” /> <link rel=”apple-touch-icon” href=”<?php echo get_stylesheet_directory_uri();?>/apple-touch-icon.png” /> <link rel=”apple-touch-icon” sizes=”57×57″ href=”<?php echo get_stylesheet_directory_uri();?>/apple-touch-icon-57×57.png” /> <link rel=”apple-touch-icon” sizes=”72×72″ href=”<?php echo get_stylesheet_directory_uri();?>/apple-touch-icon-72×72.png” /> <link rel=”apple-touch-icon” sizes=”76×76″ href=”<?php echo get_stylesheet_directory_uri();?>/apple-touch-icon-76×76.png” /> <link rel=”apple-touch-icon” sizes=”114×114″ href=”<?php echo get_stylesheet_directory_uri();?>/apple-touch-icon-114×114.png” /> … Read more

Deregister CSS style link ‘open-sans-css’

WP Core actually uses Open Sans font; it’s not a plugin. there is a plugin that removes it, but you can probably simply dequeue or deregister it. adding this to functions.php should work; if you want it removed from the backend as well, hook into the admin_print_styles action. function dequeue_opensans_css() { wp_dequeue_style( ‘open-sans’ ); } … Read more

wp_head() not inserting the default stylesheet style.css

Actually you shouldn’t add JS and CSS files to your header.php, but make use of the functions wp_enqueue_script() and wp_enqueue_style() to add them there. Example taken from the codex page: /** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true … Read more