• Hi all

    I am using the current version of WordPress and the TwentyTwelve theme on my website, https://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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you are making ANY changes to theme files, you need to use a Child Theme – https://codex.www.ads-software.com/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.

    Thread Starter dvharrison

    (@dvharrison)

    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.

    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()
    https://codex.www.ads-software.com/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()
    https://codex.www.ads-software.com/Function_Reference/wp_enqueue_style

    Conditional tags
    https://codex.www.ads-software.com/Conditional_Tags

    Thread Starter dvharrison

    (@dvharrison)

    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.

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I add’ is closed to new replies.