child theme problems with adding some scripts
-
Hi everyone,
The problem I get, it takes along time. It is about adding some application scripts which are related to third party websites. When I try to add them into functions.php file in my child theme, I get that classical warning about ” ….Cannot modify header …..sent by (outsourced of …../child-theme/functions.php 12…14…etc ) … /wp-icludes/pluggable.php 880 …. ” . And then I can’t log into my wp-admin !
Anyway…when I try to contact to my host provider, they told me that cause of my theme. So, I am here to get the right solution. BTW, I try to complete and solve that solution whether if there is an opening before or at the end of ( <?php , <?). So, it didn’t help me.
I hope, I don’t do anything false…because as far as I know, I should put those kind of codes in functions.php. Well, some codes should be added before <head> or <body> tags and so on. Or not ??!
Because of this problem, I can’t use some applications properly.
Well,maybe I wrote a little confusing..but this is my case too… 🙂 So,could anyone help me please ?
Ohhh…btw..my site is : http://merryandhealthy.com
Where do you want to put your scripts? If it is before the closing
</head>
tag, you can just go to Graphene Options –> Advanced and throw your code inCustom <head> tags
region.Thank you Prasanna…. Could you tell me also if it should be before the </body> tag, where I have to put the code ?
Mod
It depends on the scripts. Some go in the
<head>
element, and some parts get added to the<body>
tag, and some scripts need to go into a text widget. So it depends on what kind of script you have.Thanks Kenneth, I had asked that, in child theme where I have to put the script code which should be inserted before the </body> tag ?
I get this error always when I click on my dashboard-widgets and gaphene options ;
” Warning: Cannot modify header information – headers already sent by (output started at …. /public_html/wp-content/themes/graphene-child/functions.php:12) in ….. /public_html/wp-includes/pluggable.php on line 880 “
I had installed a quantcast code in my childtheme functions.php file.So, I deleted it but it still appears at me ! The weird thing in this matter, when I delete quantcast code, then on my website disappears another application by another site ( SiteLock Seal ).
Can anyone help me, please ?
Mod
Quote:Warning: Cannot modify header information – headers already sent by (output started at …. /public_html/wp-content/themes/graphene-child/functions.phpThe infamous “Cannot modify header information” error message in WordPress is usually caused by having characters (a space, a line return) before the opening
<?php
tag or after the closing?>
php tag. Take those out, reupload the functions.php file, and you should be good.<?php
function graphene_custom_header_width(){
return 1165;
}
function graphene_custom_header_height(){
return 99;
}
add_filter('graphene_header_image_width', 'graphene_custom_header_width');
add_filter('graphene_header_image_height', 'graphene_custom_header_height');
?>
<!-- Quantcast Tag -->
......This is what I have in my function.php. But this works well for a long time,actually since I changed the header image. So, where is the problem in this ? Could you make it clearer for me please ?
Mod
There should be nothing after the closing
?>
tag, or you will get this message. So everything after that (quantcast, etc.) must go.Scripts do not go in the functions file. It is, by definition, for functions.
Viewing 10 posts - 1 through 10 (of 17 total)
- 1
- 2
- You must be logged in to reply to this topic.