fastfood_get_js_modules(), 'post_expander_wait' => __( 'Post loading, please wait...', 'fastfood' ), 'quote_link_info' => esc_attr( __( 'Add selected text as a quote', 'fastfood' ) ), 'quote_link_alert' => __( 'Nothing to quote. First of all you should select some text...', 'fastfood' ) ); wp_localize_script( 'fastfood-script', 'fastfood_l10n', $data ); } } } // add a js-selecting class if ( !function_exists( 'fastfood_body_class_script' ) ) { function fastfood_body_class_script(){ ?> 1) { if ((number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1)) == 1.3 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.5 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.6 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 2.5){ $imgmeta['image_meta']['shutter_speed'] = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1, '.', ''); } else { $imgmeta['image_meta']['shutter_speed'] = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 0, '.', ''); } } $output = ''; // get other EXIF and IPTC data of digital photograph $output .= __("Width", "fastfood" ) . ": " . $imgmeta['width']."px
"; $output .= __("Height", "fastfood" ) . ": " . $imgmeta['height']."px
"; if ( $imgmeta['image_meta']['created_timestamp'] ) $output .= __("Date Taken", "fastfood" ) . ": " . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."
"; if ( $imgmeta['image_meta']['copyright'] ) $output .= __("Copyright", "fastfood" ) . ": " . $imgmeta['image_meta']['copyright']."
"; if ( $imgmeta['image_meta']['credit'] ) $output .= __("Credit", "fastfood" ) . ": " . $imgmeta['image_meta']['credit']."
"; if ( $imgmeta['image_meta']['title'] ) $output .= __("Title", "fastfood" ) . ": " . $imgmeta['image_meta']['title']."
"; if ( $imgmeta['image_meta']['caption'] ) $output .= __("Caption", "fastfood" ) . ": " . $imgmeta['image_meta']['caption']."
"; if ( $imgmeta['image_meta']['camera'] ) $output .= __("Camera", "fastfood" ) . ": " . $imgmeta['image_meta']['camera']."
"; if ( $imgmeta['image_meta']['focal_length'] ) $output .= __("Focal Length", "fastfood" ) . ": " . $imgmeta['image_meta']['focal_length']."mm
"; if ( $imgmeta['image_meta']['aperture'] ) $output .= __("Aperture", "fastfood" ) . ": f/" . $imgmeta['image_meta']['aperture']."
"; if ( $imgmeta['image_meta']['iso'] ) $output .= __("ISO", "fastfood" ) . ": " . $imgmeta['image_meta']['iso']."
"; if ( $imgmeta['image_meta']['shutter_speed'] ) $output .= __("Shutter Speed", "fastfood" ) . ": " . sprintf( '%s seconds', $imgmeta['image_meta']['shutter_speed']) . "
" ?>
1, 'date' => 1, 'tags' => 1, 'categories' => 1, 'avatar_size' => 48, 'featured' => 0, 'echo' => 1, ); $args = wp_parse_args( $args, $defaults ); $tax_separator = apply_filters( 'fastfood_filter_taxomony_separator', ', ' ); $output = ''; if ( $args['featured'] && has_post_thumbnail( $post->ID ) ) $output .= '
' . get_the_post_thumbnail( $post->ID, 'thumbnail') . '
'; if ( $args['author'] ) $output .= fastfood_author_badge( $post->post_author, $args['avatar_size'] ); if ( $args['categories'] ) $output .= '
' . __( 'Categories', 'fastfood' ) . ': ' . get_the_category_list( $tax_separator ) . '
'; if ( $args['tags'] ) $tags = get_the_tags() ? get_the_tag_list( '', $tax_separator, '' ) : __( 'No Tags', 'fastfood' ) . ''; $output .= '
' . __( 'Tags', 'fastfood' ) . ': ' . $tags . '
'; if ( $args['date'] ) $output .= '
' . __( 'Published on', 'fastfood' ) . ': ' . get_the_time( get_option( 'date_format' ) ) . '
'; if ( ! $args['echo'] ) return $output; echo $output; } } // get the author badge function fastfood_author_badge( $author = '', $size = 48 ) { global $authordata; $author = ( ( ! $author ) && isset( $authordata->ID ) ) ? $authordata->ID : $author; $name = get_the_author_meta( 'nickname', $author ); // nickname $avatar = get_avatar( get_the_author_meta( 'email', $author ), $size, 'Gravatar Logo', get_the_author_meta( 'user_nicename', $author ) . '-photo' ); // gravatar $description = get_the_author_meta( 'description', $author ); // bio $author_link = get_author_posts_url($author); // link to author posts $author_net = ''; // author social networks foreach ( array( 'twitter' => 'Twitter', 'facebook' => 'Facebook', 'googleplus' => 'Google+', 'url' => 'web' ) as $s_key => $s_name ) { if ( get_the_author_meta( $s_key, $author ) ) $author_net .= '' . $s_key . ''; } $output = '
  • ' . $avatar . '
  • '; $output .= '
  • ' . $name . '
  • '; $output .= $description ? '
  • ' . $description . '
  • ' : ''; $output .= $author_net ? '
  • ' . $author_net . '
  • ' : ''; $output = '
    '; return apply_filters( 'fastfood_filter_author_badge', $output ); } //get a thumb for a post/page if ( !function_exists( 'fastfood_get_the_thumb_url' ) ) { function fastfood_get_the_thumb_url( $post_id = 0 ){ global $post; if ( !$post_id ) $post_id = $post->ID; // has featured image if ( get_post_thumbnail_id( $post_id ) ) return wp_get_attachment_thumb_url( get_post_thumbnail_id( $post_id ) ); $attachments = get_children( array( 'post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 1, ) ); //has attachments if ( $attachments ) return wp_get_attachment_thumb_url( key($attachments) ); //has an hardcoded if ( $img = fastfood_get_first_image() ) return $img['src']; //has a generated if ( $img = fastfood_get_first_image( false, true) ) return $img['src']; if ( $img = get_header_image() ) return $img; //nothing found return ''; } } //add share links to post/page if ( !function_exists( 'fastfood_share_this' ) ) { function fastfood_share_this( $args = '' ){ $defaults = array( 'size' => 24, 'echo' => true, 'compact' => false, 'split' => 0, 'id' => 0, 'title' => false, 'href' => false, 'href_short' => false, 'thumb' => false, 'source' => false, 'summary' => false, 'twitter' => 1, 'facebook' => 1, 'googleplus' => 1, 'sina' => 1, 'tencent' => 1, 'qzone' => 1, 'reddit' => 1, 'stumbleupon' => 1, 'digg' => 1, 'orkut' => 1, 'bookmarks' => 1, 'blogger' => 1, 'delicious' => 1, 'linkedin' => 1, 'tumblr' => 1, 'mail' => 1, ); $args = wp_parse_args( $args, $defaults ); $post = get_post( $args['id'] ); $enc_title = $args['title'] ? $args['title'] : rawurlencode( get_the_title( $post->ID ) ); $enc_href = $args['href'] ? $args['href'] : rawurlencode( get_permalink( $post->ID ) ); $enc_href_short = $args['href_short'] ? $args['href_short'] : rawurlencode( home_url() . '/?p=' . $post->ID ); $enc_thumb = $args['thumb'] ? $args['thumb'] : rawurlencode( fastfood_get_the_thumb_url( $post->ID ) ); $enc_source = $args['source'] ? $args['source'] : rawurlencode( get_bloginfo( 'name' ) ); if ( $args['summary'] ) $enc_summary = $args['summary']; elseif ( !empty( $post->post_password ) ) $enc_summary = ''; elseif ( has_excerpt() ) $enc_summary = rawurlencode( get_the_excerpt() ); else $enc_summary = rawurlencode( wp_trim_words( $post->post_content, apply_filters('excerpt_length', 55), '[...]' ) ); $share['twitter'] = array( 'Twitter', 'http://twitter.com/home?status=' . $enc_title . '%20-%20' . $enc_href_short ); $share['facebook'] = array( 'Facebook', 'http://www.facebook.com/sharer.php?u=' . $enc_href_short. '&t=' . $enc_title ); $share['googleplus'] = array( 'Google+', 'https://plus.google.com/share?url=' . $enc_href_short ); $share['sina'] = array( 'Weibo', 'http://v.t.sina.com.cn/share/share.php?url=' . $enc_href_short ); $share['tencent'] = array( 'Tencent', 'http://v.t.qq.com/share/share.php?url=' . $enc_href_short . '&title=' . $enc_title . '&pic=' . $enc_thumb ); $share['qzone'] = array( 'Qzone', 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' . $enc_href_short ); $share['reddit'] = array( 'Reddit', 'http://reddit.com/submit?url=' . $enc_href_short . '&title=' . $enc_title ); $share['stumbleupon'] = array( 'StumbleUpon', 'http://www.stumbleupon.com/submit?url=' . $enc_href_short . '&title=' . $enc_title ); $share['digg'] = array( 'Digg', 'http://digg.com/submit?url=' . $enc_href_short . '&title=' . $enc_title ); $share['orkut'] = array( 'Orkut', 'http://promote.orkut.com/preview?nt=orkut.com&tt=' . $enc_title . '&du=' . $enc_href_short . '&tn=' . $enc_thumb ); $share['bookmarks'] = array( 'Bookmarks', 'https://www.google.com/bookmarks/mark?op=edit&bkmk=' . $enc_href_short . '&title=' . $enc_title . '&annotation=' . $enc_summary ); $share['blogger'] = array( 'Blogger', 'http://www.blogger.com/blog_this.pyra?t&u=' . $enc_href_short . '&n=' . $enc_title . '&pli=1' ); $share['delicious'] = array( 'Delicious', 'http://delicious.com/post?url=' . $enc_href_short . '&title=' . $enc_title . '¬es=' . $enc_summary ); $share['linkedin'] = array( 'LinkedIn', 'http://www.linkedin.com/shareArticle?mini=true&url=' . $enc_href_short . '&title=' . $enc_title . '&source=' . $enc_source . '&summary=' . $enc_summary ); $share['tumblr'] = array( 'Tumblr', 'http://www.tumblr.com/share?v=3&u=' . $enc_href_short . '&t=' . $enc_title . '&s=' . $enc_summary ); $share['mail'] = array( 'e-mail', 'mailto:?subject=' . rawurlencode ( __( 'Check it out!', 'fastfood' ) ) . '&body=' . $enc_title . '%20-%20' . $enc_href . '%0D%0A' . $enc_summary ); $share = apply_filters( 'fastfood_filter_share_this', $share ); $output = ''; $counter = 0; $splitter = false; foreach( $share as $key => $btn ){ if ( $args[$key] ) if ( $args['split'] && $args['split'] == $counter ) $output .= $splitter = '
    +
    '; $counter++; $target = ( $key != 'mail' ) ? ' target="_blank"' : ''; $output .= ''; } if ( $splitter ) $output .= '
    '; if ( $args['echo'] ) echo $output; else return $output; } } // display the main menu function fastfood_main_menu () { if ( fastfood_get_opt('fastfood_primary_menu' ) ) { ?>
    false, 'menu_id' => 'mainmenu', 'menu_class' => 'nav-menu', 'fallback_cb' => 'fastfood_pages_menu', 'theme_location' => 'primary', ) ); ?>
    'undefined', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ( $args['theme_location'] === 'primary' ) && ( 'posts' == get_option( 'show_on_front' ) ) ) { if ( is_front_page() || is_single() ) $class = ' current_page_item'; else $class = ''; $homeMenuItem = ''; $items = $homeMenuItem . $items; } return $items; } //display the footer content function fastfood_credits () { ?>
    © TwoBeers Crew', 'WordPress' ) ); echo '' . $output . ''; } ?>
    '', 'title' => '', 'src' => '' ); //search the images in post content preg_match_all( '/]+>/i',$filtered_content ? apply_filters( 'the_content', $post->post_content ): $post->post_content, $result ); //grab the first one if ( isset( $result[0][0] ) ){ $first_image['img'] = $result[0][0]; //get the title (if any) preg_match_all( '/(title)=(["|\'][^"|\']*["|\'])/i',$first_image['img'], $title ); if ( isset( $title[2][0] ) ){ $first_image['title'] = str_replace( '"','',$title[2][0] ); } //get the path preg_match_all( '/(src)=(["|\'][^"|\']*["|\'])/i',$first_image['img'], $src ); if ( isset( $src[2][0] ) ){ $first_image['src'] = str_replace( array( '"', '\''),'',$src[2][0] ); } return $first_image; } else { return false; } } } // Get first link of a post if ( !function_exists( 'fastfood_get_first_link' ) ) { function fastfood_get_first_link() { global $post; $first_link = array( 'anchor' => '', 'title' => '', 'href' => '', 'text' => '' ); //search the link in post content preg_match_all( "/]*>(.*?)<\/a>/i",$post->post_content, $result ); //grab the first one if ( isset( $result[0][0] ) ){ $first_link['anchor'] = $result[0][0]; $first_link['text'] = isset( $result[1][0] ) ? $result[1][0] : ''; //get the title (if any) preg_match_all( '/(title)=(["\'][^"]*["\'])/i',$first_link['anchor'], $title ); $first_link['title'] = isset( $title[2][0] ) ? str_replace( array('"','\''),'',$title[2][0] ) : ''; //get the path preg_match_all( '/(href)=(["\'][^"]*["\'])/i',$first_link['anchor'], $href ); $first_link['href'] = isset( $href[2][0] ) ? str_replace( array('"','\''),'',$href[2][0] ) : ''; return $first_link; } else { return false; } } } // Get first blockquote words if ( !function_exists( 'fastfood_get_blockquote' ) ) { function fastfood_get_blockquote() { global $post; $first_quote = array( 'quote' => '', 'cite' => '' ); //search the blockquote in post content preg_match_all( '/]*>([\w\W]*?)<\/blockquote>/',$post->post_content, $blockquote ); //grab the first one if ( isset( $blockquote[0][0] ) ){ $first_quote['quote'] = strip_tags( $blockquote[0][0] ); $words = explode( " ", $first_quote['quote'], 6 ); if ( count( $words ) == 6 ) $words[5] = '...'; $first_quote['quote'] = implode( ' ', $words ); preg_match_all( '/([\w\W]*?)<\/cite>/',$blockquote[0][0], $cite ); $first_quote['cite'] = ( isset( $cite[1][0] ) ) ? $cite[1][0] : ''; return $first_quote; } else { return false; } } } // Get first gallery if ( !function_exists( 'fastfood_get_gallery_shortcode' ) ) { function fastfood_get_gallery_shortcode() { global $post; $pattern = get_shortcode_regex(); if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( 'gallery', $matches[2] ) ) // gallery shortcode is being used { $key = array_search( 'gallery', $matches[2] ); $attrs = shortcode_parse_atts( $matches['3'][$key] ); return $attrs; } } } // run the gallery preview if ( !function_exists( 'fastfood_gallery_preview' ) ) { function fastfood_gallery_preview() { $attrs = fastfood_get_gallery_shortcode(); $attrs['preview'] = true; return fastfood_gallery_shortcode( '', $attrs ); } } // the gallery preview walker if ( !function_exists( 'fastfood_gallery_preview_walker' ) ) { function fastfood_gallery_preview_walker( $attachments = '', $id = 0 ) { if ( ! $id ) return false; if ( empty( $attachments ) ) $attachments = get_children( array( 'post_parent' => $id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); if ( empty( $attachments ) ) return false; $permalink = get_permalink( $id ); $images_count = count( $attachments ); $first_image = array_shift( $attachments ); $other_imgs = array_slice( $attachments, 0, 4 ); $output = '' . wp_get_attachment_image( $first_image->ID, 'medium' ) . ''; $output .= '
    '; foreach ($other_imgs as $image) { $output .= ' '; } $output .= '
    '; $output .= '

    ' . sprintf( _n( 'This gallery contains %2$s image', 'This gallery contains %2$s images', $images_count, 'fastfood' ), 'href="' . get_permalink() . '" title="' . esc_attr ( __( 'View gallery', 'fastfood' ) ) . '" rel="bookmark"', number_format_i18n( $images_count ) ) . '

    '; $output = apply_filters( 'fastfood_gallery_preview_walker', $output ); $output = ''; echo $output; return true; } } //Displays the amount of time since a post or page was written in a nice friendly manner. //Based on Plugin: Date in a nice tone (http://wordpress.org/extend/plugins/date-in-a-nice-tone/) function fastfood_friendly_date() { $postTime = get_the_time('U'); $currentTime = time(); $timeDifference = $currentTime - $postTime; $minInSecs = 60; $hourInSecs = 3600; $dayInSecs = 86400; $monthInSecs = $dayInSecs * 31; $yearInSecs = $dayInSecs * 366; //if over 2 years if ($timeDifference > ($yearInSecs * 2)) { $dateWithNiceTone = __( 'quite a long while ago...', 'fastfood' ); //if over a year } else if ($timeDifference > $yearInSecs) { $dateWithNiceTone = __( 'over a year ago', 'fastfood' ); //if over 2 months } else if ($timeDifference > ($monthInSecs * 2)) { $num = round($timeDifference / $monthInSecs); $dateWithNiceTone = sprintf(__('%s months ago', 'fastfood' ),$num); //if over a month } else if ($timeDifference > $monthInSecs) { $dateWithNiceTone = __( 'a month ago', 'fastfood' ); //if more than 2 days ago } else { $htd = human_time_diff( get_the_time('U'), current_time('timestamp') ); $dateWithNiceTone = sprintf(__('%s ago', 'fastfood' ), $htd ); } return apply_filters( 'fastfood_filter_friendly_date', $dateWithNiceTone ); } // page hierarchy if ( !function_exists( 'fastfood_multipages' ) ) { function fastfood_multipages( $r_pos ){ global $post; $args = array( 'post_type' => 'page', 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'numberposts' => 0, 'no_found_rows' => true, ); $childrens = get_posts( $args ); // retrieve the child pages $the_parent_page = $post->post_parent; // retrieve the parent page $has_herarchy = false; if ( ( $childrens ) || ( $the_parent_page ) ){ ?>
    ' . get_the_title( $the_parent_page ) . ''; echo __( 'Upper page: ', 'fastfood' ) . $the_parent_link ; // echoes the parent } if ( ( $childrens ) && ( $the_parent_page ) ) { echo ' - '; } // if parent & child, echoes the separator if ( $childrens ) { $the_child_list = ''; foreach ( $childrens as $children ) { $the_child_list[] = '' . get_the_title( $children ) . ''; } $the_child_list = implode( ', ' , $the_child_list ); echo __( 'Lower pages: ', 'fastfood' ) . $the_child_list; // echoes the childs } ?>
    '', 'size' => array( 40, 40 ), 'class' => '', 'default' => '', 'linked' => 0, ); $args = wp_parse_args( $args, $defaults ); if ( has_post_thumbnail( $args['id'] ) ) { $output = get_the_post_thumbnail( $args['id'], $args['size'], array( 'class' => $args['class'] ) ); } else { $output = $args['default']; } if ( $args['linked'] ) $thumb = '' . $output . ''; else $thumb = $output; return apply_filters( 'fastfood_filter_get_the_thumb', $thumb ); } // display the post title with the featured image function fastfood_featured_title( $args = '' ) { global $post; $defaults = array( 'alternative' => '', 'fallback' => '', 'featured' => true, 'href' => get_permalink(), 'target' => '', 'title' => the_title_attribute( array( 'echo' => 0 ) ), 'echo' => 1, ); $args = wp_parse_args( $args, $defaults ); if ( fastfood_get_opt( 'fastfood_hide_frontpage_title' ) && is_page() && is_front_page() ) return; if ( fastfood_get_opt( 'fastfood_hide_pages_title' ) && is_page() ) return; if ( fastfood_get_opt( 'fastfood_hide_posts_title' ) && is_single() ) return; $selected_ids = explode( ',', fastfood_get_opt( 'fastfood_hide_selected_entries_title' ) ); if ( in_array( $post->ID, $selected_ids ) ) return; $post_title = $args['alternative'] ? $args['alternative'] : get_the_title(); $post_title = $post_title ? $post_title : $args['fallback']; $link_target = $args['target'] ? ' target="'.$args['target'].'"' : ''; if ( !fastfood_get_opt( 'fastfood_featured_title' ) ) $args['featured'] = false; $thumb = ( $args['featured'] && has_post_thumbnail( $post->ID ) ) ? get_the_post_thumbnail( $post->ID, array( fastfood_get_opt( 'fastfood_featured_title_size' ), fastfood_get_opt( 'fastfood_featured_title_size' ) ) ) : ''; $title_class = $thumb ? 'entry-title storytitle featured-' . fastfood_get_opt( 'fastfood_featured_title_size' ) : 'storytitle'; $title_content = is_singular() ? $thumb . $post_title : '' . $thumb . $post_title . ''; if ( $post_title || $thumb ) $post_title = '

    ' . $title_content . '

    '; $post_title = apply_filters( 'fastfood_filter_featured_title', $post_title ); if ( $args['echo'] ) echo $post_title; else return $post_title; } // print extra info for posts/pages if ( !function_exists( 'fastfood_extrainfo' ) ) { function fastfood_extrainfo( $args = '' ) { $defaults = array( 'auth' => 1, 'date' => 1, 'comms' => 1, 'tags' => 1, 'cats' => 1, 'hiera' => 0, 'list_view' => 0, ); $args = wp_parse_args( $args, $defaults ); //xinfos disabled when... if ( ! fastfood_get_opt( 'fastfood_xinfos_global' ) ) return; //xinfos globally disabled if ( is_page() && is_front_page() && ! fastfood_get_opt( 'fastfood_xinfos_on_front' ) ) return; // is front page if ( is_page() && ! fastfood_get_opt( 'fastfood_xinfos_on_page' ) ) return; if ( is_single() && ! fastfood_get_opt( 'fastfood_xinfos_on_post' ) ) return; if ( !is_singular() && ! fastfood_get_opt( 'fastfood_xinfos_on_list' ) ) return; if ( fastfood_get_opt( 'fastfood_xinfos_static' ) ) $args['list_view'] = true; if ( ! fastfood_get_opt( 'fastfood_xinfos_byauth' ) ) $args['auth'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_date' ) ) $args['date'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_comm' ) ) $args['comms'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_tag' ) ) $args['tags'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_cat' ) ) $args['cats'] = false; if ( ! fastfood_get_opt( 'fastfood_xinfos_hiera' ) ) $args['hiera'] = false; $post_author = ( ( $args['auth'] === true ) || ( $args['auth'] === 1 ) ) ? '' . get_the_author() . '' : '' . $args['auth'] . ''; $post_author = sprintf( __( 'by %s', 'fastfood' ), $post_author ); $categories = __( 'Categories', 'fastfood' ) . ': ' . get_the_category_list(', '); $tags = __( 'Tags', 'fastfood' ) . ': ' . ( ( get_the_tags() ) ? get_the_tag_list( '', ', ' , '') : __( 'No Tags', 'fastfood' ) ); $comments = __( 'Comments', 'fastfood' ) . ': ' . fastfood_get_comments_link(); $date = sprintf( __( 'Published on: %s', 'fastfood' ), '' . get_the_time( get_option( 'date_format' ) ) . '' ); $r_pos = 10; if ( !$args['list_view'] ) { ?>
    '; ?> '; ?> '; ?> '; ?> '; ?>
    ID ); $esc_href = esc_url( get_permalink() ); $esc_title = esc_attr( get_the_title() ); $esc_href_short = esc_url( home_url() . '/?p=' . $post->ID ); $text = ''; if ( fastfood_get_opt( 'fastfood_I_like_it_plus1' ) ) $text .='
    '; if ( fastfood_get_opt( 'fastfood_I_like_it_twitter' ) ) $text .='
    '; if ( fastfood_get_opt( 'fastfood_I_like_it_facebook' ) ) $text .='
    '; if ( fastfood_get_opt( 'fastfood_I_like_it_linkedin' ) ) $text .='
    '; if ( fastfood_get_opt( 'fastfood_I_like_it_stumbleupon' ) ) $text .='
    '; if ( fastfood_get_opt( 'fastfood_I_like_it_pinterest' ) && is_attachment() && wp_attachment_is_image() ) $text .='
    '; if ( $text ) { echo '
    ' . apply_filters( 'fastfood_filter_like_it', $text ) . '
    '; add_action( 'wp_footer', 'fastfood_like_it_scripts' ); } } } // the "like" badges scripts (asynchronously loaded) if ( !function_exists( 'fastfood_like_it_scripts' ) ) { function fastfood_like_it_scripts(){ ?>
    $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); foreach ( $attachments as $key => $attachment ) { if ( $attachment->ID == $post->ID ) break; } $prev_k = $key - 1; $next_k = $key + 1; $prev_image = ( isset( $attachments[ $prev_k ] ) ) ? '« ' . wp_get_attachment_image( $attachments[ $prev_k ]->ID, array( 70, 70 ) ) . '' : ''; $next_image = ( isset( $attachments[ $next_k ] ) ) ? '' . wp_get_attachment_image( $attachments[ $next_k ]->ID, array( 70, 70 ) ) . ' »' : ''; ?>
    ID, array( 70, 70 ) ); ?>
    1 && get_option( 'page_comments' ) ) { ?>
    is_main_query() && $query->is_home() ) { if ( ! fastfood_get_opt( 'fastfood_post_view_aside') ) $terms[] = 'post-format-aside'; if ( ! fastfood_get_opt( 'fastfood_post_view_status' ) ) $terms[] = 'post-format-status'; if ( isset( $terms ) ) { $tax_query = array( array( 'taxonomy' => 'post_format', 'terms' => $terms, 'field' => 'slug', 'operator' => 'NOT IN', ), ); $query->set( 'tax_query', $tax_query ); } } } // Search reminder function fastfood_search_reminder() { global $wp_query; $text = ''; $term = get_queried_object(); if ( ! fastfood_get_opt( 'fastfood_breadcrumb' ) ) { if ( is_archive() ) { $title = ''; $type = ''; if ( is_category() || is_tag() || is_tax() ) { if ( is_category() ) $type = __( 'Category', 'fastfood' ); elseif ( is_tag() ) $type = __( 'Tag', 'fastfood' ); elseif ( is_tax() ) $type = __( 'Taxonomy', 'fastfood' ); $title = $term->name; } elseif ( is_date() ) { $type = __( 'Date', 'fastfood' ); if ( is_day() ) { $title = get_the_date(); } else if ( is_month() ) { $title = single_month_title( ' ', false ); } else if ( is_year() ) { $title = get_query_var( 'year' ); } } elseif ( is_author() ) { $type = __( 'Author', 'fastfood' ); $title = $term->display_name; } $text = sprintf( __( '%s archive', 'fastfood' ), get_bloginfo( 'name' ) ) . '

    ' . $type . ' : ' . $title . ' (' . $wp_query->found_posts . ')

    '; } elseif ( is_search() ) { $text = sprintf( __( 'Search results for “%s”', 'fastfood' ), '' . esc_html( get_search_query() ) . ' (' . $wp_query->found_posts . ')' ); } } if ( $text ) { ?>
    max_num_pages ); previous_posts_link( '»' ); } ?>
    ' . __( 'Pages', 'fastfood' ) . ':&after=

    ' ); ?> '; } /** * Displays the link to the comments popup window for the current post ID. * */ function fastfood_get_comments_link( $args = '' ) { $defaults = array( 'zero' => false, 'one' => false, 'more' => false, 'css_class' => '', 'none' => false, 'id' => false, ); $args = wp_parse_args( $args, $defaults ); extract($args, EXTR_SKIP); if ( false === $zero ) $zero = __( 'No Comments', 'fastfood' ); if ( false === $one ) $one = __( '1 Comment', 'fastfood' ); if ( false === $more ) $more = __( '% Comments', 'fastfood' ); if ( false === $none ) $none = __( 'Comments Off', 'fastfood' ); $id = ( $id ) ? (int)$id : get_the_ID(); $css_class = ( ! empty( $css_class ) ) ? ' class="' . esc_attr( $css_class ) . '"' : ''; $number = get_comments_number( $id ); if ( 0 == $number && !comments_open() && !pings_open() ) { $output = '' . $none . ''; } elseif ( post_password_required() ) { $output = __( 'Enter your password to view comments', 'fastfood' ); } else { $label = fastfood_get_opt( 'fastfood_cust_comrep' ) ? '#comments' : '#respond'; $href = ( 0 == $number ) ? get_permalink() . $label : get_comments_link(); $title = esc_attr( sprintf( __( 'Comment on %s', 'fastfood'), the_title_attribute( array( 'echo' => 0 ) ) ) ); if ( $number > 1 ) $text = str_replace( '%', number_format_i18n( $number ), $more ); elseif ( $number == 0 ) $text = $zero; else $text = $one; $output = '' . $text . ''; } return apply_filters( 'fastfood_get_comments_link' , $output ); } // set up custom colors and header image function fastfood_setup() { // Register localization support load_theme_textdomain( 'fastfood', get_template_directory() . '/languages' ); // Theme uses wp_nav_menu() in three location register_nav_menus( array( 'primary' => __( 'Main Navigation Menu', 'fastfood' ) ) ); register_nav_menus( array( 'secondary1' => __( 'Secondary Navigation Menu #1', 'fastfood' ) ) ); register_nav_menus( array( 'secondary2' => __( 'Secondary Navigation Menu #2', 'fastfood' ) ) ); // Register Features Support add_theme_support( 'automatic-feed-links' ); // Thumbnails support add_theme_support( 'post-thumbnails' ); // Add the editor style if ( fastfood_get_opt( 'fastfood_editor_style' ) ) add_editor_style( 'css/editor-style.css' ); // This theme uses post formats if ( fastfood_get_opt( 'fastfood_post_formats' ) ) { $pformats = array(); if ( fastfood_get_opt( 'fastfood_post_formats_gallery' ) ) $pformats[] = 'gallery'; if ( fastfood_get_opt( 'fastfood_post_formats_aside' ) ) $pformats[] = 'aside'; if ( fastfood_get_opt( 'fastfood_post_formats_status' ) ) $pformats[] = 'status'; if ( fastfood_get_opt( 'fastfood_post_formats_quote' ) ) $pformats[] = 'quote'; $pformats = apply_filters( 'fastfood_filter_post_formats', $pformats ); if ( ! empty( $pformats ) ) add_theme_support( 'post-formats', $pformats ); } } // the custom header (filterable) function fastfood_header(){ // Allow plugins/themes to override the default header. $output = apply_filters('fastfood_header', ''); if ( $output != '' ) return $output; if ( fastfood_get_opt( 'fastfood_head_link' ) && ( get_header_image() != '' ) ) { $output = ''; } else { $output = ' '; } return $output; } // the custom header style - add style customization to page - gets included in the site header function fastfood_custom_css(){ ?> if no
    s found function fastfood_quote_content( $content ) { /* Check if we're displaying a 'quote' post. */ if ( has_post_format( 'quote' ) && fastfood_get_opt( 'fastfood_post_formats_quote' ) ) { /* Match any
    elements. */ preg_match( '//', $content, $matches ); /* If no
    elements were found, wrap the entire content in one. */ if ( empty( $matches ) ) $content = "
    {$content}
    "; } return $content; } // the gallery shortcode filter. supports 'ids' attribute (WP3.5) function fastfood_gallery_shortcode( $output, $attr ) { $post = get_post(); static $instance = 0; $instance++; if ( ! empty( $attr['ids'] ) ) { // 'ids' is explicitly ordered, unless you specify otherwise. if ( empty( $attr['orderby'] ) ) $attr['orderby'] = 'post__in'; $attr['include'] = $attr['ids']; } // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if ( isset( $attr['orderby'] ) ) { $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); if ( !$attr['orderby'] ) unset( $attr['orderby'] ); } extract( shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '' ), $attr) ); $id = intval( $id ); if ( 'RAND' == $order ) $orderby = 'none'; if ( ! empty( $include ) ) { $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( ! empty( $exclude ) ) { $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if ( isset( $attr['preview'] ) && $attr['preview'] ) return fastfood_gallery_preview_walker( $attachments, $id ); if ( empty($attachments) ) return ''; if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $selector = "gallery-{$instance}"; $size_class = sanitize_html_class( $size ); $output = "\n"; return $output; } // custom image caption function fastfood_img_caption_shortcode( $deprecated, $attr, $content = null ) { extract( shortcode_atts( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '', ), $attr ) ); if ( 1 > (int) $width || empty( $caption ) ) return $content; if ( $id ) $id = 'id="' . esc_attr( $id ) . '" '; return '
    ' . do_shortcode( $content ) . '
    ' . $caption . '
    '; } //add attachment description to thickbox function fastfood_get_attachment_link( $markup = '', $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { $id = intval( $id ); $_post = get_post( $id ); if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) return __( 'Missing Attachment','fastfood' ); if ( $permalink ) $url = get_attachment_link( $_post->ID ); $post_title = esc_attr( $_post->post_excerpt ? $_post->post_excerpt : $_post->post_title ); if ( $text ) $link_text = $text; elseif ( $size && 'none' != $size ) $link_text = wp_get_attachment_image( $id, $size, $icon ); else $link_text = ''; if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; return "$link_text"; } // add a title to previous posts link function fastfood_previous_posts_link_attributes( $attr ) { $attr = $attr . ' title="' . esc_attr( __( 'Newer Posts', 'fastfood' ) ) . '" '; return $attr; } // add a title to next posts link function fastfood_next_posts_link_attributes( $attr ) { $attr = $attr . ' title="' . esc_attr( __( 'Older Posts', 'fastfood' ) ) . '" '; return $attr; } // add 'quoted on' before trackback/pingback comments link function fastfood_add_quoted_on( $return ) { $text = ''; if ( get_comment_type() != 'comment' ) { $text = '' . __( 'quoted on', 'fastfood' ) . ' '; } return $text . $return; } // strip tags and apply title format for blank titles function fastfood_title_tags_filter( $title = '', $id = null ) { if ( is_admin() ) return $title; $title = strip_tags( $title, '' ); if ( ! fastfood_get_opt( 'fastfood_manage_blank_title' ) ) return $title; if ( $id == null ) return $title; if ( empty( $title ) ) { if ( ! fastfood_get_opt( 'fastfood_blank_title' ) ) return ''; $postdata = array( get_post_format( $id )? get_post_format_string( get_post_format( $id ) ): __( 'Post', 'fastfood' ), get_the_time( get_option( 'date_format' ), $id ), $id ); $codes = array( '%f', '%d', '%n' ); return str_replace( $codes, $postdata, fastfood_get_opt( 'fastfood_blank_title' ) ); } else return $title; } //set the excerpt length function fastfood_excerpt_length( $length ) { if ( is_admin() ) return $length; return (int) fastfood_get_opt( 'fastfood_excerpt_lenght' ); } // use the "excerpt more" string as a link to the post function fastfood_excerpt_more( $more ) { if ( is_admin() ) return $more; if ( fastfood_get_opt( 'fastfood_excerpt_more_link' ) ) { return '' . fastfood_get_opt( 'fastfood_excerpt_more_txt' ) . ''; } else { return fastfood_get_opt( 'fastfood_excerpt_more_txt' ); } return $more; } // custom text for the "more" tag function fastfood_more_link( $more_link, $more_link_text ) { if ( fastfood_get_opt( 'fastfood_more_tag' ) && !is_admin() ) { $text = str_replace ( '%t', get_the_title(), fastfood_get_opt( 'fastfood_more_tag' ) ); return str_replace( $more_link_text, $text, $more_link ); } return $more_link; } // Add specific CSS class by filter function fastfood_body_classes($classes) { $classes[] = 'ff-no-js'; if ( fastfood_get_opt( 'fastfood_tinynav' ) ) $classes[] = 'tinynav-support'; return $classes; } /** * Add parent class to wp_page_menu top parent list items */ function fastfood_add_parent_class( $css_class, $page, $depth, $args ) { if ( ! empty( $args['has_children'] ) && $depth == 0 ) $css_class[] = 'menu-item-parent'; return $css_class; } /** * Add parent class to wp_nav_menu top parent list items */ function fastfood_add_menu_parent_class( $items ) { $parents = array(); foreach ( $items as $item ) { if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) { $parents[] = $item->menu_item_parent; } } foreach ( $items as $item ) { if ( in_array( $item->ID, $parents ) ) { if ( ! $item->menu_item_parent ) $item->classes[] = 'menu-item-parent'; } } return $items; } // the search form filter function fastfood_search_form() { static $counter = 0; $counter++; $output = '
    '; return $output; } // wrap the categories count with a span function fastfood_wrap_categories_count( $output ) { $pattern = '/<\/a>\s(\(\d+\))/i'; $replacement = ' $1'; return preg_replace( $pattern, $replacement, $output ); } //filters wp_title() function fastfood_filter_wp_title( $title ) { if ( is_single() && empty( $title ) ) { $_post = get_queried_object(); $title = fastfood_title_tags_filter( '', $_post->ID ) . ' « '; } // Get the Site Name $site_name = get_bloginfo( 'name' ); // Append name $filtered_title = $title . $site_name; // If site front page, append description if ( is_front_page() ) { // Get the Site Description $site_description = get_bloginfo( 'description' ); // Append Site Description to title $filtered_title .= ' - ' . $site_description; } // Return the modified title return $filtered_title; } // add links to admin bar function fastfood_admin_bar_plus() { global $wp_admin_bar; if ( !current_user_can( 'edit_theme_options' ) || !is_admin_bar_showing() ) return; $add_menu_meta = array( 'target' => '_blank' ); $wp_admin_bar->add_menu( array( 'id' => 'ff_theme_options', 'parent' => 'appearance', 'title' => __( 'Theme Options', 'fastfood' ), 'href' => get_admin_url() . 'themes.php?page=fastfood_theme_options', 'meta' => $add_menu_meta ) ); } // filters comments_form() default arguments function fastfood_comment_form_defaults( $defaults ) { global $user_identity; $defaults['comment_field'] = '

    '; $defaults['label_submit'] = __( 'Say It!','fastfood' ); $defaults['title_reply'] = __( 'Leave a comment','fastfood' ); return $defaults; } // add the avatar before the "logged in as..." message function fastfood_add_avatar_to_logged_in( $text = '', $commenter = false, $user_identity = false ) { $avatar = is_user_logged_in() ? get_avatar( get_current_user_id(), 50, $default = get_option( 'avatar_default' ) ) . ' ' : ''; $text = str_replace( '

    ', '

    ' . $avatar, $text ); return $text; } // retrieve the post content, then die (for "post_expander" ajax request) function fastfood_post_expander_show_post ( ) { if ( have_posts() ) { while ( have_posts() ) { the_post(); the_content(); } } die(); } //is a "post_expander" ajax request? function fastfood_post_expander_activate ( ) { if ( isset( $_POST["ff_post_expander"] ) ) { add_action( 'wp', 'fastfood_post_expander_show_post' ); } } //add a video player using HTML5 if ( !function_exists( 'fastfood_video_player' ) ) { function fastfood_video_player() { $embed_defaults = wp_embed_defaults(); $file = wp_get_attachment_url(); $mime = get_post_mime_type(); $mime_type = explode( '/', $mime ); if ( isset( $mime_type[0] ) && $mime_type[0] == 'video' ) { ?>

    $length ) { $ret_string = substr( $string, $start, $length ) . $wrap; } else { $ret_string = $string; } return $ret_string; } }