/i', $post->post_content, $matches); if($output2) { $first_img = $matches[1][0]; } else { return NULL; } if(empty($first_img)) { $first_img = "/path/to/default.png"; } return $first_img; } function bigpix_ahoy() { // let's get language support going, if you need it load_theme_textdomain( 'bigpixtheme', get_template_directory() . '/library/translation' ); // launching operation cleanup add_action( 'init', 'bigpix_head_cleanup' ); // A better title add_filter( 'wp_title', 'rw_title', 10, 3 ); // remove WP version from RSS add_filter( 'the_generator', 'bigpix_rss_version' ); // remove pesky injected css for recent comments widget add_filter( 'wp_head', 'bigpix_remove_wp_widget_recent_comments_style', 1 ); // clean up comment styles in the head add_action( 'wp_head', 'bigpix_remove_recent_comments_style', 1 ); // clean up gallery output in wp add_filter( 'gallery_style', 'bigpix_gallery_style' ); // enqueue base scripts and styles add_action( 'wp_enqueue_scripts', 'bigpix_scripts_and_styles', 999 ); // ie conditional wrapper // launching this stuff after theme setup bigpix_theme_support(); add_theme_support( 'custom-header' ); // adding sidebars to Wordpress (these are created in functions.php) add_action( 'widgets_init', 'bigpix_register_sidebars' ); // cleaning up random code around images add_filter( 'the_content', 'bigpix_filter_ptags_on_images' ); // cleaning up excerpt add_filter( 'excerpt_more', 'bigpix_excerpt_more' ); } /* end bigpix ahoy */ // let's get this party started add_action( 'after_setup_theme', 'bigpix_ahoy' ); /************* OEMBED SIZE OPTIONS *************/ if ( ! isset( $content_width ) ) { $content_width = 640; } /************* THUMBNAIL SIZE OPTIONS *************/ // Thumbnail sizes add_image_size( 'bigpix-thumb-600', 600, 150, true ); add_image_size( 'bigpix-thumb-300', 300, 100, true ); add_image_size( 'slider-image', 1280, 500, true ); add_image_size( 'thumb-image-300by300', 300, 300, true ); /* to add more sizes, simply copy a line from above and change the dimensions & name. As long as you upload a "featured image" as large as the biggest set width or height, all the other sizes will be auto-cropped. To call a different size, simply change the text inside the thumbnail function. For example, to call the 300 x 300 sized image, we would use the function: for the 600 x 100 image: You can change the names and dimensions to whatever you like. Enjoy! */ add_filter( 'image_size_names_choose', 'bigpix_custom_image_sizes' ); function bigpix_custom_image_sizes( $sizes ) { return array_merge( $sizes, array( 'bigpix-thumb-600' => '600px by 150px', 'bigpix-thumb-300' => '300px by 100px', 'slider-image' => '1280px by 500px' ) ); } /* The function above adds the ability to use the dropdown menu to select the new images sizes you have just created from within the media manager when you add media to your content blocks. If you add more image sizes, duplicate one of the lines in the array and name it according to your new image size. */ /************* ACTIVE SIDEBARS ********************/ // Sidebars & Widgetizes Areas function bigpix_register_sidebars() { register_sidebar(array( 'id' => 'sidebar3', 'name' => __( 'Homepage Menu Widget Area', 'bigpixtheme' ), 'description' => __( 'The Menu Widget Area.', 'bigpixtheme' ), 'before_widget' => '
', 'before_title' => '
$depth, 'max_depth' => $args['max_depth']))) ?>
/mi','',$output); } function author_excerpt() { $text_limit = 50; //Words to show in author bio excerpt $read_more = "Read more"; //Read more text $end_of_txt = "..."; $name_of_author = get_the_author(); $url_of_author = get_author_posts_url(get_the_author_meta('ID')); $short_desc_author = wp_trim_words(strip_tags( get_the_author_meta('description')), $text_limit, $end_of_txt.'
'.$read_more .''); return $short_desc_author; } /* DON'T DELETE THIS CLOSING TAG */ ?>