WordPress.org

Ready to get started?Download WordPress

Forums

How can I add (6 posts)

  1. dvharrison
    Member
    Posted 1 year ago #

    Hi all

    I am using the current version of WordPress and the TwentyTwelve theme on my website, http://smartcardbureau.co.uk/. I am hoping to set up the Front Page template for my first page, basically so I can add a couple of elements (at the moment just the slideshow) which would otherwise get distorted in a normal page setup.

    Everything works so far but I would like to add the sidebar (widget-area) to keep consistent with the rest of the pages. Please could anyone shed any light into how I can do this?

    Any help is gratefully received.

    Many thanks in advance.

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    If you are making ANY changes to theme files, you need to use a Child Theme - http://codex.wordpress.org/Child_Themes

    The sidebar automatically appears on the front page when you have some widgets in it - you can do that under the widgets screen.

  3. dvharrison
    Member
    Posted 1 year ago #

    Hi WPyogi

    Thanks for this that is a big help. I have followed the instructions and now have a child template in place.

    But (and I ask because it isn't blatantly obvious), how do I allocate the child stylesheet to the home page? Please advise.

  4. paulwpxp
    Font hero
    Posted 1 year ago #

    Once you have your child theme setup and activated properly, you can go ahead and add CSS you want changed in its style.css.

    To target only specific page, use class output by body_class()
    http://codex.wordpress.org/Function_Reference/body_class

    In case the CSS for that page is quite a lot, you can put that in a .css file and enqueue it on that page only via conditional tag.

    wp_enqueue_style()
    http://codex.wordpress.org/Function_Reference/wp_enqueue_style

    Conditional tags
    http://codex.wordpress.org/Conditional_Tags

  5. dvharrison
    Member
    Posted 1 year ago #

    All I want to do is allocate the new child stylesheet to the home page only (theres not many attributes) and include the sidebar so its consistent with the rest of the site.

    I can do code but this is well confusing.

  6. paulwpxp
    Font hero
    Posted 1 year ago #

    All I want to do is allocate the new child stylesheet to the home page only (theres not many attributes)

    Review body_class() see link above, in your child theme's style.css you can target any specific page only.

    and include the sidebar so its consistent with the rest of the site.

    The default front page template of Twentytwelve doesn't have sidebar, it's easier NOT to add it there because there will be an extra job fixing the css of that page.

    Instead, just use regular page which will use normal (default) page template that will show sidebar just like the rest of the site, all you have to do is assign this page to be your front home page.

    Create a page for your front page, name it whatever, maybe "Smartcard Bureau Front"

    Go here Administration > Settings > Reading
    and assign that page to be front page.

    Once done, view source to see the class of <body> of that page, the class will look like page-id-99, and use it to style this page in your child theme style.css

Topic Closed

This topic has been closed to new replies.

About this Topic