I asked this question on wordpress forum,seems like noone have any idea of this I am having to display both ad sense and cpalead javascript in all posts,so while making itself calling cpalead javascript for the header,what should I do with this? single.php starts with <?php get_header(); ?> <?php global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); } } ?> <div id="container"> <div id="left-div"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?>
No I dont want it to include the script in my main header.But only call it in single.php file as its header and retain the home and other pages without that script.I hope you understood what I meant,thnks in advance
No if I put that Javascript in my header,it will harm my search engine ranking,thats why I cant do that,what I need is to call the header function as a seperate .js file
I am not sure about your question. Still I think this 1) in single.php why cant you include the js script like this <?php echo "<script type='javascript'>"; include "your js file name with path"; echo "</script>"; ?> PHP: If you are trying to call the function inside the js file you can do it like this. <?php echo "<script type='javascript'>functionName();</script>"; ?> PHP: Hope this helps.