Set redirect for need login
Use wp_redirect() instead of auth_redirect() – make sure to call exit() right after wp_redirect(). Check out the codex for more info on wp_redirect.
Use wp_redirect() instead of auth_redirect() – make sure to call exit() right after wp_redirect(). Check out the codex for more info on wp_redirect.
Build Clickable Link Using Multiple Attributes
Create shortcode for each form field in contact form 7
Custom shortcode skips every 2nd shortcode
ACF repeater + group shortcode
You haven’t assign for $atts. So suprised that the poster can work correctly. function video_custom($atts) { extract(shortcode_atts(array( ‘option’ => ”, ‘poster’ => ”, ‘src’ => ”, ‘type’ => ”, ), $atts)); return ‘<div class=”d-flex justify-content-center”><video class=”wp-video” ‘ . $option . ‘ poster=”‘ . $poster . ‘”><source src=”‘ . $src . ‘” type=”video/’ . $type . … Read more
get_queried_object_id / short code returning blank
What you’re asking for is likely to be possible using a plugin to handle the shortcode. However, I cannot work out from what you’ve posted what you’re trying to achieve. Can you be a bit more detailed in what you’re trying to achieve? Rather than giving us the desired outcome, a bit of information on … Read more
Shortcodes are plain text wrapper made exactly for cases when PHP code is not available or should not be used. You can concatenate that to string and evaluate it with do_shortcode(). You can look up function that powers shortcode (set up with add_shortcode()) and use it in PHP code directly.
If you’re embedding the code directly into the template file, why bother with shortcodes? Simply extract the code from the add_shortcode() function call, and add it to your template, wrapped in an appropriate conditional tag, such as in_category(), e.g.: if ( in_category( $cat ) ) { // put shortcode code here } Note: the $cat … Read more