• Resolved burakb

    (@burakb)


    Hey all,

    I’m on my way to building a custom homepage for my wordpress blog. I tried to put a javascript slider to the homepage. Although the js slider works fine on an html page when it is included on my wordpress home page, it does not work at all. Since I’m very new to javascript I have no idea how to fit this code into my custom wordpress page.

    Any help I would appreciate.

    All the best
    Burak

    Here is my code that works absolutely fine on an html made page:

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Create a custom template for your homepage and put your JavaScript there. Alternately, code a widgetized area into the appropriate spot in whatever existing template you’re using, and put your JavaScript into a text widget.

    Hey Burak,
    Adding JavaScript right in your template could lead to problems with plugins and such later. You might consider seeing if an existing slider plugin meets your needs. Commonly, the slider plugin would include a template tag you could easily place in a custom template as zoonini recommends.
    Paul

    @freakingid is absolutely right in that you do need to be careful if calling in JavaScript libraries such as jQuery manually, to be sure they don’t conflict with libraries already called in by WP core or plug-ins. There is a method for doing this called “enqueuing” if you want to learn more. Otherwise, looking for a slideshow plug-in – as freakingid suggests – is often a very simple route to take.

    Thread Starter burakb

    (@burakb)

    Thank you so much guys. I decided to use the anything slider plugin. It is a great solution for dummies like me. All the best.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to include javascript’ is closed to new replies.