- This topic has 14 replies, 3 voices, and was last updated 8 years, 1 month ago by
Tom.
-
AuthorPosts
-
February 25, 2018 at 8:19 am #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?
February 25, 2018 at 12:02 pm #505377Tom
Lead DeveloperLead DeveloperHi there,
They look identical to me – is there something specific I should be looking at?
February 25, 2018 at 1:15 pm #505426Margot
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.
February 25, 2018 at 6:40 pm #505567Leo
StaffCustomer SupportDid you remove those pages? I’m see a 404 page when I check them both.
February 25, 2018 at 6:51 pm #505572Margot
Hi Leo, they’re still up and correct.
Please make sure to follow the aiwebsitesandbox/ directory. It’s in the private link I postedFebruary 25, 2018 at 10:20 pm #505625Leo
StaffCustomer SupportThis 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.
February 26, 2018 at 4:32 am #505811Margot
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?
February 26, 2018 at 5:34 am #505844Margot
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>February 26, 2018 at 9:10 am #506089Leo
StaffCustomer SupportHave you tried disable all plugins to see if any of them is causing the issue?
February 26, 2018 at 10:29 am #506156Margot
Yes, tried that. No change. Still the same issue.
February 26, 2018 at 8:55 pm #506531Tom
Lead DeveloperLead DeveloperWhat if you replace this:
<p><?php get_template_part( 'content' ); ?></p>With this:
<p><?php the_content(); ?></p>February 27, 2018 at 5:51 pm #507456Margot
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!
February 27, 2018 at 9:34 pm #507525Tom
Lead DeveloperLead Developerget_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.February 28, 2018 at 6:58 am #507959Margot
Got it! Thank you!
February 28, 2018 at 10:19 am #508132Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.