Questions tagged [wp-head]
Uses do_action() Calls 'wp_head' hook.
227
questions
0
votes
4
answers
8k
views
Different favicon on different pages
Is it possible to have different favicon on on different pages?
For example:
mywebsite.com/blog-1 -> favicon-1
mywebsite.com/blog -> favicon-2
And so on.
I have custom domain name for each ...
16
votes
2
answers
40k
views
Add <meta> tags to the <head> section via functions.php
I've got a custom theme I've developed and it's basically a 4 page brochure site for a client and I've managed to do away with a few plugins by building in custom-post-types, gzipping via .htaccess ...
1
vote
2
answers
2k
views
Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
I need unregister this enqueue style of wp_footer() hook and add it to the top of site with hook wp_head(), this is possible?
I'm optimizing my theme to validate in W3C, and one of the requirements ...
3
votes
3
answers
13k
views
How to load different css file for different pages
I have several different pages. Every one of them has different css links. Rather than the css links all items are same in the head element of those pages.
I need to shift those head element to header....
2
votes
1
answer
1k
views
Header has extra HTML block at top before my code
I've been trying to fix the issue where wp_head loads in the body tag in wordpress, and I've discovered that when I look at the page source, an extra HTML block appears before the code from my header....
0
votes
1
answer
4k
views
"Warning: count()" printing in Page templates
I recently made a local copy of an existing site to make development changes. Most everything is working fine in the local version, except that at the top of any Page I see this error (sometimes more ...
0
votes
1
answer
281
views
Update javascript URL in header - Domain Mapping Plugin [closed]
I am seeing the following script being called in my wp_head(); it is associated with the Domain Mapping plugin.
<script type="text/javascript" src="http:/mywebsite.com/dm-sso-endpoint/1510878861/?...
1
vote
1
answer
3k
views
wp_head hook by page ID [closed]
I need help with this
/* meta description to head */
add_action( 'wp_head','carlos_head_meta_page' );
function carlos_head_meta_page() { ?>
<meta name="description" content="vale here"...
-1
votes
1
answer
900
views
Front End Page Not Loading Header Footer
I followed the directions at http://blog.frontendfactory.com/how-to-create-front-end-page-from-your-wordpress-plugin/ and it works but the header and footer do not load.
Here is my page: http://...
0
votes
0
answers
25
views
Placing CSS/ JS into the header or footer (inline) - trying to apply to several templates
The below code works perfectly well thanks to this help from a previous question I posted.
The code that I've posted directly below injects CSS (or JS) into the wp_head of WordPress....
My question ...
2
votes
0
answers
75
views
Trying to inject twitter metadata into <head> using wp_head action in functions.php - get_the_excerpt() returns null
So I followed the "Add Twitter Cards without plugins" this tutorial for how to add twitter metatags into the header using the wp_head method.
I have pretty much taken the code as is, and put it in ...
0
votes
1
answer
158
views
Wrong image path within inline styles in the head
I'm adding some inline styles to the <head> using file_get_contents(some-style.css) and the wp_head hook. My relative image paths don't work once they are added to the head, although they do ...
0
votes
0
answers
63
views
How can I edit a meta description
A shortcode that I'm using in the beginning of each post is somehow getting into the meta description. After trying to figure out why I decided to simply do a preg_replace for the meta description, ...
0
votes
1
answer
629
views
Load admin bar without wp_head or wp_footer [duplicate]
Is there any possible way to load admin bar without wp_head or wp_footer? If no, so maybe there is a way to load wp_head() or wp_footer() to catch only admin bar functions, styles and scripts? Is this ...
2
votes
0
answers
687
views
wp_head function causes 30px blank space [closed]
I want my outer-wrapper to be full screen, but if use wp_head(); function it causes nearly 30px blank space from the top. If I use #outer-wrapper: margin: -30px auto; this time there is 30px blank ...
0
votes
2
answers
4k
views
How to properly insert a stylesheet in wp_head
I am generating critical CSS for every page and category. At the moment I am inserting the stylesheet through functions.php like this simply using echo.
function criticalCSS_wp_head() {
if (...
0
votes
1
answer
24
views
Edit meta fields from within template
I am sure this has probably been asked before, but I've tried all sorts of searches and cannot find a definitive answer. Maybe it's just not possible!
I have a directory of users (displayed using an "...
0
votes
2
answers
1k
views
Add inline style to pages where shortcode was used
I am trying to add a style to the header, using this method the style only loads on single posts but if I use a shortcode to load the post content that style does not load in the header:
add_action( ...
1
vote
3
answers
9k
views
Remove meta description on certain pages
Wordpress renders a meta description tag with the content of the blog post as the value for the description.
I already generated in the header.php what I want the description to be, no matter what. ...
1
vote
0
answers
317
views
wp_head function not outputting
I've been trying to figure out what I could possibly be doing wrong with this plugin I just coded, from what I see, everything should be working correctly. However, it's not doing anything at all. No ...
1
vote
1
answer
1k
views
Removing Visual Composer head meta (works alone but not with IF)
I'm trying to remove the head meta added by VC, namely "meta name="generator" content="Powered by Visual Composer - drag and drop page builder for WordPress".
If I add:
add_action('init', '...
0
votes
1
answer
48
views
Calling JavaScript for specific page irrespective of whichever theme you select
I recently added a JavaScript file that pulls JSON data and updates the div tag on specific page of my WordPress, now to apply the JavaScript file to the page I added to header tag in the theme and ...
4
votes
2
answers
2k
views
How can I get wp_head() as a string instead of echoing it?
I'm using PHP handlebars templates and would like to keep all of the HTML in the template file so I don't have a header.php but rather the handlebars looks like
<html>
<head>
{{#...
3
votes
2
answers
430
views
Track down where script is being enqueued from
I have a WordPress site with an SSL certificate. It all works fine, except that this little insecure shield icon shows up because the header has an enqueued non-https script.
The issue is that I ...
0
votes
1
answer
2k
views
Auto Generated HTML source code formatting
I've had this question for a long time and I was wondering if anyone had an answer for it. I know its not really important, but for someone like me who really likes very clean markup things like this ...
1
vote
4
answers
12k
views
Remove all theme CSS & JS from wp_head (but only for 1 page template)
I have a page template, which is working nicely. But when I include , it loads the themes CSS and js files, which breaks my page template.
However, I still need the wp_head for some plugins to work.
...
2
votes
4
answers
21k
views
How can i remove JUST the title tag from wp_head() function?
i'm using wordpress 4.6
i'd like to remove just the title tag automatically outputted by wordpress because need to hardcode the html title tag in the template.
i guess is something like this:
...
0
votes
1
answer
546
views
Adding code to head to all pages manually
I've been googling for days and I didn't find a solution. I need to add a JS code to the head of all my pages, and I wanna do that manually (without a plugin).
I found a '~/wp-content/themes//header....
0
votes
2
answers
1k
views
Include HTML (Bootstrap Modal Box) with a plugin into my header
I want to include some HTML, spezific a bootstrap modal box.
This is my function with the HTML part:
public function dmd_fav_modal_box() {
$content = '<div class="modal fade" id="...
3
votes
4
answers
6k
views
Modify page title format (when using title-tag)
Currently my page titles are handled by WordPress, in a call to wp_head (I have add_theme_support( 'title-tag' ) in functions.php). I'd like to change the page title format for category archives - ...
1
vote
1
answer
67
views
What is the safe way to print tracking code / pixel code before </head> tag or </body> tag
What is the safe way to print tracking code / pixel code before </head> tag or </body> tag from theme options.
In header.php I printed the following code before the </head> tag
if (...
3
votes
3
answers
15k
views
Remove rel='dns-prefetch' href='//maps.google.com' from wp-head
How to remove this from WP head:
<link rel='dns-prefetch' href='//maps.google.com'>
I had this also:
<link rel='dns-prefetch' href='//s.w.org'>
But, I removed it with this code inside ...
2
votes
2
answers
4k
views
How to add inline css/js inside a shortcode
I'm working on creating a shortcode which is meant to change the css and js dynamically for that shortcode based on the situation. Now the problem is that I not getting a clue about how to use ...
1
vote
1
answer
1k
views
Custom field as meta description
I want to make a description input field inside the normal post adding page (in the dashboard) so each time I'm posting something I'll be able to handle the description as I like. Then I would target ...
0
votes
1
answer
476
views
Output dynamic_sidebar_params in wp_head
I have created a custom widget with a color picker field. Currently there are two ways to output the color picker value for this widget:
Inline style.
Using the dynamic_sidebar_params filter. With ...
0
votes
1
answer
6k
views
Cannot retieve the_content() and the_author() - both returning empty strings
I am creating the following code to display open graph meta data in the header of my single.php page
add_action('wp_head', 'mycode_add_og_meta_tags', 5);
function mycode_add_og_meta_tags () {
?>
...
3
votes
2
answers
227
views
Display custom_background outside wp_head()
My theme is a very small one page theme which really doesn't need all the scripts, so I've created a few options to remove wp_head() and wp_footer() so the user can choose if they want to enable or ...
5
votes
1
answer
8k
views
Change Page's <title> Tag Using functions.php File
In my child theme's functions.php file, I'm trying to change a page's title tag:
function custom_title() {
return "Page Title";
}
add_filter( 'wp_head', 'custom_title', 9999 );
The code above is ...
0
votes
1
answer
241
views
How to hook into <head></head> container
I want to add my own <meta /> tag inside the <head></head> container on every page or post within the loop().
Is that possible?
What hook(s) should I use for that?
7
votes
3
answers
12k
views
Is there a way to read or list wp_head() contents?
I am working on a CSS and JS compiler and need to find a way to list the contents of wp_head()
I am trying to get a list of all CSS/JS files and inline CSS on any give page.
Hooking on the wp_head ...
0
votes
2
answers
3k
views
Custom script file enqueue has "?ver=4.5.1" when loading and doesn't update
I'm loading a custom script file using an enqueue and here's the output:
<script type='text/javascript' src='.../wp-content/themes/enfold-child/js/custom_script.js?ver=4.5.1'></script>
...
0
votes
2
answers
766
views
How to get a single hook from wp_head()?
I am working on a custom post type and I don't want it to get all the clutter from wp_head(). However, I do want to show a specific hook, for example the YoastSEO meta tags.
How do I call a specific ...
0
votes
1
answer
104
views
How to check widget-cpt meta and display its custom css in the head?
When dealing with a widget that is a custom post type, is there a way to detect when that widget is displayed, then check its post meta for any custom css and enqueue it in the head of the site?
...
3
votes
2
answers
6k
views
Putting content into header.php without using wp_head
I am building a plugin. I have to output certain stuff in the header.php file of the theme depending on if/else I will write. However I am not at that point yet. I just learned in order to push the ...
0
votes
2
answers
5k
views
How to output wp_enqueue_style() in HTML head instead of footer
I added some actions to wp_enqueue_scripts to load my custom css and js files in the header section by using wp_head(); right before the closing </head> tag.
function mytheme_scripts(){
// ...
6
votes
3
answers
7k
views
How to control initial wp_head() output?
I followed the common advise to use wp_head() in header.php and wp_enqueue_scripts() instead of hard linking css and js files in header.php.
However, I realized that wp_head() outputs lots of stuff I'...
0
votes
1
answer
96
views
Grab ID from post from plugin and use it to create an object
I want to create an object and set ID for this object
like
$p = new Product(87);
I have this code within a plugin and I want to grab the ID of the custom post being showed:
function getPostId(){
...
2
votes
1
answer
5k
views
Remove specific CSS and JS from the head
I'm trying to remove some specific lines from the WP_HEAD. Now my header looks following way:
<link rel='stylesheet' id='bootstrap-css' href='/themes/wp-e/css/bootstrap.css?ver=4.2.2' type='text/...
7
votes
3
answers
2k
views
Any advantage of using wp_scripts and is_IE when enqueuing scripts
I read on the WP docs, which pointed to this gist that the correct way to enqueue styles for IE is by using the $wp_styles. I'm guessing that this would be true then for scripts as well.
Take these ...
0
votes
1
answer
1k
views
custom COOKIE on custom page
i have problem with create function for set cookie dynamically.
when i try in custom page i have of course header is set and i tried something like this:
in custompage.php:
myfunction($cookiename,$...