Create Button for Shortcode in Text Editor
Create Button for Shortcode in Text Editor
Create Button for Shortcode in Text Editor
Onclick want to call shortcode in wordpress
How to completely prevent WordPress from destroying/modifying my shortcode outputs?
I figured it out! Using this code I was able to use my custom meta field as the link in the audio shortcode. First I created a function in functions.php: function audio_link() { $terms = get_the_terms($post->ID, ‘taxonomy-name’); $result = “”; if (is_array($terms) || is_object($terms)){ foreach ($terms as $term) { $term_id = $term->term_id; $result .= get_term_meta( … Read more
function bartag_func( $atts ) { $atts = shortcode_atts( array( ‘latitude’ => ‘28.66’, // default value ‘longitude’ => ‘99.25’ // default value ), $atts, ‘bartag’ ); return <div class=”” latitude=” ‘.$atts[‘latitude’].’ ” longitude=” ‘.$atts[‘longitude’].’ “></div>’; } add_shortcode( ‘bartag’, ‘bartag_func’ ); Now you can use shortcode like : [bartag latitude=”12.34″ latitude=”12.34″] will return : <div class=”” latitude=”12.34″ … Read more
@WebElaine is correct. I had to use the wp_get_current_user(); and remove global. This is what worked for me function download_to_wallet() { $current_user = wp_get_current_user(); // get current user’s information $qr_url = $current_user->qrbase_code_pass_url; return ‘<a href=”‘. $qr_url . ‘”><img class=”qr_download” src=”https://example.com/wp-content/uploads/2018/08/add-to-apple-wallet-logo.png” style=”width:200px;”></a>’; }
Remove Shortcodes First, try this on your functions.php: add_filter( ‘get_the_excerpt’, ‘strip_shortcodes’, 20 ); If it doesn’t work then try this edit. echo strip_shortcodes( get_the_excerpt() ); In case the shortcode is not registered with WordPress function add_shortcode add_filter( ‘the_excerpt’, ‘remove_shortcodes_in_excerpt’, 20 ); function remove_shortcodes_in_excerpt( $content){ $content = strip_shortcodes($content); $tagnames = array(‘box’, ‘alert’); // add shortcode tag … Read more
I don’t think you want the display name – it may not be unique. Try using the log-in name instead. The user name for the displayed profile: $myhope = bp_get_displayed_user_username(); The user name for the current user: $current_user = wp_get_current_user(); $myhope = $current_user->user_login;
First of all, you have a syntax error. If your shortcode is stored in the $output variable, you would need to call echo do_schortcode($output);. But, wouldn’t simply the_content(); do the trick? I believe the shortcodes would be processed if you do this. You can make a new query with WP_Query, and then use the_content() in … Read more
the_excerpt strips away html tags. You will need to switch to the_content and use quick tag instead. view the docs on this Basic Example: <?php the_content( ‘Read more …’ ); ?>