Possible to remove post content wrapper?

I created a page template with the following structure:

   <--! Cwicly's Post Content element >

Cwicly’s Post Content element is outputting a <div> on the frontend.

Question: Is it possible to remove this <div> wrapper?

Hi, and welcome here :partying_face:

Unfortunately I think it is not possible with the post content block.

That’s why I use a code block instead with the following PHP:

<?php the_content() ?>

@yankiara Your tip with using Code block works perfectly fine! Thank you

@Tomanuel , @yankiara Maybe I am missing something, but why don’t you apply the “main” tag to the Cwicly post content element directly? In that way, there is no need to wrap it with extra <main> tag and no need to use code block.

What I do is add the Cwicly post content block to the template, change the tag for it to <main>, add the class "main-content" if needed, and that’s it. The output would be:

<main class="main-content">
<--! Whatever content is on page >

@krievinshj I don’t know why this didn’t come to my mind. Thank you! Works flawlessly

Templates may contain other content than post content (sidebar, page header, etc.) so in the general case, post content alone cannot be the main tag. Well at least for me :wink:

My answer was primarily focused on the original question and the specific case mentioned, rather than suggesting a default structure for every template.

But yes, if the template structure is more complex and the extra wrapper for post content gets in your way, using a code block and <?php the_content(); ?> is the way to avoid it.

Yes, no pb :wink:

That said, there are other considerations on why I systematically use the code block method now:

  • I like that BIG tags such as main, article, etc, are really explicit in the structure pane, even for the most basic template:


  • if you need to move your post content later, or wrap it in a container, you won’t have to recreate main and change its tag ;

  • if you need to copy paste stuff across templates or sites, it’s way easier when everything is consistent.

I agree this is important to me because it is my job, but for a one shot website, it might be overkill :wink:

I understand your point, and a systematic approach is exactly what I’m aiming for. However, my take on this is to use a “no-code” approach as much as possible. Essentially, this is the main reason why I use Cwicly. I used to code themes myself from scratch, and I liked it, but now that I have a team, I want to make it as simple as possible so everyone on the team, with different skill levels, can understand and join in if needed.

I also try to maintain a consistent approach across templates, implement my own small utility classes framework, and document everything to make it clear for everyone, so clear that, as I joke, even my bookkeeper could understand it. That’s why I systematically try to avoid code blocks, so there’s a smaller chance of things getting messed up. Of course, there are a few cases when I cannot avoid using code blocks, but in this particular case with the Post Content block, I don’t feel like I’m missing something out.

My most basic page template looks like:

    <header class="entry-header">
       <!--Post header content-->
    <!-- Cwicly post content block with class "entry-content"-->
  <aside><!-- Sidebar --></aside>

For the header and sidebar, I have an ACF checkbox to include or exclude them on a page, depending on the desired layout.
I believe I have large tags, can move the post content, and can use it basically on any page. It checks all the boxes, at least for me. The only difference between two approaches is the tag already attached to the Post Content block, but I mostly don’t mind it because I would probably use it anyway for styling purposes on code block as well.
Screenshot 2023-04-07 at 07.59.26