Shortcode to display all the post from a category in a page

Try this… <?php function list_post(){ //or you can use the cat id here, check the codex for WP_Query $q = new WP_Query(array(‘category_name’ => ‘<cat slug here>’)); if($q->have_posts()): while($q->have_posts()):the_post(); the_title(); endwhile; else: echo “No posts found!”; endif; wp_reset_postdata(); } add_shortcode(‘list_post’, ‘list_post’); ?>

How to process shortcode on post save and update only

If you want to modify content when the user saves a post, you’ll want to hook in a function using the save_post hook. Within that function, you can process registered shortcodes using get_shortcode_regex which will give you the shortcodes and attributes used in that post. (However, if you want to process the content when the … Read more

Plugin renders in preview but shortcode shows when published

find the function that generates the output, or the output itself if it’s hardcoded in your page and add this function to it: <?php echo do_shortcode( $content ) ?> if your content is generated through the_post(), it’ll be: <?php echo do_shortcode( the_post() ) ?> or the_excerpt: <?php echo do_shortcode( the_excerpt() ) ?>

Twitter bootstrap tabs

Check out the WordPress Bootstrap CSS plugin. It seems to contain “handy shortcodes” to insert all sorts of elements. Also check out Obenland’s The Bootstrap WordPress theme that was released a week ago.

post/page content

You need to apply the filter the_content e.g.: <?php echo apply_filters(‘the_content’,$home_page->post_content); ?> Also, you don’t need custom shortcodes for youtube, just put the URL in the content (but not a hyperlink), and it’ll be swapped out for a youtube player at runtime. No plugins or extra code needed thanks to oembed.

Is there a way to show attachment IDs on the attachment info screen?

You could hook into ‘attachment_fields_to_edit’ and just add a row: <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Show Attachment ID * Version: 2012.06.04 * Author: Thomas Scholz <[email protected]> * Author URI: http://toscho.de * License: MIT * License URI: http://www.opensource.org/licenses/mit-license.php */ if ( ! function_exists( ‘t5_show_attachment_id’ ) ) { add_filter( ‘attachment_fields_to_edit’, ‘t5_show_attachment_id’, … Read more

Content in WP Editor displayed below CPT shortcode [duplicate]

Your shortcode should return it’s output and not echo it out ex: $defaults = apply_filters( ‘arconix_faq_shortcode_query_args’, array( ‘post_type’ => ‘faq’, ‘showposts’ => ‘all’, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’ ) ); extract( shortcode_atts( $defaults, $atts ) ); /** Translate ‘all’ to -1 for query terms */ if( $showposts == “all” ) $showposts = “-1”; /** … Read more

show all the posts thumbnails

you can modify or create a simple posts loop with only feature image in there. so you could use something like : <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div class=”feature-image”> <a href=”https://wordpress.stackexchange.com/questions/55244/<?php the_permalink(); ?>”><?php the_post_thumbnail(); ?></a> </div> <?php endwhile; ?> <?php wp_reset_query(); ?> then your CSS can be: .feature-image … Read more