Jump to content


Photo
- - - - -

Conditional Scripts call in headerscript depending on page

Scripts JQuery Headerscript

  • Please log in to reply
3 replies to this topic

#1 mdcryan

mdcryan

    Newbie

  • Members
  • 9 posts
  • LocationSingapore
  • Country: Country Flag

Posted 01 June 2013 - 11:10 AM

I've searched all the forums but can't find the simple answer to what I think is a simple question (but then I am new to this so I think everything is simple until it shows me it is not!)

 

:D

 

I think I have a JQuery conflict with plugins, as a Password Strength meter has suddenly stopped working after I added some functionality on anew page.

 

so I think need to call a couple of Scripts only on a single page - in this case page 119. - to stop the Conflict.

 

Normally if I was hand-coding I would put this in the headerscipt section of the individual page, but with Pagelines We are encouraged to use the headerscripts section under Site Options > custom Code.

 

I have typed this simple bit of php in the header-section but it still seems to call it on every page.....

Any ideas what I am doing wrong.

Please Login or Register to see this Hidden Content

URL is

Please Login or Register to see this Hidden Content



#2 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 01 June 2013 - 11:39 AM

Firstly you cant put ANY php in the javascript headers area. it javascript only there.

 

Secondly your including 2 libs that are bundled by wordpress anyway. and jQuery is already loaded on every page.

 

So you just need to include the ui libs on that page.

 

In your child theme functions.php add:

Please Login or Register to see this Hidden Content



#3 mdcryan

mdcryan

    Newbie

  • Members
  • 9 posts
  • LocationSingapore
  • Country: Country Flag

Posted 01 June 2013 - 02:32 PM

THe page with the script loaded in the header script looks fine - 

Please Login or Register to see this Hidden Content

 

Please Login or Register to see this Hidden Content

  96.59KB   1 downloads

 

I then removed the script form the header and loaded it into Plugins/pagelines-customise>functions.php

THis then caused the page layout to mess-up .....clearly it is not calling the UJQuery UI...so I've put it back as it was

 

Please Login or Register to see this Hidden Content

 

Please Login or Register to see this Hidden Content

  88.5KB   1 downloads

 

Sadly this means I still haven't resolved the conflict

 

IS the PHP code in the right place? Should the 

Please Login or Register to see this Hidden Content

  have single quotes around the 119 page number?



#4 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 01 June 2013 - 08:03 PM

We cant help you if you remove the code straight away.

 

You are now loading TWO lots of jquery, 2 different versions.

 

Check the source of your page.

 

Please Login or Register to see this Hidden Content

Please Login or Register to see this Hidden Content

 

It should probably have been jquery-ui-core in my example.