No results found. Try again with different words?
Search must be at least 3 characters.
- Section
- Troubleshooting – Icons missing from the blocks
- Spectra Patterns
- How to Set Multiple Column Fields in Contact Form 7 Styler of Spectra?
- Styling Checkbox / Radio / Acceptance control in Contact Form 7 Designer block of Spectra
- Unable to Style Checkbox / Radio Buttons / Acceptance Control using Contact Form 7 Styler of Spectra
- Tab Index – for multiple Gravity Forms
- How to Get Started with Spectra
- How to Exclude A Heading from Table of Contents?
- Spectra – Display Conditions for Blocks
- Installing and Importing Starter Templates
- How to Get Started with Spectra
- Manually Install Spectra via FTP
- Automatic Beta Updates for Spectra
- How to Rollback to Previous Spectra Versions
- How to Load Google Fonts Locally
- Activate the Spectra Pro License Key
- How to Install Spectra Pro Plugin
- Translate Spectra Strings using Loco Translate
- How to add a Transparent / Sticky header?
- How to Change the Site Logo?
- How to Change Global Styles?
- How to Disable Title on Posts, Pages?
- How to add a transparent/ sticky header for a single page/post?
- Change Header and Footer Patterns in Spectra One Theme
- Add Custom/Google Fonts In Spectra One
- How to reset global default styling?
- Manually Install Spectra One via FTP?
- Disable or Enable Header/Footer for Specific Pages/Posts
Filters/Actions for Post
Actions/Filters available for Posts Block are listed below.
The parameters used in the below actions/filters are one of the below-listed options. The detailed description of these parameters is as specified below.
$attributes
: This is the entire setting array for the particular dragged dropped Post Block. One can add conditional logic as per the selected options in the settings.$post_id
: This is the single post ID in the loop. This is useful when one wants to fetch post specific data and display it.- POST_BLOCK_TYPE : This is the type of Post Block you are using – grid/masonry/carousel
uagb_post_query_args_{POST_BLOCK_TYPE}
This filter modifies the Query Arguments for Post Grid, Post Masonry, Post Carousel, Post Timeline, etc.
function filter_post_query( $query_args, $attributes) {
// Modify $query_args values.
// Ex.
$query_args['ignore_sticky_posts'] = 0;
return $query_args;
}
add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
uagb_enable_post_class
This filter enables the `post_class()` compatibility to the respective Post Grid, Masonry, Carousel block.
add_filter( 'uagb_enable_post_class', '__return_true' );
uagb_post_before_article_{POST_BLOCK_TYPE}
Fires at the beginning of the single post article tag
function single_post_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post wrap. </div>';
}
add_action( 'uagb_post_before_article_grid', 'single_post_before', 10, 2 );
uagb_post_after_article_{POST_BLOCK_TYPE}
Fires at the end of the single post article tag
function single_post_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post wrap. </div>';
}
add_action( 'uagb_post_after_article_grid', 'single_post_after', 10, 2 );
uagb_post_before_inner_wrap_{POST_BLOCK_TYPE}
Fires at the beginning of the single post inner wrap
function single_post_inner_wrap_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post inner wrap. </div>';
}
add_action( 'uagb_post_before_inner_wrap_grid', 'single_post_inner_wrap_before', 10, 2 );
uagb_post_after_inner_wrap_{POST_BLOCK_TYPE}
Fires at the end of the single post inner wrap
function single_post_inner_wrap_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post inner wrap. </div>';
}
add_action( 'uagb_post_after_inner_wrap_grid', 'single_post_inner_wrap_after', 10, 2 );
uagb_single_post_before_featured_image_{POST_BLOCK_TYPE}
Fires at the beginning of the single post featured image
function single_post_featured_image_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post featured image. </div>';
}
add_action( 'uagb_single_post_before_featured_image_grid', 'single_post_featured_image_before', 10, 2 );
uagb_single_post_after_featured_image_{POST_BLOCK_TYPE}
Fires at the end of the single post featured image
function single_post_featured_image_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post featured image. </div>';
}
add_action( 'uagb_single_post_after_featured_image_grid', 'single_post_featured_image_after', 10, 2 );
uagb_single_post_before_title_{POST_BLOCK_TYPE}
Fires at the beginning of the single post title
function single_post_title_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post title. </div>';
}
add_action( 'uagb_single_post_before_title_grid', 'single_post_title_before', 10, 2 );
uagb_single_post_after_title_{POST_BLOCK_TYPE}
Fires at the end of the single post title
function single_post_title_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post title. </div>';
}
add_action( 'uagb_single_post_after_title_grid', 'single_post_title_after', 10, 2 );
uagb_single_post_before_meta_{POST_BLOCK_TYPE}
Fires at the beginning of the single post meta
function single_post_meta_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post meta. </div>';
}
add_action( 'uagb_single_post_before_meta_grid', 'single_post_meta_before', 10, 2 );
uagb_single_post_after_meta_{POST_BLOCK_TYPE}
Fires at the end of the single post meta
function single_post_meta_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post meta. </div>';
}
add_action( 'uagb_single_post_after_meta_grid', 'single_post_meta_after', 10, 2 );
uagb_single_post_before_excerpt_{POST_BLOCK_TYPE}
Fires at the beginning of the single post excerpt
function single_post_excerpt_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post excerpt. </div>';
}
add_action( 'uagb_single_post_before_excerpt_grid', 'single_post_excerpt_before', 10, 2 );
uagb_single_post_after_excerpt_{POST_BLOCK_TYPE}
Fires at the end of the single post excerpt
function single_post_excerpt_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post excerpt. </div>';
}
add_action( 'uagb_single_post_after_excerpt_grid', 'single_post_excerpt_after', 10, 2 );
uagb_single_post_excerpt_{POST_BLOCK_TYPE}
This filter is used to allow customization in post excerpt (i.e. to display video/images/links) for the Post Grid, Post Masonry, Post Carousel, Post Timeline, etc. Below is the example for “Post Grid”:
add_filter('uagb_single_post_excerpt_grid', function($excerpt, $id, $attr) { return custom_post_content(30); },10, 3 );
function custom_post_content($limit) {
global $post;
$content = explode(' ', the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content);
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\\[.+\\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
uagb_single_post_before_cta_{POST_BLOCK_TYPE}
Fires at the beginning of the single post cta
function single_post_cta_before( $post_id, $attributes ) {
echo '<div> I am at the beginning of the single post cta. </div>';
}
add_action( 'uagb_single_post_before_cta_grid', 'single_post_cta_before', 10, 2 );
uagb_single_post_after_cta_{POST_BLOCK_TYPE}
Fires at the end of the single post cta
function single_post_cta_after( $post_id, $attributes ) {
echo '<div> I am at the end of the single post cta. </div>';
}
add_action( 'uagb_single_post_after_cta_grid', 'single_post_cta_after', 10, 2 );
We don't respond to the article feedback, we use it to improve our support content.