Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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&#8221; media=”screen” type=”text/css” />
    <?php else:?>
    <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” media=”screen” />
    <?php endif;?>

    Thank you!

    #410938

    Hi 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,
    Rikard

    #410966

    I 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;?>

    #411430

    Hi!

    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!
    Rikard

    #411763

    awesome, it worked great! Thanks a bunch, I appreciate it! :D

    #411969

    Hey!

    No problem, glad you worked it out :)

    Regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.