Is it right way to create shortcode?

The codex explain, I think, very well the creation of shortcodes http://codex.wordpress.org/Shortcode_API A very basic shortcode function foobar_func( $atts ){ return “foo and bar”; } add_shortcode( ‘foobar’, ‘foobar_func’ ); To use it, you just need to [foobar] The first parameter on add_shortcodeis the name of the shortcode function bartag_func( $atts ) { extract( shortcode_atts( array( … Read more

Using shortcode within shortcode with dynamic variable

You need to apply the do_shortcode to the content itself. Example below: function test_func( $atts, $content ) { extract( shortcode_atts( array( ‘foo’ => ‘no foo’, ‘baz’ => ‘default baz’ ), $atts ) ); return “<div class=”test”>”.do_shortcode($content).”</div>’; } add_shortcode( ‘test’, ‘test_func’ ); So in other words you need to care about the shortcode that print the … Read more

Manipulated shortcode output

It looks like you are getting caught in some wpautop() replacements. Many people find the defualt WordPress wpautop() filter to be frustrating. So often in highly customized themes, there is a homegrown replacement. For example, the theme you mentioned has a replacememt for some of the default WordPress filters. You can see a thread about … Read more

Have multiple loops on a page appear after/between page content

Use buffer to simply do that with ob_start() & ob_get_clean(). function custom_summary($atts) { extract(shortcode_atts(array( “category” => “”, “posts” => “” ), $atts)); ob_start(); $my_query = new WP_Query(“category_name=$category&posts_per_page=$posts”); while ($my_query->have_posts()) : $my_query->the_post(); // Do all the things. endwhile; wp_reset_postdata(); return ob_get_clean(); } add_shortcode(‘summary’, ‘custom_summary’);

Add an access code form to call a unique page based on page without registration

If your code is truly going to be the slug (“secret-page” = example.com/secret-page), you could do something like this… wp_redirect(get_bloginfo(‘url’).”https://wordpress.stackexchange.com/”.$_POST[‘access_code’]); But realize that headers cannot have already been sent, so this needs to happen before get_header(). Some more testing would be needed, but that should get you down the right path in principle. You could … Read more