Creating Features List in WordPress Post

Convert the items in the shortcode into an array, and return a list: add_shortcode( ‘features_list’, ‘shortcode_features_list’ ); function shortcode_features_list( $atts = array(), $content=”” ) { $content = trim( $content ); if ( ” === $content ) return; $items = explode( “\n”, $content ); $items = array_map( ‘trim’, $items ); return ‘<ul class=”features”><li>’ . join( ‘</li><li>’, … Read more

get value from post to sidebar

You did not explain your question well so I am guessing quite a bit but I think you want something like this: function post_ids_wpse() { global $wp_query; $ids = wp_list_pluck($wp_query->posts,’ID’); $scs=””; foreach ($ids as $id) { $scs .= “[wp_value id='{$id}’]”; } echo do_shortcode($scs); } That is very crude. You should check that the various values … Read more

How to read a page’s “Shortcodes” from the Template File?

Parsing shortcodes from strings WordPress parses and replaces shortcodes from a piece of content via the do_shortcode function. This function, in turn, calls get_shortcode_regex, which returns the regular expression for matching shortcodes in a string. Using this function, we can get a list of all shortcodes ourselves: $pattern = get_shortcode_regex(); preg_match_all( “/$pattern/s”, $content, $matches ); … Read more

Php inside the shortcode is getting commented

You can not execute functions inside the do_shortcode() call like you are trying to. If you are just trying to wrap your post meta content with the shortcode, then you can do it like shown below. $your_post_meta_variable_content = get_post_meta( $postid, principal_1, true ); echo do_shortcode( ‘[learn_more caption=”ancila”]’ . $your_post_meta_variable_content . ‘[/learn_more]’ );

Question about do_shortcode

There are number of ways to do it. The specific one for your case is that you have to find the function which that shortcode “calls”. For this, you can download your theme and plugin files and search add_shortcode or better product_categories(your shortcode name) term in all files using some notepad software. Notepad++ has a … Read more

How to Convert Shortcode into a link?

Wrap your shortcode in a div and give it an ID that you can use as a target when triggering your popup. For example, you can put the shortcode somewhere on your page (content, sidebar, etc) as follows: <div id=”popup” class=”lightbox”>[contact-form-7 id=”1735″ title=”Contact form 1″]</div> and the link that trigges the popup will look something … Read more

How to Pass ID through Short Code

Your short code function receives the attributes as the first argument: function shortcode_function( $attributes ) { Here $attributes is an array, and the attributes/values are inside that variable, e.g. for [my-shortcode abc=”123″ xyz=”789″]: echo $attributes[‘abc’]; // prints 123 echo $attributes[‘xyz’]; // prints 789 You should also provide defaults and an opportunity to filter: $attributes = … Read more

woocommerce Product shortcode create [closed]

Hello Here is the Shortcode you can use this it will give you title link and image of product. Put this code in functions.php file of your theme. add_shortcode(‘product_data’,’custom_product_function’); function custom_product_function($atts) { $post_id = $atts[‘id’]; $title = get_the_title($post_id); $link = get_the_permalink($post_id); $image = get_the_post_thumbnail($post_id); $data=”<div><a href=””.$link.'”><p>’.$title.'</p></a>’. $image.'</div>’; return $data; } And then add the shortcode … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)