Tag Info

Hot answers tagged

4

If you want to do this via AJAX, on the server side you could do something like the following: add_action( 'wp_ajax_nopriv_update_shortcode_content', 'update_shortcode_content' ); function update_shortcode_content(){ if( !empty( $_GET['new_shortcode_value'] ) ){ $updated_content = do_shortcode( '[theshortcode value="' . ...


3

Just use do_shortcode: echo '<div class="wrap">'. do_shortcode( $two ) .'</div>';


2

I think your code is very close, try to use wp_get_attachment_image_src() instead: function thumb_medium( $atts, $content = null ) { // return wp_get_attachment_url( get_post_thumbnail_id( $post_id, 'medium') ); global $post; $thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' )[0]; if ($thumb_url) { ...


2

Nice sleuthing. Every single person on this SO site has been foiled by something exactly like this at one point or another with the WordPress template hierarchy. You might think of this backwards though. All the steps you found lead you back to the shortcode [pmpro_account] which gets output in the loop-myaccount.php by way of the_content(). That ...


1

WordPress 4.2.3 made some changes to the way shortcodes work in order to fix a security issue. See here: https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/ This is most likely the cause of your problem. See the Shortcodes with Bad Quotes section, and the accompanying workaround suggestion.


1

I don't know exactly what you are trying to do but perhaps something like this: function customfields_shortcode( $atts ) { if (!empty($atts['field']) && get_post_meta( get_the_ID(), $atts['field'], true ) ) { $customfield = get_post_meta( get_the_ID(), $atts['field'], true ); return "custom field >> $customfield << custom ...



Only top voted, non community-wiki answers of a minimum length are eligible