function wp_ulike_pro_get_current_user_pinned_posts($atts){
	global $post;

    $attributes = shortcode_atts( array(
        'post_type' => 'post',
		'past_days' => '',
        'per_page'  => 100
    ), $atts );

	if( strpos( $attributes['post_type'], ',' ) ){
		$attributes['post_type'] = explode(',', $attributes['post_type']);
	}

	$currentUser = is_user_logged_in() ? get_current_user_id() : wp_ulike_generate_user_id( wp_ulike_get_user_ip() );
	$getPosts    = NULL;

	if( empty( $attributes['past_days'] ) ){
		$pinnedItems = wp_ulike_get_meta_data( $currentUser, 'user', 'post_status', true );
		// Exclude like status
		$pinnedItems = ! empty( $pinnedItems ) ? array_filter($pinnedItems, function($v, $k) {
			return $v == 'like';
		}, ARRAY_FILTER_USE_BOTH) : NULL;

		if( ! empty( $pinnedItems ) ){
			$getPosts = get_posts( array(
				'post_type' => $attributes['post_type'],
                'post_status' => array( 'publish', 'inherit' ),
                'posts_per_page' => $attributes['per_page'],
                'paged' => ( get_query_var('page') ? get_query_var('page') : 1 ),
                'post__in' => array_reverse( array_keys( $pinnedItems ) ),
                'orderby' => 'post__in'
			) );
		}

	} else {
		$getPosts = wp_ulike_get_most_liked_posts( $attributes['per_page'], $attributes['post_type'], 'post', array(
			'start' => wp_ulike_pro_get_past_time( $attributes['past_days'] ),
			'end'   => current_time( 'mysql' )
		), array( 'like' ), false, 1, $currentUser );
	}

	$output = '';

	if( ! empty( $getPosts ) ){
		ob_start();
		foreach ( $getPosts as $post ) :
			setup_postdata( $post ); ?>
<article class="excerpt excerpt-titletype">
	<div class="focus" ><a href="<?php the_permalink(); ?>" class="thumbnail" target="_blank">
		<?php
if (has_post_thumbnail())
{
    the_post_thumbnail();
}
?>
		</a></div>
	<header>
		<?php
if (!dopt('d_post_cat_b') && !is_category())
{
    $category = get_the_category();
    if ($category[0])
    {
        echo '<a class="label label-important" href="' . get_category_link($category[0]->term_id) . '">' . $category[0]->cat_name . '<i class="label-arrow"></i></a>';
    }
};
?>
		<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?> - <?php bloginfo('name'); ?>" target="_blank"><?php the_title(); ?></a></h3>
	</header>
	<p>
	<?php if (!$_time)
{ ?><span class="muted"><i class="icon-time icon12"></i> <?php the_time('Md / Y') ?>
</span><?php
} ?>

			
	<?php if (!$_views)
{ ?><span class="muted"><i class="icon-eye-open icon12"></i> <?php deel_views(__('', 'TBL')); ?></span><?php
} ?>

		<span class="muted">
<?php
global $post;
foreach (get_the_tags($post->ID) as $tag)
{
    echo '<a class="cx-ddd" href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
}

?>
		
					<?php
// Get the ID of a given category
$category_id = get_cat_ID('Category Name');

// Get the URL of this category
$category_link = get_category_link($category_id);
?>

<a class="cx-ddd" href="<?php echo esc_url($category_link); ?>" title="<?php single_cat_title(); ?>"><?php single_cat_title(); ?></a>

		
		</span>

    <p><?php
echo do_shortcode('[wp_ulike style="wpulike-heart"]'); ?>
	</p>
</article>



		<?php
endforeach;
wp_reset_postdata();
$output = sprintf('<div class="clike">%s</div>', ob_get_clean());
}

return $output;
}
add_shortcode('user_pinned_posts', 'wp_ulike_pro_get_current_user_pinned_posts');

