• Resolved DragoWeb

    (@dragoeco)


    Hi there,

    Yeah I know, the title sound wierd :p I’m looking for a way to add a full width div to the top of some pages. The aim is to display a full-width div in which HTML can be written, then the content and sidebar just below, side-by-side as normal.

    I have two questions:

    1. There’s the CSS option (relative/absolute position, width 100%…) but I was wondering if there’s another solution possible with GP?
    2. I tried to create a custom template for this purpose but I don’t see it in the “layout” meta-box. However, I placed the page-fullwidth-sidebar.php in my child-theme (which has been operational for a long time) and added this header:
    <?php
    /**
    * Template Name: Fullwidth with Sidebar
    *
    * @package GeneratePress
    */

    Then pasted the contents of page.php into it. Is there any specific handling for the GP theme?

    WordPress: v6.8
    Theme: GeneratePress 3.5.1 (free version)
    functions.php and style.css in child theme

    Thanks ^^
    Pierre

    • This topic was modified 1 year, 1 month ago by DragoWeb. Reason: add an image
    • This topic was modified 1 year, 1 month ago by DragoWeb.
Viewing 6 replies - 1 through 6 (of 6 total)
  • ying

    (@yingscarlett)

    Hi there,

    It requires the Elements module of GP Premium plugin. I don’t think there’s an easy way with the free theme, unfortunately!

    Thread Starter DragoWeb

    (@dragoeco)

    Hi Ying,
    Thanks for your answer. I’ll have a look on that. And about the implementation of a custom template ? The “normal” way seems not to work with GP, so I guess there’s a specific procedure ?

    ying

    (@yingscarlett)

    I don’t think you need to modify the template, you can use the generate_after_header hook to insert full width content below the header.

    For example:

    add_action('generate_after_header', function() {
    if (is_page()) {
    echo '<div>my full width content</div>';
    }
    });

    Thread Starter DragoWeb

    (@dragoeco)

    Thank you! This, with a custom field, will be the best solution for me.

    add_post_meta($post_ID, "custom_fullwidth_content", "", true);

    For the custom template, I’ll need it for another purpose. Maybe I should open a separate question ?

    ying

    (@yingscarlett)

    Yes, please open a new topic 🙂

    Thread Starter DragoWeb

    (@dragoeco)

    Alright, I’ll do that 👍

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Full width layout with sidebar’ is closed to new replies.