Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter tolddsm

    (@tolddsm)

    Could anyone give a hand?

    Plugin Support Elvin

    (@ejcabquina)

    Hi there,

    Have you tried Tom’s code from the same thread?

    This code:

    add_action( 'wpsp_after_wrapper', function( $settings ) {
        if ( 123 === (int) $settings['list_id'] ) {
            next_posts_link( __( 'Older posts' ) );
            previous_posts_link( __( 'Newer posts' ) );
        }
    } );

    Change 123 to the WPSP id of the WPSP list you’re trying to apply this on.

    Here’s how to add PHP – https://docs.generatepress.com/article/adding-php/

    Thread Starter tolddsm

    (@tolddsm)

    Hi,

    Thanks, I read that thread.

    This code is for turning numbering pagination into previous and next post which I don’t need, I enjoy the numbering pagination by default.

    I am in need of the rel-canonical problem to be fixed in some way.

    I do hope there is a fix to this cuz using wpsp and using a static page as archive page is definitely one of the major usages for this plugin.

    “The main issue here is that WP Show Posts is meant for a simple list of posts. While pagination is possible, it can cause issues if you’re expecting the page to act as an archive page with canonical links. This would require a custom solution to be added that the plugin simply isn’t able to do by default on static pages.” – TOM.

    Need to turn from abc.com/blog-archive to abc.com/blog and show related posts. Using a static page and wpsp is the ideal solution I can think of now.

    Plugin Support Elvin

    (@ejcabquina)

    I’m not sure which one is the best approach but I’ll give these things a try.

    Get Yoast or Rankmath to do it for you. I believe they automatically check pages for any paginated posts and try to add rel attributes to it.

    Perhaps this would help – https://yoast.com/help/canonical-urls-in-wordpress-seo/

    Or try:

    A snippet the checks if there’s any pagination and hooks the appropriate <link> rel tags on the head.
    https://orbitingweb.com/blog/adding-next-and-prev-tags-to-paginated-posts/

    Thread Starter tolddsm

    (@tolddsm)

    Hi,

    Thanks but they don’t work.

    I’ll try something else.

    Plugin Support Elvin

    (@ejcabquina)

    No problem. It’s pretty tricky to do as WPSP wasn’t exactly coded for it.

    You can try directly modifying the links but I don’t think there’s a filter for pagination links that fit the description.

    A deeper dive on the plugin code shows this.
    https://github.com/tomusborne/wp-show-posts/blob/35e410d7800273fc66f211c0f80d553e95d17f83/inc/functions.php#L381-L394

    Not sure if paginate_links() (WordPress core function), has filter for attributes.

    Thread Starter tolddsm

    (@tolddsm)

    Yes, I agree.

    Thank you for the support!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘canonical and pagination’ is closed to new replies.