Home › Forums › Programming › Embed Javascript In WordPress
Tagged: embed, javascript, wordpress
- This topic has 11 replies, 2 voices, and was last updated 12 years, 5 months ago by Suresh.
- AuthorPosts
- April 29, 2012 at 6:26 pm#1560SureshMember
Anyone know how to embed Javascript in wordpress. But only for single post. If u guys know help me please. Thanks in Advance……
May 1, 2012 at 7:20 am#1564SatishKeymasterPlease let us know the exact need..
You can avoid writing external file for javascript, instead directly write the javascript inside the page where you want it to be used.
May 2, 2012 at 12:16 pm#1566SureshMemberNot possible to link from external ? i don’t want to write directly. I want to embed from external….
May 4, 2012 at 6:32 am#1568SatishKeymasterIf you link a external js file, then it must be included in between head tag. If you are using includes or other similar function to include the same header file to all your pages, then you can’t embed it only to a single page. instead, you can embed it in head section and use it only in one single page.
May 5, 2012 at 4:05 am#1569SureshMemberCan you tell me how to embed in single page and is that possible to create a custom page (custom code) in wordpress ?
May 11, 2012 at 7:24 pm#1572SatishKeymasterSuresh, Explaining things with WordPress would get complex. Because its internal structure doesn’t look straight forward to beginners.
A Simple javascript example:
<html> <body> <script type="text/JavaScript"> <!-- document.write("Hello World!") //--> </script> </body> </html>
this would print Hello World! on the web page.
May 12, 2012 at 3:26 pm#1575SureshMemberThanks for your reply. Btw I found it myself. There is a plugin name : inline-javascript.. You need to add [inline] [/inline] into the post.
May 12, 2012 at 4:09 pm#1576SureshMemberCan you tell me one more thing ? that is about session count in php.
< ?php if($_SESSION['count']
This is if condition. But the result is only for few counts and also it shows the both “your sesseion count” and “The next 50 numbers is “. I want to remove the “Your session count” and instead of that , i want add “The Next 50 numbers is ” upto 100 counts. Can you tell me how to do that please ?
May 12, 2012 at 4:12 pm#1577SureshMember< ?php if($_SESSION['count']
May 12, 2012 at 4:13 pm#1578SureshMemberCan’t add code. I tried many times… Just assume and tell me please. I want to get statement from 1 to 50 numbers and next 50 numbers need to get another statement. Thanks
May 13, 2012 at 5:17 am#1581SatishKeymaster<?php if(isset($_SESSION['count'])) if( $_SESSION['count'] <= 50 ) echo "First 50 counts"; else if( $_SESSION['count'] > 50 && $_SESSION['count'] <= 100 ) echo "Count from 50 to 100!"; else echo "Count about 100"; ?>
May 15, 2012 at 4:57 am#1582SureshMemberThanks….
- AuthorPosts
- You must be logged in to reply to this topic.