0

I have my site: http://theapkstore.com . On the homepage I've added a slider. And reduced the top margin of widget which says "Welcome to my site". The homepage looks fine but then when I open any one the link from the navbar then on that page I see that the top margin is acting on all the pages which causes the widget to devastate the design. Can you please tell how can I only put the top margin of that widget on the homepage?

1
  • What CSS did you use to reduce the top-margin? Commented Dec 28, 2013 at 18:10

2 Answers 2

1

You are using body_class() in your template already, so your home page has a class home on the body element.

Restrict the margin rule in your stylesheet by using that class:

.home #secondary {
    margin-top: 20px;
}
0

use a conditional template tag when you enqueue the css.

add_action( 'wp_enqueue_scripts', 'wwm_enqueue_scripts' );

function wwm_enqueue_scripts()
{

 //is_front_page() may or may not be the appropriate tag...
 //perhaps is_home() might server you better...???
 if ( is_front_page() ) {

  //put the appropriate things in these variables for your stylesheet...
  wp_enqueue_style( $handle, $src, $deps, $version, $media );
 }
//enqueue other stuff (or not)
}

see docs on conditional tags: http://codex.wordpress.org/Conditional_Tags

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.