'. sprintf(__("Posted on %s at %s.", 'planet-foundation'), get_the_time('l, F jS, Y'), get_the_time()) .''; } else { $html = ''; } } else if ( $format == 'short' ) { if ( $prefix == 'Posted on' ) { $html = ''; } else { $html = ''; } } return $html; } /** * Returns HTML properly structured so it can be recognized as an author by Google * * @since Planet Foundation 1.0.0 * * @param string $prefix String to prefix to author info, default is 'Written by' * @param string $format 'short' is abbreviated for excerpts, otherwise a long version with pic and bio * * @return string HTML */ function pf_get_the_author( $prefix='Written by', $format='short' ) { $first_name= get_the_author_meta('first_name');; $last_name= get_the_author_meta('last_name');; $google_plus = get_the_author_meta('googleplus'); $bio = get_the_author_meta('description'); $email = get_the_author_meta('user_email'); $id = get_the_author_meta( 'ID' ); $avatar = get_avatar( $email ); // formulate name $name="$first_name $last_name"; if ( $name == ' ' ) $name = get_the_author(); $author_url = get_author_posts_url( $id ); if ( ! $google_plus ) { $google_plus_url = "$author_url?rel=author"; } else $google_plus_url = "$google_plus?rel=author"; if ( $format == 'short' ) { if ( $prefix == "Written by" ) { return '' . sprintf( __( 'View other Posts by %s', 'planet-foundation'), $first_name ) . ''; } $html = '
'; } else { return ' '; } } else { $link_to_posts = ''; if ( $format == 'bio_w_posts') { $link_to_posts = ' '; return $html; } } /** * Retrieves html for header image * * Looks for the wpcf-header-image type on the post or page first. * This custom type will allow authors to specify a header image * to go with the post or page. * * If custom type is not found, returns header image specified as part * of the theme options. * * If header not specified as part of them options, return null * * Will return html for a Foundation orbit slideshow on home page * if such a slideshow is specified in the theme customizer. * * @since Planet Foundation 1.0.0 * * @see http://codex.wordpress.org/Function_Reference/wp_make_link_relative wp_make_link_relative() * @see http://codex.wordpress.org/Function_Reference/get_post get_post() * @see http://codex.wordpress.org/Function_Reference/get_post_meta get_post_meta() * @see http://codex.wordpress.org/Function_Reference/get_header_image get_header_image() * * @uses pf_get_the_slideshow() To get the slideshow if configured * * * @return null|string Null if no header is found. html if header is found. * */ function pf_get_the_header() { $header_src = ''; if ( is_front_page() && ( $html = pf_get_the_slideshow() ) ) return $html; if ( have_posts() ) { global $wp_query; if ( $wp_query->found_posts == 1 ) { // First lets try to find a header that is specified in // the post or page itself using the _pf_meta_header_image type while ( have_posts() ) { the_post(); $post_id = get_the_ID(); $header_src_array = get_post_meta( $post_id, "_pf_meta_header_image" ); if ( $header_src_array ) { global $wpdb; global $pf_metabox_header_image; $meta = $pf_metabox_header_image->the_meta(); $header_src = $meta['imgurl']; $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$header_src'"; $attachment_id = $wpdb->get_var($query); $attachment = get_post( $attachment_id ); $header_src = wp_make_link_relative( $header_src ); $header_alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $header_title = $attachment->post_excerpt; } } rewind_posts(); } } if ( ! $header_src ) { global $wpdb; // If we did't fine a header above, use the one specified // in the theme options if ( $header_src = get_header_image() ) { // we want the all the attributes $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$header_src'"; $attachment_id = $wpdb->get_var($query); $attachment = get_post( $attachment_id ); $header_src = wp_make_link_relative( $header_src ); $header_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); $header_title = $attachment->post_excerpt; } } if ( $header_src ) { $html = ''; } else $html = ''; return $html; } /** * Retrieves the url for the header image if there is one specified * * First looks for slideshow slide, then page/post header, then default. * Returns null if none are found * * @return Url of header image * */ function pf_get_header_url() { $header_src = null; if ( have_posts() ) { global $wp_query; if ( $wp_query->found_posts == 1 ) { // First lets try to find a header that is specified in // the post or page itself using the _pf_meta_header_image type while ( have_posts() ) { the_post(); $post_id = get_the_ID(); $header_src_array = get_post_meta( $post_id, "_pf_meta_header_image" ); if ( $header_src_array ) { global $pf_metabox_header_image; $meta = $pf_metabox_header_image->the_meta(); $header_src = $meta['imgurl']; $header_src = wp_make_link_relative( $header_src ); } } rewind_posts(); } } if ( ! $header_src ) { // header not found yet, try the first slide of the slideshow $header_src = get_theme_mod( 'pf_slide_1' ); } if ( ! $header_src ) { // If we did't fine a header above, use the one specified // in the theme options if ( $header_src = get_header_image() ) { $header_src = wp_make_link_relative( $header_src ); } } return $header_src; } /** * Retrieves html for a slideshow designed to be used on a page header * * Will examine the parameters specified in the theme customize section Slideshow. * Returns html that is recognized by Zurb's Foundation Orbit javascript module. * * Will return null if no slides are found or slideshow is turned off. * * Child themes may completely override this using the filter pf_get_the_slideshow_override * or modify the returned html using pf_get_the_slideshow_filter * * @since Planet Foundation 1.0.0 * * @see http://codex.wordpress.org/Function_Reference/get_theme_mod get_theme_mod() * @see http://codex.wordpress.org/Function_Reference/apply_filters apply_filters() * * @link http://codex.wordpress.org/Function_Reference/add_filter add_filter() * * @return null|string Null if slideshow not configured. html if slideshow is turned on and slides specified. */ function pf_get_the_slideshow() { if ( ! ($effect = get_theme_mod ( 'pf_slideshow_effect' ) ) ) return null; else if ( $effect == 'none' ) { return null; } $slide = get_theme_mod( 'pf_slide_1' ); if ( ! $slide ) return null; // allow a child theme author to override this function if they have their own slideshow $html = apply_filters('pf_get_the_slideshow_override', null); if ( $html ) return $html; $slide_link = get_theme_mod( 'pf_slide_link_1' ); if ( $effect == 'normal' ) { if ( ! ($timer_speed = get_theme_mod ( 'pf_timer_speed' ) ) ) $timer_speed = 3000; if ( ! ($animation_speed = get_theme_mod ( 'pf_transition_speed' ) ) ) $animation_speed = 1500; /* !! Note that this is not controlled here anymore. We must control this with css. Will add an action to wp_head for this */ if ( ! ($pause_on_hover = get_theme_mod ( 'pf_pause_on_hover' ) ) ) $pause_on_hover = 'false'; else $pause_on_hover = 'true'; if ( ! ($navigation_arrows = get_theme_mod ( 'pf_navigation_arrows' ) ) ) $navigation_arrows = 'false'; else $navigation_arrows = 'true'; if ( ! ($slide_number = get_theme_mod ( 'pf_slide_number' ) ) ) $slide_number = 'false'; else $slide_number = 'true'; if ( ! ($animation = get_theme_mod ( 'pf_animation' ) ) ) $animation = 'animation:\'fade\';'; else if ( $animation == 'slide' ) $animation = ''; else $animation = 'animation:fade;'; $html = ''; $html = $html . ' '; } else if ( $effect == 'kenburns' ) { $html = $html . '