I am not such a great coder, this is what I found inside functions.php:
add_shortcode('akkordeon', 'nr_shortcode_akkordeon');
function nr_shortcode_akkordeon ($aArguments, $sInnerContent, $sShortcode) {
$aArguments = nr_digest_shortcode_arguments($aArguments);
global $aAkkordeonBereiche;
$aAkkordeonBereiche = array();
$sInnerContent = nr_process_standard_content($sInnerContent);
$sAkkordeonHtml = '';
foreach ($aAkkordeonBereiche as $aBereich) {
$sBereichHtml = '
<div class="na_bereich">
<h3 class="nas_head">' . $aBereich['aArguments']['ueberschrift'] . '</h3>
<div class="nas_body standard_content">' . $aBereich['sInnerContent'] . '</div>
</div>
';
$sAkkordeonHtml .= $sBereichHtml;
}
global $iAkkordeonNr;
$iAkkordeonNr = intval($iAkkordeonNr) + 1;
$sID = 'nat_akkordeon_' . $iAkkordeonNr;
$sScript = '
<script type="text/javascript">
//<[CDATA[
(function () {
var oData = {};
oData.sNr = "' . $iAkkordeonNr . '";
oData.sID = "' . $sID . '";
oData.jAkkordeon = jQuery("#" + oData.sID);
oData.jAkkordeon.data("oAkkordeonData", oData);
oData.aSections = [];
var jSections = oData.jAkkordeon.find(".na_bereich");
for (var iS = 0; iS < jSections.length; iS ++) {
var oSection = {};
oSection.jSection = jSections.eq(iS);
oSection.jHead = oSection.jSection.find(".nas_head");
oSection.jBody = oSection.jSection.find(".nas_body");
oSection.bOpen = true;
oSection.open = function () {
this.jBody.show();
this.bOpen = true;
}
oSection.close = function () {
this.jBody.hide();
this.bOpen = false;
}
oSection.jHead.data("oSectionData", oSection);
oSection.jHead.click(function(){
var oSection = $(this).data("oSectionData");
if (oSection.bOpen) {
oSection.close();
} else {
oSection.open();
}
});
oSection.close();
oData.aSections.push(oSection);
}
})();
//]]>
</script>
';
$sAkkordeonHtml = '<section id="' . $sID . '" class="nat_akkordeon">' . $sAkkordeonHtml . '</section>' . $sScript;
return $sAkkordeonHtml;
}
The theme was developed especially for this website, so is this what is causing the problems and how can I enqueue the script the right way?
Thanks!