• Resolved Jose C

    (@jcervantes28)


    Hello,

    Is there a way to have the background/color of the banner be different on single posts, pages, etc. than on the home page? I like the color, but don’t want it to expand the width it would normally take with 2 widgets embedded into it like in the home page.

    Thank you for your help and time,
    Jose

Viewing 8 replies - 1 through 8 (of 8 total)
  • Use the code I’ve pasted in https://pastebin.com/m9XcbfAD

    Pasting it in the functions.php file will work but updating the theme will overwrite it. So create a child theme and paste the code in its functions.php file.

    Thread Starter Jose C

    (@jcervantes28)

    Hello Jesin,

    Thank you for the help…it is pushing me along the right lines and I’m looking into it.

    The code you referenced did what I needed to do, except that it did it in the container that goes above the banner. I change the #headdercontainer to #bannercontainer, and while I think it works, the background attachment that is configured in the theme options takes precedence, I believe.

    So I am looking into the theme’s function php at where it defines the background URL, I just don’t know how to make it be my color I want, without the background, on !is_front_page.

    Let me know if that made sense. I appreciate your help.
    Jose

    Hi Jose,

    Do you mean that some other CSS is overriding the style you’ve added?

    Can you post your site’s URL for me to take a look.

    Thread Starter Jose C

    (@jcervantes28)

    Might be CSS, not sure. But I know I see the URL being defined in functions.php, it probably refers to the background that we select through the theme’s options.

    I didn’t see the background URL in CSS, but it would make sense to be there.

    I want that background in home page, but when it is not a home page, I don’t want a background within the banner. I simply want a color, like #0000FE.

    website is:
    https://www.shortstoryguy.com

    I want to customize the site more by adding my own colors, and that’s one way I want to do it.

    Thank you,
    Jose

    If you just do not want to display an image inside #bannercontent add this in the else part (line 13 of the pastebin link)

    background-image: none;

    If you don’t want to display the #bannercontent itself use

    display: none;

    instead. Try both and use the one that suits you.

    Whatever you do just don’t edit your functions.php file. All changes will be overridden if the theme is updated.

    Thread Starter Jose C

    (@jcervantes28)

    Thank you Jesin!

    I did it with the following code:

    <?php
    function my_inline_styles()
    {
    ?>
    <style type="text/css">
    
    <?php if(is_front_page()): ?>
    #bannercontainer {
      background-color:#6666FE !important;
    }
    <?php else: ?>
    #bannercontainer {
    background-image:none !important;
    background-color:#6666FE !important;
    }
    <?php endif; ?>
    </style>
    <?php
    }
    
    add_action("wp_head","my_inline_styles");
    ?>

    Of course, I did it in the Child theme ?? Thanks for your support!

    Jose

    Thread Starter Jose C

    (@jcervantes28)

    marking solved.

    Theme Author Anthony Hortin

    (@ahortin)

    For reference, if you simply need to make some style changes, and you’ve built a child theme, then add them straight into the style.css file. That’s what it’s there for. You shouldn’t be using a function within functions.php to add them to the site <head>.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Have banner background/color be different on !is_front_page’ is closed to new replies.