Below, you’ll find a detailed guide on how to add the Futurio Extra Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Futurio Extra Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the Futurio Extra Plugin and the shortcodes it provides:
"Futurio Extra is an essential plugin for enhancing your WordPress experience. It offers additional features for customization, enabling you to create a unique and dynamic website."
- [futurio_extra]
- [futurio-posts]
Futurio Extra [futurio_extra] Shortcode
The Futurio-Extra plugin shortcode is a powerful tool that enables the display of Elementor-designed content. This shortcode checks if Elementor plugin exists. If it does and an ‘id’ attribute is provided, it fetches and displays the corresponding Elementor content.
Shortcode: [futurio_extra]
Parameters
Here is a list of all possible futurio_extra shortcode parameters and attributes:
id
– Identifier for the specific Elementor page builder content
Examples and Usage
Basic example – The shortcode is used to display the content of a specific Elementor template by referencing its ID.
[futurio-extra id=1 /]
PHP Function Code
In case you have difficulties debugging what causing issues with [futurio_extra]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode(self::SHORTCODE, [$this, 'shortcode']);
Shortcode PHP function:
function shortcode($attributes = []) {
if (!class_exists('Elementor\Plugin')) {
return '';
}
if (empty($attributes['id'])) {
return '';
}
$response = Plugin::instance()->frontend->get_builder_content_for_display($attributes['id']);
return $response;
}
Code file location:
futurio-extra/futurio-extra/inc/elementor/shortcode.php
Futurio Extra [futurio-posts] Shortcode
The Futurio Extra plugin shortcode, ‘futurio-posts’, displays a carousel of posts. It allows customization of the text color, number of columns, post limit, and category. The PHP function ‘futurio_extra_posts_carousel_shortcode’ extracts these attributes and queries the database to fetch the posts. The posts are then displayed in a grid format, with each post enclosed in an article tag, complete with a title and excerpt. The function also ensures that the posts displayed are not sticky posts. The shortcode is highly versatile, offering a visually appealing way to showcase your posts.
Shortcode: [futurio-posts]
Parameters
Here is a list of all possible futurio-posts shortcode parameters and attributes:
text_color
– sets the color of the text in the posts.columns
– determines the number of columns for displaying posts.limit
– sets the maximum number of posts to be displayed.category
– selects posts from a specific category by ID.
Examples and Usage
Basic Example – The following shortcode displays posts in a carousel format, using the default settings of the Futurio Extra plugin. The default settings include a limit of 6 posts, shown in 3 columns.
[futurio-posts]
Advanced Examples
Displaying posts from a specific category. In this example, the shortcode will display posts from category with ID 5.
[futurio-posts category="5"]
Changing the number of posts displayed and the number of columns. In this example, the shortcode will display 4 posts in 2 columns.
[futurio-posts limit="4" columns="2"]
Combining multiple parameters. In this example, the shortcode will display 8 posts from category with ID 7 in 4 columns and with a custom text color.
[futurio-posts limit="8" columns="4" category="7" text_color="#123456"]
PHP Function Code
In case you have difficulties debugging what causing issues with [futurio-posts]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'futurio-posts', 'futurio_extra_posts_carousel_shortcode' );
Shortcode PHP function:
function futurio_extra_posts_carousel_shortcode( $atts, $content = null ) {
STATIC $i = 1;
extract( shortcode_atts( array(
'text_color' => '', // Theme default
'columns' => '3', // 3* / 2 / 3 / 4 / 5
'limit' => '6', // *6
'category' => '', // Category ID
), $atts, 'futurio-posts' ) );
$category = explode( ',', $category );
if ( empty( $category ) ) {
return;
}
$columns = 12 / $columns;
// setup query
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$post_args = array(
'posts_per_page' => $limit,
'cat' => $category,
'ignore_sticky_posts' => 1,
'paged' => $paged,
);
// query database
$post = new WP_Query( $post_args );
ob_start();
?>
<div id="f-posts-shortcode-<?php echo absint( $i ); ?>" class="f-posts-shortcode" >
<?php if ( $post->have_posts() ) : ?>
<div class="row" >
<?php while ( $post->have_posts() ) : ?>
<?php $post->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'col-md-' . absint( $columns ) ); ?>>
<div class="news-item text-center">
<?php futurio_thumb_img( 'futurio-med' ); ?>
<div class="news-text-wrap">
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark" style="color: ' . esc_attr( $text_color ) . '">', '</a></h2>' ); ?>
<div class="f-line"></div>
<div class="post-excerpt" style="color: <?php echo esc_attr( $text_color ) ?>">
<?php the_excerpt(); ?>
</div><!-- .post-excerpt -->
</div><!-- .news-text-wrap -->
</div><!-- .news-item -->
</article>
<?php endwhile; ?>
</div><!-- .row -->
<?php endif; ?>
</div>
<?php
wp_reset_postdata();
$i++;
return ob_get_clean();
}
Code file location:
futurio-extra/futurio-extra/inc/shortcodes/shortcodes.php
Conclusion
Now that you’ve learned how to embed the Futurio Extra Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply