Embed Javascript In WordPress

Home Forums Programming Embed Javascript In WordPress

This topic contains 11 replies, has 2 voices, and was last updated by  Suresh 5 years, 3 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1560

    Suresh
    Member

    Anyone know how to embed Javascript in wordpress. But only for single post. If u guys know help me please. Thanks in Advance……

    #1564

    Satish
    Keymaster

    Please 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.

    #1566

    Suresh
    Member

    Not possible to link from external ? i don’t want to write directly. I want to embed from external….

    #1568

    Satish
    Keymaster

    If 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.

    #1569

    Suresh
    Member

    Can you tell me how to embed in single page and is that possible to create a custom page (custom code) in wordpress ?

    #1572

    Satish
    Keymaster

    Suresh, 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.

    #1575

    Suresh
    Member

    Thanks for your reply. Btw I found it myself. There is a plugin name : inline-javascript.. You need to add [inline] [/inline] into the post.

    #1576

    Suresh
    Member

    Can 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 ?

    #1577

    Suresh
    Member
    < ?php  if($_SESSION['count']
    #1578

    Suresh
    Member

    Can’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

    #1581

    Satish
    Keymaster
    <?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";
    ?>
    
    #1582

    Suresh
    Member

    Thanks….

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.