[Resolved] Still the custom page template

Home Forums Support Still the custom page template

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1279872
    Rui

    Hi there,

    I’m trying to develop a page using a custom page template that I had support here:
    https://generatepress.com/forums/topic/a-brand-new-post-with-a-custom-style/

    But something happens (maybe related to the style sheet) and it looks different than I expected.

    What I want is this: https://www.zenite.nu/vida

    But what I got (with my custom page template) is: https://www.zenite.nu/a-trilha-da-vida/

    I can’t understand because when I view the source code of both pages they look the same, except by the tags (in the second one)

    <article id="post-ID ...
    <div class="inside-article">
    <div class="entry-content" itemprop="text">

    that include the entire document, but it doesn’t seem to be the cause of this problem.

    Moreover, in that page, the first tag ( <main> ) is nested inside paragraph tags <P> that I don’t know where it came from!

    Could you give me some help on what may be going on?

    #1280098
    Rui

    I figure out!

    The problem was the automatic paragraph tags (from WP itself).
    I used a filter:
    remove_filter ('the_content', 'wpautop');
    and now it´s all right!

    #1280369
    David
    Staff
    Customer Support

    Glad to hear that – looks great !

    #1281166
    Rui

    Thank you, David!!

    Do you know why WP does this on some pages, but – apparently – not on others?

    Are there any implications in applying this filter to the entire site?

    #1281707
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    That filter is applied to everything that runs through the_content() filter. It adds paragraph tags automatically to your text so you don’t have to.

    There could definitely be some bad things that happen if you remove it site-wide, but I don’t even think it’s used on pages using the block editor anymore, which is good.

    You can always target a page template:

    add_action( 'wp', function() {
        if ( is_page_template( 'your-page-template.php' ) ) {
            remove_filter( 'the_content', 'wpautop' );
        }
    } );
    #1281805
    Rui

    Thank you –
    As always, you guys help a lot!

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