Questions tagged [wp-head]

Uses do_action() Calls 'wp_head' hook.

49 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
50 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 ...
2
votes
1answer
4k views

Change meta tags programatically

Is there a way to change the meta tags not in the head but in a template file through code? I would like to change the meta tags <meta property="og:title" content="title" /> <meta ...
1
vote
0answers
281 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
1answer
56 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 (...
1
vote
0answers
309 views

How to disable/enable specific plugins for a mobile theme?

I would like to use a mobile theme for my website but not load all the plugins being used for the desktop version. Is there a way to achieve this without having to remove wp_head() from the theme and ...
1
vote
0answers
1k views

Adding Shortcode Values to wp_head

I'm trying to create a shortcode with attributes which then places the values in meta tags for SEO purpose. I know there a some plugins for this use, but I want a simple and reusable/extendable meta ...
1
vote
2answers
2k views

Edit title-tag in wp_head with yoast seo

I want to manipulate the html-title tag, so <title> these not the content of the title-tag! I use child-themes and it's inevitable, because the template have to be easy to update. So I have to ...
1
vote
0answers
181 views

How to modify default controls in Wordpress theme customizer

I'm trying modify the default control in the wordpress theme customizer specifically the action for the close button. By default clicking it will make you go back to the themes page, but I want it to ...
1
vote
2answers
541 views

CSS from textarea in options page to frontend what to do

I have a textarea for small css enhancements on the plugins page i output them directly to the head. My Question is how to sanitize the CSS i have validation function registered for the options with ...
1
vote
1answer
76 views

How to replace a function using a child theme?

I have the following function where I would like to replace the image nopic.jpg I have updated by deleting some redundant options. if ( ! function_exists( 'TaskerDev_get_first_post_image_fnc' ) )...
0
votes
0answers
11 views

Respond to wpnonce on front end

I've been doing some work recently with custom bulk actions and post row actions which hook into the admin_notices action to perform some function in the admin and return a notice with the result. ...
0
votes
1answer
21 views

Add head and body function for google tag manager in child theme

I've got a child theme activated and I don't see any head and body in my child theme to place the GTM snippet. How do I do this? I rather not paste in the whole head and body in the child theme to ...
0
votes
1answer
16 views

Custom page with WP Header showing Page not found title

I created a custom page to show data from the DB for an intranet site I have created. I used the following define('WP_USE_THEMES', false); require('../wp-blog-header.php'); get_header(); I read ...
0
votes
0answers
14 views

How to control where plugins will add Javascript code in the page structure

A number of plugins add Javascript code inside the <head> tag. I would like to move Javascript code at the end of my page to avoid it blocking the page from loading. I understand that ...
0
votes
0answers
16 views

Call text from ACF in function.php

I have given text field in ACF and i would like to call it on function.php, so that it will be displayed in my head section. I have researched it but i cannot make the text appear on head section. Can ...
0
votes
0answers
67 views

Getting the contents of wp_head while in admin?

I'm writing a plugin that helps show a flag if the site has a noindex tag in the header. I'm using the wp_head() hook twice like this: add_action('wp_head', function() { ob_start();...
0
votes
1answer
94 views

Add function to head “no product found”

I build my proper shop with ecommerce, and I'm beginner in development, I know correctly the CSS/HTML but JS he's not my tea cup... Actually, I want to display some products randomly in my "...
0
votes
0answers
22 views

Wp_head () affecting my images layout

So, I was trying to create a grid with different sizes, where when you clicked the image would zoom out and show the whole image. For this I need to apply overflow hidden so the images dont lose their ...
0
votes
0answers
16 views

How do I get a reference to the HTML memory buffer while the page is being constructed?

I want to view & update the buffer with html "<head>" data section in it, after the head has been generated. Problem statement: I have created some shortcodes in a plug-in which, if ...
0
votes
1answer
31 views

Inserting article:tags meta in html head-element, using get tags, no wp_head

I´m trying to add code to a template file of mine, working with a raw theme I generated from “”. The file is a duplicate of single.php and called single-post.php. Like WP states in Codex. I am trying ...
0
votes
1answer
345 views

Remove CSS & JS from <?php wp_head(); ?>

I've been with this problem for a couple of days and the truth is that I can not find a solution. I have added code manually in wp-header.php and now I need to delete these lines that it generates ...
0
votes
1answer
102 views

Modifying meta tags after doing ajax call in plugin

I have a plugin that will automatically load articles from a news publisher by checking query vars in the URL. If an article was requested, it does an AJAX call to this publisher, creates a new ...
0
votes
0answers
65 views

How to store wordpress functions (wp_head(),wp_footer()) in a javascript variable?

how to store wp_head() and wp_footer() in a javascript variable ? var s = ''; <?php ob_start(); wp_head(); wp_footer(); $string = ob_get_contents(); ob_end_clean(); var ss = '&...
0
votes
2answers
2k 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 ...
0
votes
1answer
566 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
0answers
22 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 ...
0
votes
0answers
53 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
1answer
17 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
3answers
4k 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. ...
0
votes
1answer
641 views

How to remove page title from wp head on specific page?

I'm trying to remove page title from a template. Actually I'm using custom in title for singledigital.php template, and wp_head also adding page title on this page. So i want to remove it. I have ...
0
votes
1answer
377 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
1answer
76 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? ...
0
votes
1answer
688 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,$...
0
votes
0answers
171 views

Put dynamic Javascript in header after doing operations

I want to write a plugin that enables a function to be put in my theme in various places. Then I would like to collect the parameters called and generate a Javascript and put it into my site <head&...
0
votes
2answers
394 views

How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?

How do I add Facebook OpenGraph tags in the header when the header has already been called, and the values I need to add are obtained in the body? This is a highly customized theme (which I did not ...
0
votes
2answers
406 views

Hide page name in wordpress page title

In my pages title I got for example "home-my title' and 'Books Archieves- my title', I want to drop those prefixes so I have only on page (home) 'My title' and on archive(category) 'Books- my ...
0
votes
2answers
115 views

Manually add admin bar

Does anyone know how to include the admin bar in a page template where wp_head() and wp_footer() are not present? I'm developing a template other scripts and styles are just getting in the way. Rather ...
0
votes
1answer
326 views

unable to override style block within wp_head()

I am using the wpbootstrap theme based on bones. I noticed that my website had a white band along the top and I haven't been able to workout what was causing it however I have finally worked it out. ...
0
votes
0answers
748 views

wp_footer hook only working on homepage not in other pages

I try to output a javascript code in wp_footer hook but it is not printed in all pages it is working in home page only. I have checked for the presence of wp_footer(); function in footer.php it is ...
0
votes
2answers
159 views

Is this a bad approach to add conditional comments to wp_head?

Why people say this is a bad approach to add conditional comments to wp_head? For example: function add_ie_html5_shim () { echo '<!--[if lt IE 9]>'; echo '<script src="http://...
0
votes
1answer
468 views

Proper after_setup_theme and wp_head cleanup

Im trying to clean up code in my theme a little bit, remove some of the code that is not used and basically do things the right way, to decrease load time etc. Currently I have this code: add_action(...
0
votes
0answers
196 views

why php tag is not working if i store and show it in wp_head?

hi i used wp_head a couple of times.I echoed some values it works like below function test() { echo "hello am visible"; } add_action('wp_head','test'); but if i store a php code in db and retrieve ...
0
votes
1answer
195 views

Background of default template showing instead of the background of custom page template

Plugins were not working for my custom page template, found out that I needed to put WP_head() and WP_footer(), so did that and the plugins started to work. But now the background changed to that of ...
0
votes
1answer
34 views

Post Attachment missing head (stylesheets/js/what-not)

I am using a modified 2011 theme, I got the single post to look fine but my single attachment is not working. I'm told this will default to the page.php if I do not have an attachment template. So, ...
0
votes
1answer
2k 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(){ // ...
0
votes
1answer
385 views

Add OG meta tags to wp head

I'm using gravity forms and on thank you page I would like to be able to add some of the fields into to head OG meta tags. So far I have this: After Gravity forms submission we get the needed fields ...
-1
votes
1answer
134 views

Particular meta tag - viewport - insertion when dealing with plugin

I am dealing with a plugin, not with a theme, but what I want is to include this meta in the head section. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> ...
-1
votes
1answer
58 views

Add PHP code to header section from plugin

How can i add any type of PHP code to header section through plugin programmatically ? I did use add_action('wp_head', 'your_function'); function your_function() { echo ...
-1
votes
1answer
82 views

Head Code for Custom Taxonomy

There is one custom taxonomy (STORE) and i want to add this code to one taxonomy only <link rel="alternate" hreflang="fr" href="http://www.domain.com/fr" /> What code shall i use?