How to change the code on my child theme ?

Home Forums Modern How to change the code on my child theme ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18277

    elvisf
    Participant

    How to change the code on my child theme ?

    Resolved

    I need the header div to display only on the front page, not on the posts page. Is there a way to change it? I tried to delete the get_header(); on the single post page, but it ends up losing all the style. I added a background image on the header div, now I have two images when I open a single post. Thanks for the help.

    I’m working locally.

    • This topic was modified 5 months, 4 weeks ago by  elvisf.
    #18283

    Oliver Juhas
    Keymaster

    Hi elvisf,

    Please note that as it seems you have modified the theme to your needs, it is impossible for me to determine the help for you just from screenshot. I understand you are developing locally, but if you can somehow provide URL, it would help me to provide exact tip for you.

    Also, I’m not quite sure what you are trying to achieve (not sure what you mean by header here), so here are some coding tips that may help you:

    /* To remove site title and social icons: */
    body:not(.home) .site-header-inner {
      display: none;
    }
    
    /* To remove site intro section (the "background" image): */
    body:not(.home) .intro-container {
      display: none;
    }

    If you want to force a specific image as background on not-home-pages, I suggest using a filter hook in your child theme‘s functions.php file instead of inserting an image into your website header:

    function child_theme_header_image( $image ) {
      if ( ! is_front_page() ) {
        $image = 'YOUR_CUSTOM_IMAGE_URL_HERE';
      }
      return $image;
    }
    add_filter( 'theme_mod_header_image', 'child_theme_header_image', 100 );

    Then you can simply disable the CSS filters on the image.

    When building a custom theme modifications, please try using your browser code inspector to determine the CSS code you need to use to modify the theme’s display. If you are not familiar with WordPress theme development, please consider hiring a help as I can only provide tips for custom theme modifications (please read terms of service).

    Best regards,

    Oliver Juhas
    WebMan Design

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.