Creating tabs shortcode

user2587741 posted an answer to their question inside the question: $tabs_divs=””; function tabs_group($atts, $content = null ) { global $tabs_divs; $tabs_divs=””; $output=”<div id=”tab-side-container”><ul”; $output.=’>’.do_shortcode($content).'</ul>’; $output.= ‘<div class=”panel-container”>’.$tabs_divs.'</div>’; return $output; } function tab($atts, $content = null) { global $tabs_divs; extract(shortcode_atts(array( ‘id’ => ”, ‘title’ => ”, ), $atts)); if(empty($id)) $id = ‘side-tab’.rand(100,999); $output=” <li> <a href=”#”.$id.'”>’.$title.'</a> … Read more

Replace shortcode with output in database?

First of all create a function that use get_shortcode_regex to get the post_content of a post with the shortcode replaced. Note that any other shoertcode will be untouched function get_replaced_sourcecode_sc( $post ) { if ( empty($post) ) global $post; if ( empty($post) || ! isset($post->post_content) ) return false; $content = $post->post_content; if ( preg_match_all( “https://wordpress.stackexchange.com/”. … Read more

shortcode – I need to throw a message or load a different page

Move your form processing code outside the shortcode so you can hook it to an earlier action before headers are sent, then you can do whatever redirection you need to after the form is processed. function process_int_form(){ if ( isset( $_REQUEST[‘int_prefix’] ) && isset( $_REQUEST[‘int_suffix’] ) ) { // process form wp_redirect( home_url( $_SERVER[‘REQUEST_URI’] ) … Read more

How to put custom admin setting field into a shortcode

Your issues aren’t shortcode-related, just some PHP syntax problems. I suggest enabling debugging so you can see PHP errors being generated. Opening <?php and closing ?> php tags are for switching between html and php output. See escaping from html in PHP documentation. A function can only return once, as it immediately ends execution and … Read more

get data with shortcode

I am not sure about your error as well, but one thing you are doing wrong. Returning data. You should be ‘collecting’ them and then returning. $data=””; foreach ( $results as $result ) { $data .= ‘ Point: ‘.$result.’ ‘; } return $data; Try this loop.

How to show an image via shortcode

This is basic function to create a shortcodes. Put this code in your functions.php function smile_shortcode() { $output = get_template_directory_uri() . ‘/images/smile.png’; // put your smile image here $_image=”<img src=”” . $output . ‘”>’; return $_image; } add_shortcode(‘smile’,’smile_shortcode’); Then go to your dashboard and post editor. Remember to put [smile] in your post. More: http://codex.wordpress.org/Function_Reference/add_shortcode

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