The shortcode to display quantity of post comments

The shortcode to display quantity of post comments

function get_comments_quantity( $atts, $content = null ) { $atts = shortcode_atts( array( ‘postid’ => ”, ), $atts); $num_comments = get_comments_number( $atts[‘postid’] ); if ( comments_open() ) { if ( $num_comments == 0 ) { $comments = __(‘No Comments’, ‘rehub_framework’); } elseif ( $num_comments > 1 ) { $comments = $num_comments . __(‘ Comments’, ‘rehub_framework’); }…

Read More Read More

How to get a post thumbnailURL of a certain size

How to get a post thumbnailURL of a certain size

Input data: $post_id – ID of the post $size_thumb – e.g. array( 300, 300 ) or a standard / registered name like “middle” etc. function get_thumbnail_post_url( $post_id, $size_thumb ) { $image_id = get_post_thumbnail_id( $post_id ); $image_array = wp_get_attachment_image_src( $image_id, $size_thumb ); $image_url = $image_array[0]; return $image_url; } function thumbnail_post_url( $post_id, $size_thumb ) { echo get_thumbnail_post_url(…

Read More Read More

Inline
Inline