ID; if ( $id == 0 ) { return false; } $html = get_the_post_thumbnail($id, array(300,175)); if(!empty($html)){ echo $html; } } endif; /** * Register a Custom Post Type * * Label: Project (for portfolio items) */ add_action( 'init', 'create_post_type' ); if (!function_exists('create_post_type')): function create_post_type() { register_post_type( 'project', array( 'labels' => array( 'name' => __( 'Projects','pilotfish' ), 'singular_name' => __( 'Project','pilotfish' ) ), 'public' => true, 'has_archive' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => '5', 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) ) ); } endif; register_taxonomy("Skills", array("project"), array("hierarchical" => true, "label" => "Skills", "singular_label" => "Skill", "rewrite" => true)); /** * Show Home Link in the Primary Navigation */ if (!function_exists('pilotfish_home_menu_args')): function pilotfish_home_menu_args( $args ) { $args['show_home'] = true; return $args; } endif; add_filter( 'wp_page_menu_args', 'pilotfish_home_menu_args' ); /** * Where the post has no post title, but must still display a link to the single-page post view. */ if (!function_exists('pilotfish_title')): function pilotfish_title($title) { if ($title == '') { return __('Untitled','pilotfish'); } else { return $title; } } endif; add_filter('the_title', 'pilotfish_title'); /** * Sets the post excerpt length to 60 words. * * To override this length in a child theme, remove the filter and add your own * function tied to the excerpt_length filter hook. */ if (!function_exists('pilotfish_excerpt_length')): function pilotfish_excerpt_length( $length ) { return 60; } endif; add_filter( 'excerpt_length', 'pilotfish_excerpt_length' ); /** * Returns a "Continue Reading" link for excerpts */ if (!function_exists('pilotfish_continue_reading_link')): function pilotfish_continue_reading_link() { return ' ' . __( 'Continue Reading ', 'pilotfish' ) . ''; } endif; /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and pilotfish_continue_reading_link(). */ if (!function_exists('pilotfish_auto_excerpt_more')):// function pilotfish_auto_excerpt_more( $more ) { return ' …' . pilotfish_continue_reading_link(); } endif; add_filter( 'excerpt_more', 'pilotfish_auto_excerpt_more' ); /** * Adds a pretty "Continue Reading" link to custom post excerpts. * * To override this link in a child theme, remove the filter and add your own * function tied to the get_the_excerpt filter hook. */ if (!function_exists('pilotfish_custom_excerpt_more')): function pilotfish_custom_excerpt_more( $output ) { if ( has_excerpt() && ! is_attachment() ) { $output .= pilotfish_continue_reading_link(); } return $output; } endif; add_filter( 'get_the_excerpt', 'pilotfish_custom_excerpt_more' ); /* * filter function for wp_title */ if (!function_exists('pilotfish_filter_wp_title')): function pilotfish_filter_wp_title( $old_title, $sep, $sep_location ){ // add padding to the sep $ssep = ' ' . $sep . ' '; // find the type of index page this is if( is_category() ) $insert = $ssep . 'Category'; elseif( is_tag() ) $insert = $ssep . 'Tag'; elseif( is_author() ) $insert = $ssep . 'Author'; elseif( is_year() || is_month() || is_day() ) $insert = $ssep . 'Archives'; else $insert = NULL; // get the page number we're on (index) if( get_query_var( 'paged' ) ) $num = $ssep . 'page ' . get_query_var( 'paged' ); // get the page number we're on (multipage post) elseif( get_query_var( 'page' ) ) $num = $ssep . 'page ' . get_query_var( 'page' ); // else else $num = NULL; // concoct and return new title return get_bloginfo( 'name' ) . $insert . $old_title . $num; } endif; // call our custom wp_title filter, with normal (10) priority, and 3 args add_filter( 'wp_title', 'pilotfish_filter_wp_title', 10, 3 ); /* * Comment replu script */ function pilotfish_enqueue_comment_reply_script() { if ( comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'comment_form_before', 'pilotfish_enqueue_comment_reply_script' ); /** * Return the URL for the first link found in the post content. */ function pilotfish_url_grabber() { if ( ! preg_match( '/]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) return false; return esc_url_raw( $matches[1] ); }