Home Forums SimpleFlex Remove margin from one single child-page

This topic contains 2 replies, has 2 voices, and was last updated by  latte 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #46485

    latte
    Participant

    Hi,
    I would like one of several child pages linked to my One Page Parent to not have any margins. I have been trying to add a custom page template where I have modified the .wrapper class. I am able to set a full with, but this does only apply when the child page is displayed by it selves, and not when it is a part of the One Page Parent.

      One Page Parent!
     ________________
    |                |
    |     child 1    | 
    |________________|
     ________________
    |                |
    |child2 no-margin| 
    |________________|
     ________________
    |                |
    |     child 3    | 
    |________________|
    

    Is it possible to apply a custom page template to a child page that is a part of a parent page? Or is there any other way to remove all margins from one child page?

    • This topic was modified 8 months ago by  latte.
    #46487

    Joshua
    Keymaster

    Good question.

    The easiest way to do this would be to target by the data name slug and set the wrap on that page to full:

    [data-name="portfolio"] .wrap {
        max-width: 100%;
        margin: 0;
        width: 100%;
    }

    Alternatively, if you’re comfortable with code and really need a class to do this, you could add your unique page template and in your includes/loop-onepage.php file after line 21, get your template slug:

    $page_template = get_page_template_slug( $page_id );

    And add it to your container class on line 24:

    <div id="container-<?php echo $page_id; ?>" class="container <?php echo $page_template; ?>" data-name="<?php echo $slug; ?>">

    This method still requires you add CSS for your page template, but might be a better option if you have a lot of one page templates.

    #46488

    latte
    Participant

    Fantastic! Thank you for this quick and correct answer :)

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

You must be logged in to reply to this topic.