[Resolved] Same Child theme template page yielding two different results?

Home Forums Support [Resolved] Same Child theme template page yielding two different results?

Home Forums Support Same Child theme template page yielding two different results?

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #505225
    Margot

    I think this issue first came up after I installed Woocommerce. A template page I created for my Child theme displays differently when I publish pages. For some pages it comes out looking correct and in others it looks like there are additional divs and wrappers being placed inside my content:

    url*.com/gotham-wedding-accessories/ <-displays correctly
    url*.com/zara-wedding-accessories/ <- displays incorrectly

    * see below

    Not sure if the solution is in the css styling or if it’s something else?

    GP Premium 1.5.6
    #505377
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    They look identical to me – is there something specific I should be looking at?

    #505426
    Margot

    Oh yes. Sorry, I should have been more specific. Didn’t mean to make this a ‘spot the difference’ puzzle haha.

    I highlighted them in red just now so you can see what I’m talking about.

    The space in between the h4 header “Accessories” and the paragraph description on the right hand side is off on the “Zara” page. It looks like the page is applying the top margin setting of 125px (from the .wedding-product-description wrapper) for the paragraph text. But it’s only doing that on new pages that I publish (as seen of the “Zara” page. The “Gotham” page was how it was originally intended to look). The two pages are generated using the same page template though so I can’t understand why they’re being published differently.

    #505567
    Leo
    Staff
    Customer Support

    Did you remove those pages? I’m see a 404 page when I check them both.

    #505572
    Margot

    Hi Leo, they’re still up and correct.
    Please make sure to follow the aiwebsitesandbox/ directory. It’s in the private link I posted

    #505625
    Leo
    Staff
    Customer Support

    This CSS is giving that top margin:

    .wedding-product-description, .branding-product-description {
        margin: 125px 0 0 0;
        max-width: 600px;
    }

    Looks like your HTML structure in the two pages are different.

    #505811
    Margot

    The two pages are generated with the same child theme page template so the HTML *should* be identical but they’re not. For some reason an additional div with the .wedding-product-description class is being generated around the paragraph underneath the h4 for all the new pages I publish. I suspect this started happening after installing woocommmerce but I’m not 100% sure. I don’t want that additional div to be generated. I can post the snippet of that page’s php code if it will help?

    #505844
    Margot

    For your reference, this is how that section is coded in my page template:

    <div class="product-col product-col2">
          <div class="wedding-product-description">
               <h1 id="accessories-header"><?php the_title(); ?></h1>
               <h4 class="wedding-product-subhead">Accessories</h4>
               <p><?php get_template_part( 'content' ); ?></p>
          </div>
    </div>
    #506089
    Leo
    Staff
    Customer Support

    Have you tried disable all plugins to see if any of them is causing the issue?

    #506156
    Margot

    Yes, tried that. No change. Still the same issue.

    #506531
    Tom
    Lead Developer
    Lead Developer

    What if you replace this:

    <p><?php get_template_part( 'content' ); ?></p>

    With this:

    <p><?php the_content(); ?></p>

    #507456
    Margot

    I think I figured out what was happening. When I was creating new pages the plain text area was generating extra divs such as .inside-article .entry-content and .article divs. You couldn’t see it on rich text view but it was messing up the layout. I have to manually delete that on new pages but at least I can work around it to make sure there’s not additional markup.

    Out of curiosity is this <p><?php the_content(); ?></p> a preferable string to the <p><?php get_template_part( 'content' ); ?></p>?

    Thanks again!

    #507525
    Tom
    Lead Developer
    Lead Developer

    get_template_part( 'content' ) will fetch the contents of the content.php template file, which includes extra HTML markup.

    the_content() will only grab the content of the current post – nothing else.

    #507959
    Margot

    Got it! Thank you!

    #508132
    Tom
    Lead Developer
    Lead Developer
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.