Home › Forums › Pro Support › AJAX Pagination loading too much; another link for button
- This topic has 23 replies, 2 voices, and was last updated 1 year, 1 month ago by
elvin.
-
AuthorPosts
-
December 16, 2021 at 4:02 am #36126
elvin
ModeratorYes, 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? π
December 18, 2021 at 7:06 am #36137Stephan
ParticipantHi 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.
December 19, 2021 at 11:12 pm #36141elvin
ModeratorAh 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 );
December 20, 2021 at 1:41 pm #36154Stephan
ParticipantThank 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.
December 20, 2021 at 7:55 pm #36162elvin
ModeratorStrange.
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/December 21, 2021 at 1:33 am #36168Stephan
ParticipantThat 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?
December 21, 2021 at 6:49 pm #36175elvin
ModeratorThat 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. π
December 22, 2021 at 1:54 am #36185Stephan
ParticipantI see. I am using them already π
Thank you again for your help!
December 22, 2021 at 3:31 am #36190elvin
ModeratorNo problem. π
-
AuthorPosts
- You must be logged in to reply to this topic.