Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- remove_action( 'genesis_post_content', 'custom_excerpt' );
- add_action( 'genesis_post_content', 'custom_excerpt' );
- function custom_excerpt() {
- // Return if CPT Hotels
- if ( is_post_type_archive( 'hotels' ) )
- // Store the address data
- $address_data = array(
- 'address_1' => get_field( 'Address_1' ),
- 'address_2' => get_field( 'street_address_2' ),
- 'po_box' => get_field( 'po_box' ),
- 'city' => get_field( 'city' ),
- 'state' => get_field( 'state' ),
- 'zip' => get_field( 'zip' ),
- );
- if ( '' != $address_data ) {
- $address_data = strip_shortcodes( $text );
- $address_data = apply_filters('the_content', $text);
- $allowed_tags = '<p>,<a>,<em>,<strong>,<img>';
- $address_data = strip_tags($text, $allowed_tags);
- $address_data = str_replace(']]>', ']]>', $text);
- $excerpt_length = 40; // 20 words
- $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
- $address_data = wp_trim_words( $text, $excerpt_length, $excerpt_more );
- }
- return apply_filters('the_excerpt', $text);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement