Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #226457

    I’m trying to create a custom template for specific pages using a child theme. When I copy page.php to create a new custom template, the pages assigned to that template start displaying sidebars iregardless of whether they are supposed to. I know that there is a note in the page.php file directly before the sidebar code that references using loop-page.php if overriding in a child theme, but I’m not sure exactly what it’s instructing me to do. Can you explain how the loop-page.php file and page.php files should be used when creating a child theme?

    Here’s the note in question:

    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-page.php and that will be used instead.
    */

    Thanks!

    #226466

    Ok, after redoing the new files in the child theme directory the behavior of the sidebars described above is no longer occuring. Not sure what I did, but it seems like that problem has fixed itself.

    I do have another issue however. The custom template is displaying pages using the “boxed layout” rather than the “stretched layout” which is default on the rest of the site. How can I make a custom template within a child theme inherit the layout set within the WordPress admin area?

    #226474

    Hi!

    If its a custom page template that does *not* use the Avia Layout Builder then using the page.php and a custom loop (or not) is the way to go.

    The template for the page isn’t set in the page.php but in the header.php and that is pulled in through whatever the theme is set so it shouldn’t have anything to do with it.

    Regards,
    Devin

    #226477

    I’m fairly certain that it *is* using the Avia Layout Builder. Here’s the code for the template for you to determine yourself:
    `<?php
    /*
    Template Name: Custom Lockdown
    */
    ?>

    <?php
    global $avia_config;

    /*
    * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    */
    get_header();

    if( get_post_meta(get_the_ID(), ‘header’, true) != ‘no’) echo avia_title();
    ?>

    <div class=’container_wrap container_wrap_first main_color <?php avia_layout_class( ‘main’ ); ?>’>

    <div class=’container’>

    <main class=’template-page content <?php avia_layout_class( ‘content’ ); ?> units’ <?php avia_markup_helper(array(‘context’ => ‘content’,’post_type’=>’page’));?>>

    <?php
    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-page.php and that will be used instead.
    */

    $avia_config[‘size’] = avia_layout_class( ‘main’ , false) == ‘entry_without_sidebar’ ? ” : ‘entry_with_sidebar’;
    get_template_part( ‘includes/loop’, ‘page’ );
    ?>

    <!–end content–>
    </main>

    <?php

    //get the sidebar
    $avia_config[‘currently_viewing’] = ‘page’;
    get_sidebar();

    ?>

    </div><!–end container–>

    </div><!– close default .container_wrap element –>

    <?php get_footer(); ?>

    #226479

    The thing is that when you are on a page and switch over the ALB you are no longer using page.php as the template once you use a full width element on the page. Because it needs a different div structure you are instead using template-builder.php.

    #226480

    So what’s the best way to approach creating a custom template within Enfold if I do want to use a full width template?

    #226547

    It really depends on what you are trying to do with a custom page template. The theme is designed around the idea that you don’t need to go outside the ALB for a custom layout. If you do and more specifically for a custom page template then you wouldn’t be using it since its a custom page template. It just isn’t designed around using both.

    #374867

    hallo, ich habe nun ein
    header-test.php in header-test.php habe ich $style=’stretched’;

    und page-test.php hat ganz normale Struktur, mit get_header(‘test’);

    Wenn ich für eine neue Seite Test-Template auswähle, so ist mein header wirklich stretched aber Page-Content is boxed?
    Wie kann ich auch page Content als Stretched Layout hinbekommen??

    #374909

    Hi!

    I think this website is for you: https://kriesi.at/support/topic/how-to-create-a-new-page-template

    You can also have a look into this thread:
    https://kriesi.at/support/topic/how-to-create-a-new-page-template

    Regards,
    Andy

    #762553

    Hey. I am trying to create a new template for a custom archive page but this post confused me even more. Which file should I be editing? I want to get a list of posts of a certain category (10 latest posts) and then a sub-menu that lets me select the year for which I want the posts. That menu item then takes me to an archive page with posts of that category but now with all the posts from the selected year.

    #764108

    Hi architchandra,

    It’s archive.php that you will need to work with in your child theme.

    Best regards,
    Victoria

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.