'aump_portfolio', 'posts_per_page' => $posts_per_page, 'paged' => $paged, ]; if (!empty($category)) { $args['tax_query'] = [ [ 'taxonomy' => 'aump_portfolio_category', 'field' => 'term_id', 'terms' => [$category], 'operator' => 'IN', ] ]; } $query = new WP_Query($args); $has_more = ($paged < $query->max_num_pages); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $image_size = get_option('aump_thumbnail_size', 'full'); $image_url = wp_get_attachment_image_url(get_post_thumbnail_id(), $image_size); $desc_limit = get_option('aump_desc_word_limit', 15); $description = get_the_excerpt(); $short_description = esc_html(wp_trim_words($description, $desc_limit, '...')); $displaybtn = get_option('aump_show_open_button') ? 'block' : 'none'; $details_button_text = get_option('aump_open_button_text', 'See Details'); echo ''; echo '
'; echo ' '; if ($image_url) { echo ' ' . esc_attr(get_the_title()) . ''; } echo ' '; echo ' ' . esc_html($details_button_text) . ''; if (get_option('aump_show_title')) { echo '

' . esc_html(get_the_title()) . '

'; } if (get_option('aump_show_description') && !empty($short_description)) { echo '

' . esc_html($short_description) . '

'; } echo '
'; echo ''; } } if (!$has_more) { echo ''; } wp_reset_postdata(); die(); } add_action('wp_ajax_aump_load_more', 'aump_load_more_projects'); add_action('wp_ajax_nopriv_aump_load_more', 'aump_load_more_projects'); /** * Category Filter Shortcode */ function aump_category_filter_shortcode() { ob_start(); $enable_category_filter = get_option('aump_enable_category_filter', true); $load_more_text = get_option('aump_load_more_button_text', 'Load More Items'); if ($enable_category_filter) { echo '
'; $terms = get_terms([ 'taxonomy' => 'aump_portfolio_category', 'orderby' => 'name', 'hide_empty' => true, ]); if (!empty($terms) && !is_wp_error($terms)) { echo '' . esc_html__('All', 'advanced-universal-modern-portfolio-and-gallery') . ''; foreach ($terms as $term) { echo '' . esc_html($term->name) . ' '; } } echo '
'; } echo '
'; echo '
'; echo '
'; $display = get_option('aump_show_load_more_button') ? 'inline-block' : 'none'; echo '
'; echo ' '; echo '
'; return ob_get_clean(); } add_shortcode('aump_portfolio', 'aump_category_filter_shortcode');