Fetcher
Fetcher is a flexible shortcode that can retrieve objects and show them as a grid or slider.
Options
id
: Assign the wrapper ID. If no value is declared, a random ID will be assigned.
content
: Accepts: post|image|terms
.
layout
: Accepts: grid|slider
.
pagination
: Accepts: paged|ajax
.
ppp
: Posts per page. Default: 999
.
parent_class
: Class names for the parent element. Default: x-9 m0a df fww gtr
.
child_class
: Class names for each child element. Default: x-3 x-fd df
.
order
: Accepts: ASC|DESC
.
orderby
: Accepts: ID|date|title|type|modified|rand|menu_order
.
post_type
: Custom post type name.
taxonomy
: Taxonomy slug (optional).
terms
: Comma-separated list of terms.
attributes
: Comma-separated list of product attributes.
images
: Comma-separated list of image ID's.
lightbox
: Enable lightbox feature. Default: false
.
hide_image
: Hide the image. Default: false
.
hide_title
: Hide the title. Default: false
.
filter
: List of term ID's to create Ajax filtering.
Slider options
slider_pp
: Slides per page. Default: 3
.
slider_gap
: Gap between each slide. Default: var(--gutter)
.
slider_dots
: Show dots below the slider. Default: false
.
slider_type
: Accepts: slide|loop
. Default: slide
.
slider_snap
: Snap on the slide edge. Default: true
.
slider_drag
: Accepts: (boolean)|'free'
. Default: true
.
slider_move
: Number of slides to move when using arrows. Default: 1
.
slider_autow
: Default: false
.
slider_focus
: Accepts: (int)|'center'
. Default: 'center'
.
slider_arrows
: Default: true
.
slider_height
: Assign the height of each slide.
slider_pause
: Pause the slider on mouse hover. Default: false
.
slider_speed
: Default: '2'
.
slider_autoplay
: Default: false
.
slider_interval
: Default: 4000
.
slider_autoscroll
: Default: false
.
slider_break
: Default: {1400:{perPage:2},1100:{perPage:1}}
. Note: If you use the shortcode in PHP, you need to escape the quotes. slider_break=\'{"1920":{"perPage":1}}\'
.
slider_thumbs
: Show thumbnails below the slider. Default: false
.
slider_progress
: Show progress bar below the slider. Default: false
.
You can also use these hooks:
fetcher_before_image
fetcher_image
fetcher_after_image
fetcher_title
fetcher_after_title
Here is an example that will run only on sliders with a specific ID:
add_action('fetcher_after_image', function($item, $id = null) {
if ($id !== 'fetcher-id') { return; }
if (!empty($item->ID)) {
echo '<div class="post-date">Posted on: ' . esc_html(get_the_date('', $item->ID)) . '</div>';
}
}, 10, 2);
Example
fetcher content="post" post_type="example" taxonomy="example_cat" ppp="9" slider_arrows="false" slider_progress="true" parent_class="x-6 m0a df gtr fww" child_class="x-2 df x-fd" hide_image="true" slider_pp="3" layout="slider"]