Hello,
how can i do insert jquery code in wordpress widget area enfold theme? I use some plugins but doesn’t work.
Can you suggest me any plugin for widget area or how to connect an external javascript file to wordpress?
The code.
—————————-
<!DOCTYPE html>
<html>
<head>
<style>
#button_style {
background-color: #2d2d2d;
color: #fff;
padding: 6px 15px;
}
</style>
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script>
<script>
$(document).ready(function(){
$(“button”).click(function(){
$(“p”).toggle(1000);
});
});
</script>
</head>
<body>
<button id=”button_style”>Frequency Questions</button>
<p>First Question</p>
<p>Second Question</p>
<p>Third Question</p>
</body>
</html>
—————————-
Thank you
Hey Isakos-Soft!
Please add following code to Functions.php file in Appearance > Editor
function add_custom_code(){
?>
<script>
jQuery(document).ready(function(){
jQuery("button").click(function(){
jQuery("p").toggle(1000);
});
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_code');
Cheers!
Yigit
Sorry, don’t work right.
I add this button in Appearance – Widgets – Displayed Everywhere (sidebar), Visual Editor title FQ.
I want to work like toggle button. Repeat Show – Hide paragraph text.
Sorry, the code work perfectly. I fix it. I add class in paragraph.
Thank you
Hi!
You are welcome!
For your information, you can take a look at Enfold documentation here – http://kriesi.at/documentation/enfold/
And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/
For any other questions or issues, feel free to post them here on the forum and we will gladly try to help you :)
Regards,
Yigit