Tweeted twitter.com/#!/StackWordPress/status/474442064826880000
2 added 70 characters in body
source | link

I am working on a template that my coworkers will be using to populate content. On some of the pages there will be a slider or multiple sliders but on other pages there won't be any. Because of this, I would like to create an option(maybe a checkbox or something) in the Pages backend that will allow them to include the slider script if necessary.

I could enqueue the script only on specific page IDs, but since they will be creating many of these pages, I would rather have an automated way for them to include the Javascript themselves instead of me having to go in and add more page IDs every time they make a new page which uses the Javascript.

Additionally I would like to use only 1 page template if possible.

What would be the best way to go about this?

Thanks!

I am working on a template that my coworkers will be using to populate content. On some of the pages there will be a slider or multiple sliders but on other pages there won't be any. Because of this, I would like to create an option(maybe a checkbox or something) in the Pages backend that will allow them to include the slider script if necessary.

I could enqueue the script only on specific page IDs, but since they will be creating many of these pages, I would rather have an automated way for them to include the Javascript themselves instead of me having to go in and add more page IDs every time they make a new page which uses the Javascript.

What would be the best way to go about this?

Thanks!

I am working on a template that my coworkers will be using to populate content. On some of the pages there will be a slider or multiple sliders but on other pages there won't be any. Because of this, I would like to create an option(maybe a checkbox or something) in the Pages backend that will allow them to include the slider script if necessary.

I could enqueue the script only on specific page IDs, but since they will be creating many of these pages, I would rather have an automated way for them to include the Javascript themselves instead of me having to go in and add more page IDs every time they make a new page which uses the Javascript.

Additionally I would like to use only 1 page template if possible.

What would be the best way to go about this?

Thanks!

1
source | link

Backend option to include a javascript file on specific pages?

I am working on a template that my coworkers will be using to populate content. On some of the pages there will be a slider or multiple sliders but on other pages there won't be any. Because of this, I would like to create an option(maybe a checkbox or something) in the Pages backend that will allow them to include the slider script if necessary.

I could enqueue the script only on specific page IDs, but since they will be creating many of these pages, I would rather have an automated way for them to include the Javascript themselves instead of me having to go in and add more page IDs every time they make a new page which uses the Javascript.

What would be the best way to go about this?

Thanks!