The result of a shortcode appear BEFORE page content
codex the_title() replace this $mypost .= the_title(); with $mypost .= the_title(”,”,false);
codex the_title() replace this $mypost .= the_title(); with $mypost .= the_title(”,”,false);
The shortcode // Add Shortcode to show posts count inside a category function category_post_count( $atts ) { $atts = shortcode_atts( array( ‘category’ => null ), $atts ); // get the category by slug. $term = get_term_by( ‘slug’, $atts[‘category’], ‘category’); return ( isset( $term->count ) ) ? $term->count : 0; } add_shortcode( ‘category_post_count’, ‘category_post_count’ ); Usage … Read more
Use this instead: Concatenate the html then return it. function check_my_login( $atts) { $html=”<form action=”” name=”” method=”post” enctype=”multipart/form-data”>”; $html .= ‘<div class=”form-group”>’; $html .= ‘<label for=”description”>Project Description</label>’; $html .= ‘<textarea name=”p_description” placeholder=”Project Description” class=”form-control”>’; if(isset($_POST[‘p_description’]) && $_POST[‘p_description’] != ”){ $html .= $_POST[‘p_description’]; } $html .= ‘</textarea>’; $html .= ‘</div>’; $html .= ‘<div class=”form-group”>’; $html .= … Read more
Without knowing what your post_gallery filter function does, there’s no way to give a proper answer. However, if you are using the post_gallery filter, and returning new markup, then yes, it will be used in feeds too. The code you mention commenting out happens after the post_gallery filter, and won’t get executed at all if … Read more
(Update 04.05.2012: Include captions) Let’s start with a solution … There is no filter especially for gallery image links. There is also no filter for the gallery shortcode output. So we have to fake one: add_action( ‘after_setup_theme’, ‘wpse_50911_replace_img_shortcodes’ ); /** * Replace the default shortcode handlers. * * @return void */ function wpse_50911_replace_img_shortcodes() { remove_shortcode( … Read more
It looks like wp_list_categories($args) will output directly when you call it, which is why the output comes out in a weird place. and ideally what you need is to capture the output and return it, but luckily wp_list_categories allows you to do this with the ‘echo’ parameter. Try: $args[‘echo’] = FALSE; return wp_list_categories($args); Note the … Read more
You can filter ‘post_gallery’. If you return not an empty string WordPress will use your return value and not build the gallery with the native code. But then you have to rebuild the whole gallery code … The second option: Mask the gallery shortcode and filter just ‘wp_get_attachment_link’. Sample code (not tested, just an idea): … Read more
This highly depends on what you need. General answer on the question The Rewrite API basically does all the URl rewrite stuff. The Shortcode API is meant to be an easy to use extension approach for people who want to extend their posts/content with the text/html editor. As an alternative, you also/extend use the quicktag … Read more
Ok, I’ve never seen a shortcode done in this way so I threw together a bit of code to test your scenario. And I get the same results with code that works just fine with the standard shortcode format. Standard Shortcode Format [shortcode name1=”value1″ name2=”value2″] I don’t believe this is a result of wpautop(), but … Read more
The popup of a TinyMCE is outside WordPress. You must include the wp-load.php, same handle like outside the WordPress install. But think about this solution and maybe it is cleaner, that you create your data in a json string and handle this data in the popup. It is helpful to reads this post about the … Read more