Site logo

Archived topic

Using jQuery in pages

8 replies · Started by Anonymous on September 8, 2014

Viewing posts 1–9 of 9

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?

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 :)

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.

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?

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 :)

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?

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

This archived topic is closed to new replies.