Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Set Up Intro Box
- * @link http://www.therivercentre.org
- * @author Bill Erickson
- *
- */
- add_action('genesis_before_content', 'be_intro_box');
- function be_intro_box() {
- if(is_page() && !is_front_page()):
- global $post;
- // Get the custom fields for the intro box line one and two
- $intro_text_line_1 = get_custom_field('_river_intro_text', $post->ID);
- $intro_text_line_2 = get_custom_field('_river_intro_text_2', $post->ID);
- if (!$intro_text_line_1 && !$intro_text_line_2):
- // If the intro box lines are empty, get them from the parent page
- $intro_text_line_1 = get_custom_field('_river_intro_text', $post->post_parent);
- $intro_text_line_2 = get_custom_field('_river_intro_text_2', $post->post_parent);
- endif;
- // Get the post thumbnail
- $image = get_the_post_thumbnail($post->ID, 'river_top');
- // If no post thumbnail, get from the parent
- if (!$image) $image = get_the_post_thumbnail($post->post_parent, 'river_top');
- // If we have an image and intro text, display it
- if ($image && $intro_text_line_1):
- echo '<div class="intro-box clearfix">';
- if (!$intro_text_line_2) {
- echo '<div class="intro-text custom-background"><span>'. $intro_text_line_1. '</span></div>';
- } else {
- echo '<div class="intro-text custom-background"><span><strong>'. $intro_text_line_1. '</strong><br />'.$intro_text_line_2.'</span></div>';
- }
- echo '<div class="intro-image">'. $image . '</div>';
- echo '</div>';
- endif;
- endif;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement