WordPress.org

Forums

[resolved] Conditionally change the width of global style (3 posts)

  1. staru
    Member
    Posted 2 years ago #

    hi, i started a new site and the homepage page width is 1200 px, i would like the article to have the global style width to 1000px (for the header, and also for article+sidebar).
    I know how from where to change them, but i want the width size to be different for homepage(+navigation pages), and different for post article.

    For the header i change this line of code from header.php

    <div style="width:1200px; height:auto; display: block; margin:0px auto;">

    And for the article + sidebar i change the style.css on line 265

    .page
    {
    margin: 0 auto;
    width: 1200px;
    }

    Did what I said make sense to you? Anyone can help?

    http://craftedforus.com/

  2. Andrew Bartel
    Member
    Posted 2 years ago #

    Try this:

    <?php
    if ( is_front_page() ) {
    $width = 1200;
    } else {
    $width = 1000;
    }
    ?>
    <div style="width: <?php echo $width; ?>px; height:auto; display: block; margin:0px auto;">
  3. staru
    Member
    Posted 2 years ago #

    Worked like a charm!

    (also, i changed the width from css to 100% to work properly)

    Thank you very much, i really appreciate your quick reply!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags