I'm currently using a plugin CPT AJAX load more in wordpress. How can I show posts from only one author by id.
<?php echo do_shortcode('[cpt_ajax_load_more post_type="post" template="default" posts_per_page="6" button_text="More" button_color="red"]');?>
You have to pass "author" attr with your author id as the value.
<?php echo do_shortcode('[cpt_ajax_load_more post_type="post" template="default" posts_per_page="6" button_text="More" button_color="red" author="authorid" ]');?>
Below are the default attributes that you can use.
// Extact shortcode arrtibutes.
extract( shortcode_atts( array(
'nested' => false,
'woo' => false,
'woo_template' => '',
'tabs' => false,
'tab_template' => '',
'filters' => false,
'target' => '',
'filters_url' => 'true',
'filters_paging' => 'true',
'filters_scroll' => 'false',
'filters_scrolltop' => '30',
'filters_analytics' => 'true',
'filters_debug' => false,
'term_query' => false,
'term_query_taxonomy' => '',
'term_query_hide_empty' => 'true',
'term_query_number' => '5',
'acf' => false,
'acf_post_id' => '',
'acf_field_type' => 'repeater',
'acf_field_name' => '',
'acf_parent_field_name' => '',
'restapi' => false,
'restapi_base' => '/wp-json',
'restapi_namespace' => 'ajaxloadmore',
'restapi_endpoint' => 'posts',
'restapi_template_id' => '',
'restapi_debug' => false,
'users' => false,
'users_role' => '',
'users_include' => '',
'users_exclude' => '',
'users_per_page' => '5',
'users_order' => 'ASC',
'users_orderby' => 'login',
'comments' => false,
'comments_per_page' => '5',
'comments_type' => 'comment',
'comments_style' => 'ol',
'comments_template' => 'none',
'comments_callback' => '',
'comments_post_id' => '',
'nextpage' => false,
'nextpage_post_id' => '',
'nextpage_urls' => 'true',
'nextpage_scroll' => 'false:30',
'nextpage_pageviews' => 'true',
'nextpage_title_template' => '',
'nextpage_start' => 1,
'previous_post' => false,
'previous_post_id' => '',
'previous_post_order' => 'previous',
'previous_post_taxonomy' => '',
'previous_post_excluded_terms' => '',
'single_post' => false,
'single_post_id' => '',
'single_post_order' => 'previous',
'single_post_query_order' => 'previous',
'single_post_taxonomy' => '',
'single_post_excluded_terms' => '',
'single_post_progress_bar' => '',
'single_post_target' => '',
'single_post_preview' => '',
'cache' => 'false',
'cache_id' => '',
'paging' => 'false',
'paging_controls' => 'false',
'paging_show_at_most' => '7',
'paging_classes' => '',
'paging_scroll' => false,
'paging_first_label' => apply_filters( 'alm_paging_first_label', '' ),
'paging_last_label' => apply_filters( 'alm_paging_last_label', '' ),
'paging_previous_label' => apply_filters( 'alm_paging_previous_label', '«' ),
'paging_next_label' => apply_filters( 'alm_paging_next_label', '»' ),
'preloaded' => 'false',
'preloaded_amount' => '5',
'seo' => 'false',
'repeater' => 'default',
'theme_repeater' => 'null',
'cta' => false,
'cta_position' => 'before:1',
'cta_repeater' => 'null',
'cta_theme_repeater' => 'null',
'masonry' => '',
'post_type' => 'post',
'sticky_posts' => false,
'post_format' => '',
'category' => '',
'category__and' => '',
'category__not_in' => '',
'tag' => '',
'tag__and' => '',
'tag__not_in' => '',
'taxonomy' => '',
'taxonomy_terms' => '',
'taxonomy_operator' => '',
'taxonomy_relation' => '',
'meta_key' => '',
'meta_value' => '',
'meta_compare' => '',
'meta_relation' => '',
'meta_type' => '',
'year' => '',
'month' => '',
'day' => '',
'author' => '',
'search' => '',
'custom_args' => '',
'post_status' => '',
'order' => 'DESC',
'orderby' => 'date',
'post__in' => '',
'post__not_in' => '',
'exclude' => '',
'offset' => '0',
'posts_per_page' => '5',
'scroll' => 'true',
'scroll_distance' => '100',
'scroll_container' => '',
'scroll_direction' => '',
'max_pages' => '0',
'pause_override' => 'false',
'pause' => 'false',
'destroy_after' => '',
'transition' => 'fade',
'transition_speed' => '250',
'transition_container' => 'true',
'transition_container_classes' => '',
'masonry_selector' => '',
'masonry_columnwidth' => '',
'masonry_animation' => '',
'masonry_horizontalorder' => '',
'progress_bar' => 'false',
'progress_bar_color' => 'ed7070',
'images_loaded' => 'false',
'button_label' => apply_filters( 'alm_button_label', __( 'Load More', 'ajax-load-more' ) ),
'button_loading_label' => '',
'button_done_label' => '',
'container_type' => '',
'css_classes' => '',
'loading_style' => '',
'id' => '',
'vars' => '',
'primary' => false,
'no_results_text' => '',
'placeholder' => '',
'lazy_images' => false,
'archive' => false,
'woocommerce' => false,
'elementor' => false,
'elementor_target' => '',
'elementor_url' => '',
'elementor_link_label' => '',
'elementor_controls' => '',
'elementor_scrolltop' => '',
'elementor_paged' => ( ! get_query_var( 'page' ) || get_query_var( 'page' ) == 0 ) ? 1 : (int) get_query_var( 'page' ),
'elementor_woo_paged' => ( !isset( $_GET['product-page'] ) || $_GET['product-page'] == 1 ) ? 1 : (int) $_GET['product-page']
), $atts) );