• Resolved tchen200

    (@tchen200)


    Hi I am pretty new to WordPress and I have two questions.

    For my front page, I want the layout to be different than the default. For example, rather than displaying the page title, I want to add a banner image below the navigation bar. If I add the image to the page through the edit pages tab, it doesn’t span the full width and appears below the page title. To do this, I would need to use a custom page template and type in my own css right? To do this, can I just edit the page-templates/front-page.php through the editor in the appearance tab or will I need to set up a child theme?

    Secondly, I put an image into the header in the customize screen and it works fine on computer, but it gets cropped/not resized on smaller screens like an Ipad. I saw that you could use jetpack’s logo so that the image will resize, however when I selected the image using jetpack’s logo, the image doesn’t take up the full header space and there is space on all four sides of it. How do I fix this?

    Thanks in advance.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi there,

    For my front page, I want the layout to be different than the default. For example, rather than displaying the page title, I want to add a banner image below the navigation bar. If I add the image to the page through the edit pages tab, it doesn’t span the full width and appears below the page title.

    Sela has a built in Front Page template that you can assign to your home page. This template is styled differently to the other default pages and has a banner image below the navigation bar, which matches up to the description of what you’re after.

    Can you take a look at the home page of the theme’s demo site and let me know if it does match up the style you want?

    To assign a page template: Navigate to the editor for a page and then select from the Template dropdown menu in the Page Attributes module. The Page Attributes module can generally be found to the right hand of the editor. If you can’t see it, select the Screen Options tab in the upper right and then check the option next to Page Attributes to get the module to display.

    The theme recommends an image that is at least 1180px wide to be used as the featured image on the home page.

    If you’ve already followed the above steps but the image on your home page is still not displaying at full width, please share a link to your site so that I can take a deeper look into what’s going on.

    To do this, I would need to use a custom page template and type in my own css right? To do this, can I just edit the page-templates/front-page.php through the editor in the appearance tab or will I need to set up a child theme?

    You’re right that page-templates/front-page.php is the file that needs to be changed to customise the theme’s Front Page template.

    You should not edit your theme’s files directly. Any direct changes you make will be lost when it comes time to update.

    Instead you should set up a child theme. In case you’re unsure, the following guides provide a good introduction to child themes, including steps to set one up:

    After you have completed that step, copy the parent’s page-templates/front-page.php file to your child theme’s directory and then open it in your favourite text/code editor to make changes.

    Secondly, I put an image into the header in the customize screen and it works fine on computer, but it gets cropped/not resized on smaller screens like an Ipad. I saw that you could use jetpack’s logo so that the image will resize, however when I selected the image using jetpack’s logo, the image doesn’t take up the full header space and there is space on all four sides of it. How do I fix this?

    You’re right that Sela will automatically crop the header image so that it fits in well across screens of different devices. For this reason, header images that are decorative and abstract work well. It’s not recommended to use images that are detailed, have text, or that can’t handle any form of cropping in the header.

    If it’s important for you to keep your header image, please share a link to your site so that I can look into its code and think about best ways to approach changing the CSS for you.

    Thread Starter tchen200

    (@tchen200)

    Hi Siobhan,

    Thanks for the help, I set up the child theme and the banner image is working.

    The website is included in my profile. It is still in its very early stage. How would you recommend resizing the header image?

    Thank you for pointing me to your site!

    As your header image includes a lot of text and detail, I recommend uploading it as a logo to your site. As you noted previously in this thread, images that have been uploaded as the site’s logo will not be cropped by the theme and its detail will still be readable across devices.

    You can then use some custom CSS to get the logo to take up the full width of the screen:

    .site-branding {
        padding: 0;
    }
    
    .site-logo {
        width: 100%;
    }

    To add custom CSS: Firstly set up a child theme or activate a custom CSS plugin. (If you have Jetpack installed then you can activate its custom CSS module.)

    The above snippet should be entered in either the editor for your CSS plugin or the style.css file of your child theme.

    Let me know how you get on with that! I’ll be happy to help if any questions come up along the way.

    Thread Starter tchen200

    (@tchen200)

    Hi Siobhan, using the jetpack logo does work and it does take up the whole width now, however when it is max width (displayed on computer screen) there is a tiny strip of white between the logo and the navigation bar. Also on smaller screens, when the logo gets smaller, the navbar doesn’t go up as the logo height is decreased and instead, just displays white. Is there a way to fix this?

    Thanks

    Hi @tchen200,

    however when it is max width (displayed on computer screen) there is a tiny strip of white between the logo and the navigation bar.

    You can fix this by floating the logo to the left with some custom CSS:

    .site-logo {
        float: left;
    }

    Also on smaller screens, when the logo gets smaller, the navbar doesn’t go up as the logo height is decreased and instead, just displays white.

    The following snippet in your custom CSS is setting a relatively large minimum height on the header area, and therefore causing the white space:

    .site-branding {
        min-height: 453px !important;
    }

    Try removing that and let me know how you get on.

    Cheers!

    Thread Starter tchen200

    (@tchen200)

    Hi,

    Removing the minimum height removed the white space when I resize the browser window on my computer, however the white space still remains on my mobile device. Do you know what might be the problem?

    Thanks.

    I’m still seeing the minimum height in your child theme’s style.css. Can you remove it completely, save your changes, and then reply back here if you’re still seeing the white space on mobile? I’ll then be able to take another look.

    Thread Starter tchen200

    (@tchen200)

    Hi,

    It works now, I must have forgotten to save the stylesheet last time or something.

    Thanks for the help!

    I’m glad to hear that! You know where to find us if you have extra questions, too.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom page template and header question’ is closed to new replies.