Home › Forums › Pro Support › snippet to convert a shortcode Tagged: snippet filter This topic has 3 replies, 2 voices, and was last updated 2 years, 2 months ago by elvin. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts July 1, 2021 at 3:53 am #31631 CarloParticipant Hi all, since there is a problem with & converted into & amp ; (wihout spaces) in gutenberg shortcodes and html blocks as well, in a generatepress forum’s thread (this is the link https://generatepress.com/forums/topic/turning-into-in-shortocodes/#post-1840249) David suggested me to refer to the following post in this forum https://wpshowposts.com/support/topic/category-specific-side-bar/#post-31332 What would the snippet code be providing that my aim is to reproduce this shortcode? [wp_show_posts id=”10150″ settings=”meta_key=id_number&orderby=meta_value&order=ASC”] Thank you. All the best. Carlo July 1, 2021 at 8:47 pm #31650 elvinModerator Hi Carlo, Try this: add_shortcode('dynamic_wpsp', function($atts){ $queriedArchive = get_queried_object(); $atts = shortcode_atts( array( 'id' => '' ), $atts, 'dynamic_wpsp' ); $settings = array( 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => 'id_number', ); ob_start(); wpsp_display( $atts['id'], $settings ); return ob_get_clean(); }); July 4, 2021 at 8:54 am #31687 CarloParticipant Thank you Elvin, it works. Just in case someone else should need it, I just added the id number of the list here (ie: 1234) ‘id’ => ‘1234’ July 4, 2021 at 6:49 pm #31703 elvinModerator Ah yes that’s right I forgot to mention the shortcode attributes. My bad. Yes you need to specify that. Else, the shortcode wouldn’t know which to call. Example: [dynamic_wpsp id="80210"] Glad you got it sorted. No problem. 😀 Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In