-
AuthorPosts
-
March 13, 2015 at 3:57 am #410820
Hi,
I have created a couple different “page templates” and am having problems calling the correct statement in the header.php file to pull the correct css. Here is my code, which works great if you have just one extra page template but I have added a couple more and am not sure how to update the code…How do I tell it to use the retail-style.css for the page template called “retail”, on top of what I have below?<?php if( is_page_template(‘template-corporate.php’) ) :?>
<link rel=”stylesheet” href=”http://mywebsite.com/wp-content/themes/enfoldchild/style-corporate.css” media=”screen” type=”text/css” />
<?php else:?>
<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” />
<?php endif;?>Thank you!
March 13, 2015 at 12:56 pm #410938Hi tvlleaders!
You could just copy the block of code you already have and change the template name and CSS file names. Please let us know if you need any more assistance.
Regards,
RikardMarch 13, 2015 at 2:45 pm #410966I tried adding this in and it error’d out my website. I just don’t know the correcdt syntax, to add in the second page template.
<?php if( is_page_template(‘template-corporate.php’) ) :?>
<link rel=”stylesheet” href=”http://mywebsite.com/wp-content/themes/enfoldchild/style-corporate.css” media=”screen” type=”text/css” />
<?php if( is_page_template(‘template-RETAIL.php’) ) :?>
<link rel=”stylesheet” href=”http://mywebsite.com/wp-content/themes/enfoldchild/style-RETAIL.css” media=”screen” type=”text/css” />
<?php else:?>
<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” />
<?php endif;?>March 14, 2015 at 8:13 am #411430Hi!
You can’t follow an if statement with another if, please copy and edit the whole block or change the second if to else if. The syntax is as follows:
if(){ } else { } if(){ } else { }
Cheers!
RikardMarch 15, 2015 at 10:34 pm #411763awesome, it worked great! Thanks a bunch, I appreciate it! :D
March 16, 2015 at 9:40 am #411969 -
AuthorPosts
- You must be logged in to reply to this topic.