Here you can find a list of arguments that can be passed onto the wpex_card function when displaying theme cards in custom loops or when creating custom cards.
Parameters List
Parameter | Type | Description |
---|---|---|
style | string | Your card style. |
post_id | int | The post being displayed. |
allowed_media | array | List of allowed media: thumbnail, video, audio, gallery. |
thumbnail_id | int | The post thumbnail ID to use for the get_thumbnail method. |
thumbnail_size | string/array | Accepts any registered image size name, or an array of width, height, crop values in pixels (in that order). |
thumbnail_filter | string | Image filter (grayscale, sepia, contrast-150, saturate-2) |
thumbnail_hover | string | Image hover (opacity,opacity-invert, shrink, grow, side-pan, vertical-pan, tilt, blurr, blurr-invert, sepia, fade-out, fade-in, grayscale, grascale-invert). |
thumbnail_overlay_style | string | Overlay style name @see wpex_overlay_styles_array() at Total/framework/functions/overlays. |
title_tag | string | HTML tag used for the title (h2, h3. h4, h5, h6, div, span). |
excerpt_length | int | Excerpt length in words. |
excerpt | string | Custom excerpt output if not wanting to use the themes excerpt function. |
more_link_text | string | Text used for any “more” links. |
more_link_aria_label | string | Text used for any “more” link aria-label attribute. |
date | string | Custom date output. |
author | string | Custom author name output. |
icon | html | Custom Icon to be used for Icon style cards. |
avatar | html | Custom author avatar output |
rating | html | Custom rating output. |
is_on_sale | html | Custom onsale output. |
price | html | Custom price output. |
css_animation | string | WPBakery CSS animation classname. |
el_class | string | Any custom classes to add to the card output. |
featured | boolean | Is this a featured card? |
breakpoint | string | Used for cards that have different mobile looks (such cards that go from left/right to top/bottom) – use the theme’s utility breakpoints (sm, md, lg, xl) |
modal_content | html | Custom output for popup link modal windows. |
modal_title | string | Custom test for the popup link modal window title. |
url | string | The URL to be used for the card links. |
link_type | string | Link type for the card. |
link_title | string | Link title attribute value. |
link_target | string | Link target attribute value. |
link_rel | string | Link rel attribute value. |
link_data | string/array | Link data attributes |
lightbox_url | string | Custom URL to use for the card. |
lightbox_type | string | Lightbox type (video, gallery, thumbnail, modal). |
post_video | string | Post video oEmbed URL. |
Sample Usage
These arguments can be passed to the card function like such:
// Query posts.
$args = array();
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
// Card arguments.
$card_args = array(
'style' => 'blog_1',
'post_id' => get_the_ID(),
);
// Display post card.
wpex_card( $card_args );
}
echo '</ul>';
} else {
// no posts found
}
The example shows how you would pass your arguments to the wpex_card function when used inside a custom loop. You can also define arguments at the top of a custom card design so that they will apply in all loops like such:
// Define custom args.
$args['thumbnail_size'] = array( '400', '500', true );
// Card output.
$output = '';
$output .= $this->get_media( array(
'class' => 'wpex-mb-20',
) );
$output .= $this->get_title( array(
'class' => 'wpex-heading wpex-text-lg wpex-mb-10',
) );
return $output;
When defining arguments in your card output it will override any theme settings. So for example, if you define a thumbnail_size in your card you won't be able to alter the thumbnail size when using the Post Cards module because you've hard-coded it.