'FFFFFF', 'text' => '000000', 'link' => '006699', 'border' => 'E5E5E5', 'url' => 'AED4E7', ); /** * Load Jetpack compatibility file. */ require( get_template_directory() . '/inc/jetpack.compat.php' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'custom-background' ); add_theme_support( 'print-style' ); /** * Enqueue scripts and styles */ function depo_square_scripts() { global $wp_styles; wp_enqueue_style( 'depo-square', get_stylesheet_uri() ); wp_enqueue_style( 'depo-square-ie', get_template_directory_uri() . '/ie6.css', array( 'depo-square' ) ); $wp_styles->add_data( 'depo-square-ie', 'conditional', 'IE 6' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action( 'wp_enqueue_scripts', 'depo_square_scripts' ); function depo_square_register_widgets() { register_widget( 'Widget_DePoFlickr' ); wp_register_sidebar_widget( 'depo-square-about', __( 'DePo Square About', 'depo-square' ), 'depo_square_about_widget' ); wp_register_sidebar_widget( 'depo-square-status', __( 'DePo Square Status', 'depo-square' ), 'depo_square_status_widget' ); } add_action( 'widgets_init', 'depo_square_register_widgets' ); function depo_square_register_sidebars() { register_sidebar( array( 'name' => __( 'Left', 'depo-square' ), 'description' => __( 'An empty left header widget area will show your blog tagline.', 'depo-square' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Center', 'depo-square' ), 'description' => __( 'An empty center header widget area will show your latest status message.', 'depo-square' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Right', 'depo-square' ), 'description' => __( 'An empty right header widget area will show interesting photos from Flickr.', 'depo-square' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'depo_square_register_sidebars' ); function depo_square_about_widget() { ?>

ID) . "'>About"; } else { ?> About

Status

get_option( $depo_post_types['status']['id'] ), 'posts_per_page' => 1, ) ); while ($depo_status_query->have_posts()) : $depo_status_query->the_post(); ?>

Status

Setup your post type categories to have your latest status message appear here.

array( 'id' => 'type-post', 'proper_name' => 'Articles' ), 'status' => array( 'id' => 'type-status', 'proper_name' => 'Statuses' ), 'quote' => array( 'id' => 'type-quote', 'proper_name' => 'Quotes' ), 'links' => array( 'id' => 'type-link', 'proper_name' => 'Links' ), 'photo' => array( 'id' => 'type-photo', 'proper_name' => 'Photos' ) ); function depo_post_category_html () { $type = depo_post_type(); if (! $type || 'type-post' == $type ) echo 'Post'; else echo '' . esc_attr( $type['proper_name'] ) . ''; } function depo_post_type() { global $depo_post_types; $custom = false; foreach( $depo_post_types as $key => $option ) { $cat = get_option( $option['id'] ); if ( ! empty( $cat ) && in_category( $cat ) ) { $custom = $option; break; } } return $custom ? $custom : $depo_post_types['post']; } function depo_post_category () { $type = depo_post_type(); $type = $type['id']; return ( ! $type || 'type-post' == $type ) ? 'type-post' : $type; } // type-photo functions function replace_empty_tag($m) { $no_replace = array('embed'); // expand as required if ( in_array( strtolower($m[1]), $no_replace ) ) return $m[0]; // return the original untouched return ''; } // remove image tag from post_content for display function image_above($entry) { // don't scrape the image for the feed if (is_feed()) { return $entry; } $entry = str_replace('[/wp_caption]','', $entry); $entry = str_replace('[/caption]','', $entry); //remove image tag $image = preg_replace('/]*src=(\"|\').+?(\1)[^>]*\/*>/','', $entry); //remove any empty tags left by the scrape. $entry = str_replace('

', '', $entry); $entry = preg_replace_callback( '|<([a-z]+)[^>]*>\s*|i', 'replace_empty_tag', $entry ); $entry = preg_replace_callback( '|<([a-z]+)[^>]*>\s*|i', 'replace_empty_tag', $entry ); $entry = preg_replace_callback( '|<([a-z]+)[^>]*>\s*|i', 'replace_empty_tag', $entry ); return $image.$entry; } //admin interface if( is_admin() ) { add_action('admin_menu', 'deposquare_add_page'); function deposquare_add_page() { add_theme_page(__('Theme Options'), __('Theme Options'), 'edit_theme_options', 'theme_options', 'deposquare_do_page'); } function deposquare_do_page() { global $depo_post_types; if( isset( $_POST['action'] ) && 'update' == $_POST['action'] && isset( $_POST['depo_square_nonce'] ) && wp_verify_nonce( $_POST['depo_square_nonce'], 'depo_square_save_theme_options' ) && current_user_can( 'edit_theme_options' ) ) { foreach( $depo_post_types as $key => $option ) { if( $_POST[ $option['id'] ] ) update_option( $option['id'], esc_attr( $_POST[ $option['id'] ] ) ); } } foreach( $depo_post_types as $key => $option ) { register_setting( 'deposquareops', $option['id'], 'intval' ); } ?>

'', 'show_option_none' => '', 'orderby' => 'id', 'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0 ); $args = array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None')); $r = wp_parse_args( $args, $defaults ); extract( $r ); $categories = get_categories($args); ?>
Category Mappings
$option ) { if($key != 'post') { ?>
Type of Post Category to Map

'depo_widget_flickr', 'description' => __( 'For DePo Square: Display your flickr photos.', 'depo-square' ), ) ); } function widget( $args, $instance ) { $before_title = null; $flickr_home = null; $after_title = null; global $current_blog; require_once(ABSPATH . WPINC . '/rss.php'); extract( $args ); if ( empty( $instance['flickr_rss_url'] ) ) { // This used to default to http://feeds.feedburner.com/flickr_interestingness, but that's now inactive. // Give up instead of showing a default photo stream. return; } $flickr_rss_url = esc_url_raw( $instance['flickr_rss_url'] ); if( empty($title) ) $title = apply_filters('widget_title', $instance['title']); if ( empty($title) ) $title = __( 'Flickr' ); if ( empty($items) || $items < 1 || $items > 10 ) $items = 8; if( !$photos = get_transient( 'widget-depo-square-flickr' ) ) { $flickr_photos = old_fetch_rss_summary( $flickr_rss_url, array( 'link', 'title', 'media:thumbnail', 'description' ) ); $is_404 = isset( $flickr_photos->status ) && $flickr_photos->status == 404; if ( ! $is_404 && is_array( $flickr_photos->items ) ) { $photos = ''; $items = array_slice( $flickr_photos->items, 0, $items ); foreach ( $items as $key => $photo ) { $href = esc_url( $photo['link'] ); $itemtitle = esc_attr( $photo['title'] ); if ( isset( $photo['media:thumbnail'] ) ) { $src = str_replace( "_s.jpg", "_t.jpg", esc_url( $photo['media:thumbnail']['url'] ) ); } else { // Sometimes the image url is in the description $src = preg_match( '/src="(.*?)"/i', $photo['description'], $p ); $src = $p[1]; $src = str_replace( '_m.jpg', '_t.jpg', $src ); $src = esc_url( $src ); } if(empty($src)) $src = $photo['enclosure']; $photos .= "
  • $itemtitle
  • "; } $flickr_home = esc_url( $flickr_photos->channel[ 'link' ] ); $flickr_more_title = esc_attr( $flickr_photos->channel[ 'title' ] ); set_transient( 'widget-depo-square-flickr', $photos ); } } echo $before_title.''.$title.''.$after_title; echo ''; if(function_exists('stats_extra') ) stats_extra( 'widget', 'depo-square-flickr' ); } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['flickr_rss_url'] = strip_tags(stripslashes($new_instance['flickr_rss_url'])); $instance['title'] = strip_tags(stripslashes($new_instance['title'])); delete_transient( 'widget-depo-square-flickr' ); return $instance; } function form( $instance ) { //Defaults $instance = wp_parse_args( (array) $instance, array('flickr_rss_url' => '', 'title' => '') ); $flickr_rss_url = esc_attr($instance['flickr_rss_url']); $title = esc_attr($instance['title']); echo '

    * Your RSS feed can be found on your Flickr homepage. Scroll down to the bottom of the page until you see the Feed link and copy that into the box above.

    Leave the Flickr RSS URL blank to display interesting Flickr photos.

    '; } } function depo_squared_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?>
  • id="comment-">
    %s', 'depo-squared'), get_comment_author_link()); ?> comment_approved == '0') : ?> $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ')) ?>
    tag based on what is being viewed. * * @since DePo Square 0.3 */ function depo_square_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'depo-square' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'depo_square_wp_title', 10, 2 );