Support Forum

help w jquery problem with my theme

MS Michael Su
Michael Su
Member

Hello,

I’m having trouble with CodeCanyon’s Extensio theme.

 

Simplepress looks gorgeous on my site, www.sitrep.at , and we have the forum at sitrep.at/forum. Everything looks great, works well, but of course, the Add Topic button doesn’t work. Following the FAQs, it looks like the theme is calling google for jquery, resulting in the script error. I’ve contacted the author of this popular looking theme, but have not been able to get a response. Would you mind taking a look at the functions.php code and letting me know if there’s something I can do to fix the issue?

Following your advice to others, I enclose the original functions.php with the jquery calling to Google, and the sourcecode of the homepage. If there’s anything else I can do, please let me know. 

Many thanks in advance,

Michael

—

 

25 Answers

New Answer

MS Michael Su
Michael Su
Member

If it helps, I’m also getting the following error in the Simplepress log:

file: /simple-press/sp-api/sp-api-plugins.php
line: 82
function: Unavailable
Warning | closedir() expects parameter 1 to be resource, null given

 

 

YS Yellow Swordfish
Yellow Swordfish
Member

Look in the functions file and fnd the function:

function my_init_scripts() and right at thw top there are these three lines:

wp_deregister_script('jquery');
wp_register_script('jquery','http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false, '1.7.1');
wp_enqueue_script('jquery');

Just comment out the top two leaving the wp_enqueue_script() line to be processed.

The theme is loading a ‘tabs’ library and ‘accordion’ library it has supplied. These should really be loaded from the libraries supplied by WP especially as they will get out of date with the main jQuery version. But he is also loading a ‘tabs2’ script and I have no idea what that is and how it might interact. So I would try the one change first to see what happens and see if anything else gets broken by it.

 

MS Michael Su
Michael Su
Member

Hello Yellow Swordfish, and thank you for the suggestion!

Commenting out the first two lines fixed the Add Topic issue in SimplePress, while leaving tab & tabs2 (for a side bar menu) working. However, consistently, it breaks the Nivo-slider that’s on the homepage. I’ve updated the nivo-slider with the latest version, but still no go. I also edited the second line above to call from wp-content, which did fix the Add Topic, but broke the slider again.

Sorry to trouble you again, but would you have any idea for calling jquery just for the forum page, but not elsewhere?

 

Thank you very much in advance!!

 

YS Yellow Swordfish
Yellow Swordfish
Member

You could try using the

sp_is_forumpage()

function. Only perfoprm those changes if this is true…

MP Mr Papa
Mr Papa
Member

you can do a check…

if (sp_is_forumpage()) { # forum page stuff here } else { # non forum page }

MS Michael Su
Michael Su
Member

Thank you both for your help. I added the conditional per above, the main site works, slider works (actually onebyone), but still can’t get Add Topic to work. Would you mind checking my edits to this section? Very much appreciated your quick reply. Many thanks again!!

My forum page is just www.sitrep.at/forum/. The text below works for everything else except the Add Topic.

—–

 

function my_init_scripts() {

if (sp_is_forumpage()) {

wp_enqueue_script(‘jquery’); } else {

if (!is_admin()) {

global $shortname;

wp_deregister_script(‘jquery’);

wp_register_script(‘jquery’,’http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js’, false, ‘1.7.1’);

wp_enqueue_script(‘jquery’);

 

if (is_home() || is_front_page())

if (get_option($shortname.’_slider_type’) == ‘Piecemaker Slider’) {

wp_enqueue_script(‘jquery_swfobject’, get_template_directory_uri().’/js/piecemaker/swfobject.js’, false, ‘2.1’, false);

}

 

if ( (is_page_template(‘portfolio-two-sortable.php’)) || (is_page_template(‘portfolio-three-sortable.php’)) || (is_page_template(‘portfolio-four-sortable.php’)) ) {

wp_enqueue_script(‘jquery_isotope’, get_template_directory_uri().’/js/isotope/jquery.isotope.min.js’, false, ‘1.5.04’, false);

}

 

wp_enqueue_script(‘jquery_tabs’, get_template_directory_uri().’/js/tabs.js’, false, ‘1.0’, false);

wp_enqueue_script(‘jquery_tabs2′, get_template_directory_uri().’/js/tabs2.js’, false, ‘1.0’, false);

wp_enqueue_script(‘jquery_accordion’, get_template_directory_uri().’/js/jquery.accordion.js’, false, ‘1.0’, false);

 

wp_enqueue_script(‘jquery_caroufredsel’, get_template_directory_uri().’/js/jquery.carouFredSel-5.5.0.js’, false, ‘5.5.0’, false);

 

if (is_home() || is_front_page())

if (get_option($shortname.’_slider_type’) == ‘Accordion Slider’) {

wp_enqueue_script(‘jquery_accordion_slider’, get_template_directory_uri().’/js/accordion/accordion.js’, false, ‘5.5.0’, false);

}

 

//if (is_home() || is_front_page())

//if (get_option($shortname.’_slider_type’) == ‘OneByOne Slider’) {

wp_enqueue_script(‘jquery_onebyone_slider’, get_template_directory_uri().’/js/onebyone/jquery.onebyone.js’, false, ‘1.0’, false);

wp_enqueue_script(‘jquery_touchwipe’, get_template_directory_uri().’/js/onebyone/jquery.touchwipe.min.js’, false, ‘1.1.0’, false);

//}

 

wp_enqueue_script(‘jquery_prettyphoto’, get_template_directory_uri().’/js/jquery.prettyPhoto.js’, false, ‘3.1.3’, false);

wp_enqueue_script(‘jquery_main’, get_template_directory_uri().’/js/main.js’, false, ‘1.1.0’, false);

 

wp_enqueue_script(‘jquery_validationengine_lang’, get_template_directory_uri().’/js/contact/languages/jquery.validationEngine-en.js’, false, ‘1.0’, false);

wp_enqueue_script(‘jquery_validationengine’, get_template_directory_uri().’/js/contact/jquery.validationEngine.js’, false, ‘2.5.1’, false);

 

} }

}

YS Yellow Swordfish
Yellow Swordfish
Member

As far as I can see it should be OK. When you load a forum page, have you checked the source code being generated to see if jQuery is still being served up from google?

MS Michael Su
Michael Su
Member

Thank you for replying.

Keeping with the above code edit:

On the forum page, nothing is being called from google (except fonts), only locally, but Add Topic is still not working.

 

On the other pages, all the sliders and tabs are working just fine.

I then tried a jquery plugin to update the wp jquery to the latest version thru WP jQuery Plus.

 

I’m so stuck! Thank you for keeping on top of this.

 

 

MS Michael Su
Michael Su
Member

I also changed themes, which corrected the Add Topic issue. So it’s only the theme I’m using, for which I can’t get a response from the author….

 

 

YS Yellow Swordfish
Yellow Swordfish
Member

I just loaded a forum page and it look to me like the main jQuery library is still being called from google (ajax.googleapis.com).

That may not be the only problem by the way but still has to be sorted first. SO… is this WITH the code change we made earlier?

MS Michael Su
Michael Su
Member

yes, still as below:

—-

function my_init_scripts() {

if (sp_is_forumpage()) {

wp_enqueue_script(‘jquery’); } else {

if (!is_admin()) {

global $shortname;

wp_deregister_script(‘jquery’);

wp_register_script(‘jquery’,’http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js’, false, ‘1.7.1’);

wp_enqueue_script(‘jquery’);

 

/* etc…. */

YS Yellow Swordfish
Yellow Swordfish
Member

Ah – I meant ask this earlier. The file you attached was called ’99functions.php’. Is this what it is actually named? As WordPress will explicitly be looking for a file called ‘functions.php’ in the main theme folder.

MS Michael Su
Michael Su
Member

sorry for the confusion, I did change it to functions.php. I’ve been using the numbers to keep track of the changes, but the version I’m uploading has the right name.

 

if it helps, I reattach the file to this reply. thank you again for trying to help!!! much, much obliged!!

 

michael

 

—

 

MS Michael Su
Michael Su
Member

after trying all day, finally got it to work, and without the conditional. amazing how hard that was!!