[Resolved] Using jQuery in pages

Home Forums Support [Resolved] Using jQuery in pages

Home Forums Support Using jQuery in pages

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #26262
    alw

    I have created a page template that incorporates the .css files, the .js files and the html code for a basic Accordion, such as that at http://www.jeasyui.com/demo/main/index.php?plugin=Accordion. It works fine if I remove the get_header(); from the template but, of course, there’s no header then! With that line in place, all styling is completely messed up.
    Is there a simple solution?

    #26347
    Tom
    Lead Developer
    Lead Developer

    Instead of removing get_header() – I would add your scripts to the header using GP Hooks.

    Link to the scripts in the wp_head section of GP Hooks using the method they show you in the example section when choosing an external script.

    Then the functionality should be ready to go on the page.

    Let me know if that makes sense ๐Ÿ™‚

    #26773
    alw

    Yes, thanks Tom. That makes sense, but I can’t find the example section! If I click “GP Hooks” in the plugins, I am redirected to wp-admin/options-general.php?page=gp_hooks_settings which gives a 500 error — although the page options-general.php is there and goes to General Settings without the querystring. Also https://www.generatepress.com/documentation/ seems to cover everything except GP Hooks.

    #26786
    Tom
    Lead Developer
    Lead Developer

    Wow – definitely shouldn’t be receiving a 500 error – you may want to contact your host about that and see if they can pinpoint the issue.

    As for the accordion – maybe using a plugin would be easier? http://premium.wpmudev.org/blog/10-wordpress-accordion-plugins/

    #26846
    alw

    I don’t get an error on wp-admin/options-general.php — only when the querystring is appended — which makes me think that there may be an internal redirection that causes the 500 error?

    I have already installed Shortcodes Ultimate (#5 in the “l0 Awesome Plugins”), which does support the Accordion and works. But I am left with the same problem of how to poulate the content of the panes/spoilers dynamically from a database. I want to use an AJAX Post to get the content, so will need to add script inside the content of the page. Can I use GP Hooks to do this?

    #26946
    Tom
    Lead Developer
    Lead Developer

    You can add the necessary scripts using GP Hooks – you just need to know what to add to it.

    From the link you sent, it seems you’ll need to download some files and upload them to your server, then link to them like in the example.

    Let me know if you need more guidance ๐Ÿ™‚

    #27161
    alw

    Tom, can you tell me where I can find the examples for using GP Hooks?

    Meanwhile, I found a nice way to implement AJAX Posts at http://premium.wpmudev.org/blog/how-to-use-ajax-with-php-on-your-wp-site-without-a-plugin/. It works great!

    #27214
    Tom
    Lead Developer
    Lead Developer

    As an example – in your first post you linked to those accordians.

    They ask you to add this to your head area:

    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>

    So you would upload the needed files and then link to them in the above href section.

    This would go into the wp_head section of GP Hooks.

    Does that make sense?

    #32584
    Tom
    Lead Developer
    Lead Developer

    Going to mark this resolved. Reply in here to re-open if you need to.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.