$post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', //'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' )); // If there is more than 1 attachment in a gallery... if (count($attachment_ids) > 1) { foreach ($attachment_ids as $attachment_id) { if ($attachment_id == $post->ID) { $next_id = current($attachment_ids); break; } } unset($attachment_id); if (isset($next_id)) { // get the URL of the next image attachment... $next_attachment_url = get_attachment_link($next_id); } else { // or get the URL of the first image attachment. $next_attachment_url = get_attachment_link(array_shift($attachment_ids)); } unset($next_id); } $output = ''; $type = get_post_mime_type($post->ID); switch (strtolower($type)) { case 'audio/mp3': case 'audio/mpeg': case 'audio/mpeg3': case 'audio/mpg': case 'audio/wav': case 'audio/wave': case 'audio/webm': case 'audio/x-wav': $output = do_shortcode('[audio '.$metadata['fileformat'].'="'.wp_get_attachment_url($post->ID).'"][/audio]'); break; case 'image/bmp': case 'image/gif': case 'image/jpeg': case 'image/pjpeg': case 'image/png': case 'image/x-png': $output = sprintf( '%3$s', esc_url($next_attachment_url), the_title_attribute(array('echo' => false)), wp_get_attachment_image($post->ID, $attachment_size, false, array('class' => 'img-fluid aligncenter')) ); break; case 'video/mp4': case 'video/mpeg': case 'video/quicktime': case 'video/webm': case 'video/x-ms-wmv': case 'video/x-msvideo': $output = do_shortcode('[video width="'.$metadata['width'].'" height="'.$metadata['height'].'" '.$metadata['fileformat'].'="'.wp_get_attachment_url($post->ID).'"][/video]'); break; default: $output = '
' . wp_get_attachment_link() . '
'; break; }// endswitch; unset($type); unset($attachment_ids, $attachment_size, $metadata, $next_attachment_url, $post); if ($return === true) { return $output; } else { echo $output; unset($output); } }// attachment /** * Return or display categories list. * * @param string $categories_list The categories html. * @param boolean $return If set to true it will use return the value, if set to false it will be display immediately. * @return string Return categories list. */ public function categoriesList($categories_list, $return = false) { $output = sprintf(' %1$s', $categories_list); if ($return === true) { return $output; } else { echo $output; } }// categoriesList /** * Display comments link. */ public function commentsLink() { $comment_icon = ' %d'; $comments_icon = ' %s'; comments_popup_link(sprintf($comment_icon, ''), sprintf($comment_icon, '1'), sprintf($comments_icon, '%'), 'btn btn-light btn-sm'); }// commentsLink /** * Return or display continue reading message. * @param boolean $return If set to true it will use return the value, if set to false it will be display immediately. * @return string Return continue reading message. */ public function continueReading($return = false) { $output = __('Continue reading ', 'bootstrap-basic4'); if ($return === true) { return $output; } else { echo $output; } }// continueReading /** * Display the comments * * @param object $comment * @param array $args * @param integer $depth */ public function displayComments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; if ('pingback' == $comment->comment_type || 'trackback' == $comment->comment_type) { echo '
  • '; echo '
    '; echo '
    '; _e('Pingback:', 'bootstrap-basic4'); comment_author_link(); edit_comment_link(__('Edit', 'bootstrap-basic4'), '', ''); echo '
    '; echo '
    '; } else { echo '
  • '; echo '
    '; // footer echo '
    '; if (0 != $args['avatar_size']) { echo get_avatar($comment, $args['avatar_size']); } echo '
    '; // end footer // comment content echo '
    '; echo '
    '; echo ''; // if comment was not approved if ('0' == $comment->comment_approved) { echo '
    '; _e('Your comment is awaiting moderation.', 'bootstrap-basic4'); echo '
    '; } //endif; // comment author says /* translators: $s: Comment author name with link. */ printf(__('%s says:', 'bootstrap-basic4'), sprintf('%s', get_comment_author_link())); echo '
    '; // comment content body comment_text(); // end comment content body // reply link comment_reply_link(array_merge($args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => ' ' . __('Reply', 'bootstrap-basic4'), 'login_text' => ' ' . __('Log in to Reply', 'bootstrap-basic4') ))); // end reply link echo '
    '; // end comment content echo '
    '; } //endif; }// displayComments /** * Return or display edit post link. * * @param boolean $return If set to true it will use return the value, if set to false it will be display immediately. * @return string Return edit post link. */ public function editPostLink($return = false) { $edit_post_link = get_edit_post_link(); if ($edit_post_link != null) { $edit_btn = ''; unset($edit_post_link); if ($return === true) { return $edit_btn; } else { echo $edit_btn; } } unset($edit_btn, $edit_post_link); }// editPostLink /** * Return or display pagination. * * @global \WP_Query $wp_query WordPress query class. * @param string $pagination_align_class The pagination css class. * @param boolean $return If set to true it will use return the value, if set to false it will be display immediately. * @return string Return pagination html. */ public function pagination($pagination_align_class = 'justify-content-center', $return = false) { $output = apply_filters('bootstrap_basic4_pagination', '');// allow plugin hooks to override pagination. if ($output != '') { if ($return === true) { return $return; } else { echo $output; unset($output); return ; } } global $wp_query; $big = 999999999; $pagination_array = paginate_links(array( 'base' => str_replace($big, '%#%', get_pagenum_link($big)), 'format' => '/page/%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages, 'prev_text' => '«', 'next_text' => '»', 'type' => 'array' )); unset($big); if (is_array($pagination_array) && !empty($pagination_array)) { $output .= '