The following warnings occurred: | |||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
|
How do I target a specific page in css based on the body tag? - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: How do I target a specific page in css based on the body tag? (/showthread.php?tid=7903) |
How do I target a specific page in css based on the body tag? - Lucianp - 2016-01-28 I want to show a client different header designs. I think the ideal solution would be adding a class to the body tag. get_page_slug is already there so I how can I utilize that for my purpose? From what I understand so far in my very little PHP I could possibly use an if else to return the page slug but how do I convert that to a class? My PHP is very limited or is there another option? thanks for your help. RE: How do I target a specific page in css based on the body tag? - Timbow - 2016-01-28 Check that your template has the opening <body> tag id'd as <body id="<?php get_page_slug(); ?>" > So if the slug is "about" then the html will be <body id="about" > and your css declarations starting #about will apply only to that page. If you prefer a class change the template to read <body class="<?php get_page_slug(); ?>" > then use .slug as a selector. if you want to add content (or code or anything) to certain pages you can use in the template <?php if (return_page_slug() == 'pageslug') {get_component( 'componentslug' )}; ?> to insert a component in that page only. Or you can just copy the template.php and rename it so that a page uses a different template. RE: How do I target a specific page in css based on the body tag? - Lucianp - 2016-01-28 that's just too easy thanks Timbow |