We're merging with GenerateBlocks! Learn more here.

[Resolved] AJAX Pagination loading too much; another link for button

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support AJAX Pagination loading too much; another link for button

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #36126
    elvin
    Moderator

    Yes, I understand what you want do to with it but I don’t be able to apply the change if I don’t know the exact affiliate link I need to put in place of esc_url( get_permalink() ).

    Can you provide the link to be applied or at least give a hint on which plugin is generating it for you for me to get an idea which way to point next? πŸ˜€

    #36137
    Stephan
    Participant

    Hi Elvin,

    there is not one external link, there is one link for every WooCommerce product there is. It is the link in the “product_url” column header (see here https://woocommerce.com/document/product-csv-import-suite-column-header-reference/) for external products generated by the used JSON plugin (there the field is called “external_url”.

    So that plugin makes a new WooCommerce product and writes the external link for the buy button in the standard WooCommerce field “product_url”. And this link I want in WP Show Posts so its button links to the same exact link directly.

    Sorry if I cannot explain it good enough. So I made a screenshot also:

    I want this external link of a single WooCommerce product (different for every one)

    On the button of the corresponding WP Show Posts entry on the front page

    Thank you. Your patience is much appreciated.

    #36141
    elvin
    Moderator

    Ah that one!

    Try this.

    I wanted the β€œRead more” more link directly linking to the product link of the WooCommerce link. You gave me this code:

    add_filter( 'wpsp_read_more_output', function( $output, $settings ) {
    $productURL = get_post_meta( get_the_ID(),'_product_url', false ); 
    if( 1987 === (int) $settings["list_id"]){
        return sprintf(
            '<div class="wpsp-read-more"><a title="%1$s" class="%4$s" href="%2$s">%3$s</a></div>',
            the_title_attribute( 'echo=0' ),
            $productURL[0],
            __( 'Read more', 'wp-show-posts' ),
            esc_attr( $settings['read_more_class'] )
        );
    }
    
    return $output;
    }, 10, 2 );
    #36154
    Stephan
    Participant

    Thank you. I see what you did with the URL, thank you for that!

    Problem is, I still get the same error as with your first code snippet. When I activate it everything vanishes except for one entry.

    #36162
    elvin
    Moderator

    Strange.

    I’ve tested the code to be sure and on my sandbox site here – https://dev-generate-press.pantheonsite.io/wp_show_posts-id18/ – you can see that the product’s “read more” links point to external links like http://www.google.com and http://www.test.com, meaning it works.

    On the code, I basically just changed the WPSP list id.

    Can you try updating to 1.2.0 and temporarily disable ALL plugins except WPSP and WPSP pro to check for conflict?
    https://wpshowposts.com/wp-show-posts-1-2-0/

    #36168
    Stephan
    Participant

    That was it! With the alpha version, it works perfectly – even with all the plugins activated again.

    If I deactivate all plugins with the normal version, the error persists.

    So glad we found it, thank you so much! Can you advise how to proceed? Can I just use the alpha version and update every now and then?

    #36175
    elvin
    Moderator

    That version would be the final version for WPSP as it is set to merge with GenerateBlocks next year.

    This means, if you wish for an update, you’ll have to change to GenerateBlocks. πŸ˜€

    #36185
    Stephan
    Participant

    I see. I am using them already πŸ™‚

    Thank you again for your help!

    #36190
    elvin
    Moderator

    No problem. πŸ˜€

Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.