Need To Insert Javascript Into Php Code [wordpress Website]
Solution 1:
Ok, since we must be bow before the Altar of SEO...
a) Generate your JS snippet:
$date = get_the_time('F jS, Y');
$js = <<<EOL
<script language="javascript"type="text/javascript">document.write('$date');</script>
EOL;
b) Insert that snippet into the link:
sprintf( '<ahref="%1$s"title="%2$s"rel="bookmark"><spanclass="entry-date">%3$s</span></a>',
get_permalink(),
$js,
get_the_date()
Solution 2:
I don't think you understood the instructions properly. You shouldn't be doing anything to the PHP function that creates the datestamp. You need to replace the piece of code that calls the function in your template files.
There are 3 files you need to look at in your template - index.php, single.php, and archive.php. In those files look for the part of the file that displays the date. It looks like your template uses the function twentyten_posted_on to display the date so look for that. Once you find it, replace the whole thing with <script language="javascript" type="text/javascript">document.write("<?php the_time('F jS, Y') ?>");</script>
If you can't find it, post the contents of index.php so we can see how your template works.
Post a Comment for "Need To Insert Javascript Into Php Code [wordpress Website]"