Site logo

Archived topic

Wordpress Page Break Module?

18 replies · Started by Wayne on March 3, 2023

Viewing posts 1–15 of 19

Hey guys,

I am really having trouble figuring out why my blog posts aren't dividing into pagination with the standard Page Break Module? The page is breaking at the right points, but the page buttons aren't populating at the bottom of the post. Can anyone help me figure this out? I have turned off every single plugin and gone through all the cache clearing, but nothing. I can't even seem to see the code for the page break in Google Developer Tools. I am at a loss. The post I am attempting to use this on is https://staging4.zealoushomes.com/a-prayerful-appeal-for-christian-zeal-part-2/

I am trying to break the post up into separate pages to reduce the DOM nodes and speed up the post. Any assistance would be appreciated. Thanks in Advance.

Hi there,

how is that page constructed? Is it using a Block Element Content Template ?

Hi David,

Yes, I used Generate Blocks Pro and Gutenberg to build the post.

Hi Wayne,

David is asking if the single post is constructed with a Block Element Content Template and I believe it is:
https://docs.generatepress.com/article/block-element-content-template/

Can you go to Dashboard > Appearance > Elements and temporarily set the status of that Content Template to draft and see if everything works correctly?

If that's the case then we might need to try a workaround solution without using the Content Template.

Let me know :)

Okay, so I did as you said and the post pages do show up that way. Now there are numbers and it looks like a category folder under the numbers which I do not want to show up. The formatting of the page is obviously not correct either. While we are at it is there a way to center the page numbers under the post and before the Social Sharing tool?

Hey Wayne,

I'm able to replicate this bug on my end. I've asked Tom if this is indeed a bug or simply a limitation on using the content template for single posts.

Can we wait for his reply so I know what's the best way to move forward?

Thanks.

Hey Leo,

Thanks for looking into the issue. We can wait until he responds back. Do you think we can remedy the situation soon, or will it be a longer term solution? Trying to get an idea on the timeframe. Appreciate you guys.

Thanks.

Couple of options:

Option 1 - in your Content Template. Are you using the GP Dynamic Content Block for the post content?
If so replace that with a core Post Content Block.
NOTE: the core block will return no preview and will state: Block cannot be rendered inside itself. - but this can be ignored in the content template.

If that don't work.

Option 2

1. Add this PHP Snippet to your site:

add_shortcode('page_links', function(){
    ob_start();
    wp_link_pages(
        array(
            'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
            'after'  => '</div>',
        )
    );
    return ob_get_clean();
},100);

2. Then in your content template add the [page_links] shortcode where you want the links to appear.

Let me know.

Hey David,

Option one worked fine. Do you know if dynamic content will eventually be able to work with the page break module? Also, I am new to learning coding. Can you help me figure out how to center the page numbers and put a little padding on the top and bottom of them? I'd really appreciate it. Thanks for helping me get the main issue resolved. You guys rock!

Thats great.

You can add this CSS to apply some styles to those links:

/* Soace above and below and center page links */
.dynamic-content-template .post-nav-links {
    text-align: center;
    padding-top: 10px;
    padding-bottom: 10px;
}
/* add links styles */
.dynamic-content-template .post-nav-links .post-page-numbers {
    padding: 5px 10px;
    border: 1px solid #000;
    color: #000;
    border-radius: 3px;
    text-decoration: none;
}
/* change link background on hover */
.dynamic-content-template .post-nav-links .post-page-numbers:hover {
    background-color: #ccc;
}
/* change current link colors  */
.dynamic-content-template .post-nav-links .post-page-numbers.current {
    background-color: #000;
    color: #fff;
}

Do you know if dynamic content will eventually be able to work with the page break module?

If its a quick easy fix then probably.
But the Core Post Content Block does the job in this instance. And we have plans to migrate all GP Dynamic Data functions ( that are currently missing from ) to GenerateBlocks. As their is some overlap now. And we will ensure that there is a working method for this

Hi David,

Thanks for taking the time to write that code. Unfortunately, it doesn't seem to be working. Any thoughts? I added it into Simple CSS.

Hi Wayne,

Where can I see the content template with [page_links] shortcode?

Let me know!

Have you added the shortcode? I'm not seeing it on the post you linked.

Let me know if I miss anything!

Hi Ying,

No, I used the WP Block. David gave me two options (above in comments) to fix the initial issue. I was able to fix it with option one, so I didn't need to use a shortcode. If you look at the bottom of the post, there are pagination navigation label that work. David was trying to help me with CSS to center them and put a little padding around them. Unfortunately, the CSS didn't work. So I was hoping we could tweak the CSS or find a work around to adjust it. I hope that makes sense.

This archived topic is closed to new replies.