Hello @niksap
About question 2
This is a simple sample code to write in “your-theme/functions.php”.
function ccc_my_favorite_list_custom_template( $my_favorite_post_id=false ) {
$args= array(
'post_type' => 'any',
'post__in' => $my_favorite_post_id,
'orderby' => 'post__in',
'posts_per_page' => -1,
);
$the_query = new WP_Query($args);
if( $the_query->have_posts() ) {
?>
<p id="ccc-favorite-count"><span class="number"><?php echo $the_query->post_count; ?></span></p>
<div data-ccc_favorite-delete_all=true><a href="#" class="ccc-favorite-post-delete-button">All Delete</a></div>
<?php
while( $the_query->have_posts() ) {
$the_query->the_post();
?>
<div class="list-ccc_favorite">
if( has_post_thumbnail() ) {
echo '<img src="'.get_the_post_thumbnail_url($the_query->post->ID, 'thumbnail').'" />';
}
/*
* Your custom field
* Please write the code to output your custom field.
*/
<h3 class="title-post"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3><!-- /.title-post -->
<div class="ccc-favorite-post-toggle"><a href="#" class="ccc-favorite-post-toggle-button" data-post_id-ccc_favorite="<?php echo $the_query->post->ID; ?>"><span class="text">Your Text</span></a></div><!-- /.ccc-favorite-post-toggle -->
</div>
<?php
} //endwhile
} //endif
} // endfunction
shortcode: [ccc_my_favorite_list_custom_template style="none"]
style=”none” excludes the default CSS for the list.
The only important part of this function is the function name (ccc_my_favorite_list_custom_template) and arguments ($my_favorite_post_id).
After that, you can freely write the necessary elements in the standard WordPress code.
Please, try it.
Thanks