Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // We want to add a new value for %%short_excerpt%%
- add_filter( 'idx_plus_data_short_excerpt', 'add_short_excerpt_data_to_idx_plus', 10, 2 );
- /**
- * Modify the data output
- *
- * @param mixed $data Data to return
- * @param string|null $key Data key, if set
- */
- function add_short_excerpt_data_to_idx_plus( $return, $key ) {
- // Then get the excerpt
- if( $excerpt = IDX_Plus::get_data('excerpt') ) {
- // Shorten it for the return value
- $return = wp_trim_words( $excerpt, 10);
- }
- return $return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement