Build Your Own Business Website header image

Welcome to our Members Only Forum

You are welcome to view the content on our Forum, just scroll down to view this forum post.
If you like what you find and want to be able to post a question, please check out our subscription options.
Please feel free to search the forum using either the Google Site Search above or the forum search below.

Avatar
Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Checking for a specific template using php
Avatar
Stephen B
Jedi
Members

Community Member
Forum Posts: 100
Member Since:
August 16, 2011
sp_UserOfflineSmall Offline
1
March 22, 2015 - 6:33 pm
sp_Permalink sp_Print

Hi,

 

I am wanting to apply a slider which has different settings on it to the 'Full Width' template only. In the Wordpress Codex I found that there was a function called is_page_template but I'm not sure I'm using it right, or where I can find the correct name of the template. It is part of the theme being used and I'm not sure where it is stored (although I have had a look). On the post editing screen there is a custom template selection box and in that box it is called 'Full Width'. I think that this function might require a file name though such as 'full_width.php'.

 

Any help would be much appreciated. Cheers.

Here is the effect I am wanting to have:

 function add_full_width_comics_category_roster_slider(){
     if(is_single() && in_category('comics') && is_page_template('Full Width') && (function_exists("get_roster_slider_recent"))){
         get_roster_slider_recent($set="6");
         }
         }

 add_action('hook_bottom_add_deepfried_content', 'add_full_width_comics_category_roster_slider');

Avatar
Stephen B
Jedi
Members

Community Member
Forum Posts: 100
Member Since:
August 16, 2011
sp_UserOfflineSmall Offline
2
March 22, 2015 - 8:29 pm
sp_Permalink sp_Print

Hi,

On further investigation I rediscovered that thesis doesn't use template files. I have created two hooks instead of one in the thesis skin editor. One is on my standard width content box on my 'Single' template and the other is on my full-width content box on my 'Full Width' template.

It works, but I'm just wondering now if it was necessary, or could I have checked for the template using php, similar to the previous post?

 

Thanks

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
3
March 25, 2015 - 9:39 am
sp_Permalink sp_Print

The only way to check is either via, if is_single, is_home, is_archive, is_page - or by testing against thesis post meta.  However, you need to know the id of the template in question.

The easiest solution by far is to add a template specific hook and then use the hook.  Which is what it sounds like you did.

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 228

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Keith W Jones: 1428

Brian Tozer: 1004

Carolin: 982

Heidi Hafner: 508

John Cunningham: 423

Reece Morrel: 353

Newest Members:

emma62755

sharonmarks

emma80233

Tijs de Jong

Daniel Frey

mutek

Forum Stats:

Groups: 8

Forums: 46

Topics: 6995

Posts: 34796

 

Member Stats:

Guest Posters: 6

Members: 6761

Moderators: 2

Admins: 2

Administrators: Rick Anderson, Rick Anderson

Moderators: Pierre Cote, Laura Nugent