Pods Frontend Shortcode to display Custom Post Type for current user

gistfile1.php

// Shortcode can be added like this
// [pods_by_current_user_cpt name="document" template="Document Template"]
// 
// Supports all shortcode attributes from standard PODS shortcode:
// http://pods.io/docs/learn/shortcodes/pods/

add_shortcode( 'pods_by_current_user_cpt', 'pods_by_current_user_cpt' );

function pods_by_current_user_cpt( $atts, $content = null ) {
	$current_user  = wp_get_current_user();
	$user_id       = $current_user->ID;
	$atts['where'] = 'post_author = ' . (int) $user_id;

	return pods_shortcode( $atts, $content );
}
No comments yet.

Leave a Reply