• Resolved jetsystemservices

    (@jetsystemservices)


    On Cerauno the page templates are on the root theme folder and dependent files on a subfolder called template-parts.

    I need to create a page template not on the root theme folder but on a subfolder which has to be called templates. On the subfolder I created a file which is a copy on the nosidebar template but with a different name (full-width-page.php). Exact same code except the template name (Full Width Page).

    When I go to select/asigned the template to the Page, it does find it. But when I click to show the page it does not execute correctly. I think it does not find the CSS style for the template.

    I added this code to the Cerauno-Child Style.css:

    .page-template-full-width-page-php .site-main,
    .page-template-nosidebar-page-php .site-main {
    	float: none;
    	margin-left: auto;
    	margin-right: auto;
    }

    This CSS works when the page template file is located on the child theme root folder.

    The content should appear in the center of the page.

    My page link is https://jetsms.esy.es/en/our-source/source-links/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there! You may have gotten this working (I can’t tell for sure from your site), so ignore if so. ??

    Since you can find the template, but it seems like it’s not loading your CSS, I have one idea to check out for now…

    Did you edit the class in your new template file to be the class you’re using in your CSS: .page-template-full-width-page-php?

    For example, in your new template file, in the code below that’s near the top:

    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main" role="main">

    The content-area piece should be .page-template-full-width-page-php instead (or whatever you want to use to target it). If they match, the CSS you’ve added should be found/applied.

    This change made the template work for me (although my template is in a folder called page-templates, not just templates), so maybe it’ll work on your end too. If not, try naming your subfolder page-templates (as directed here) and see if that does anything.

    Let me know how it goes!

    Thread Starter jetsystemservices

    (@jetsystemservices)

    Thank you for your reply.

    After I posted the question kept looking for a solution and found a WordPress Page Template Tutorial.

    I followed the approach of your answer. It was on the tutorial, that is probably why you found my page working.

    Also added a separate CSS section for the template.

    .page-template-fullwidth-page-php .site-main2 {
    	float: none;
    	margin-left: auto;
    	margin-right: auto;
    }

    Thank you again.

    Great! Glad you got it sorted out! You’re welcome. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need to create a child page template on different folder’ is closed to new replies.