__( 'Primary Widget Area', 'gravity' ), 'id' => 'sidebar-1', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar(array( 'name'=> __( 'Secondary Widget ', 'gravity' ), 'id' => 'sidebar-2', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name'=> __('Third Widget Area', 'gravity' ), 'id' => 'sidebar-3', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); } add_action( 'widgets_init', 'gravity_widgets_init' ); /** * Enqueue scripts and styles */ function gravity_scripts() { wp_enqueue_style( 'style', get_stylesheet_uri() ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', array( 'jquery' ), '20120206', true ); if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' ); } } add_action( 'wp_enqueue_scripts', 'gravity_scripts' ); if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 250, 250, true ); // default Post Thumbnail dimensions (cropped) // additional image sizes // delete the next line if you do not need additional image sizes add_image_size( 'attachment-thumbnail', 75, 75, true ); add_image_size( 'recent-thumbnail', 250, 200, true ); add_image_size( 'archive-thumbnail', 625,229, true ); add_image_size( 'single-thumbnail', 125, 125, true ); add_image_size( 'featured-thumbnail', 625, 229, true, array('class' => 'featured')); add_image_size( 'slider-nav-thumbnail', 110, 70, true ); } add_theme_support( 'custom-background' ); //custom stylesheet add_editor_style('style.css'); /** * Implement the Custom Header feature */ require( get_template_directory() . '/inc/custom-header.php' ); function register_my_menus() { register_nav_menus( array( 'header-menu' => __( 'Header Menu', 'gravity' ) ) ); } add_action( 'init', 'register_my_menus' ); ?> 'primary', 'name' => __( 'Primary Sidebar', 'gravity' ), 'description' => __( 'The following widgets will appear in the main sidebar div.', 'gravity' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); } function blm_init_method() { wp_enqueue_script('jquery'); wp_enqueue_script( 'slides', get_template_directory_uri().'/js/slides.min.jquery.js', array( 'jquery' ) ); } add_action('wp_enqueue_scripts', 'blm_init_method'); // Custom Post types for Feature project on home page add_action('init', 'create_feature'); function create_feature() { $feature_args = array( 'labels' => array( 'name' => __( 'Feature Project', 'gravity' ), 'singular_name' => __( 'Feature Project', 'gravity' ), 'add_new' => __( 'Add New Feature Project', 'gravity' ), 'add_new_item' => __( 'Add New Feature Project', 'gravity' ), 'edit_item' => __( 'Edit Feature Project', 'gravity' ), 'new_item' => __( 'Add New Feature Project', 'gravity' ), 'view_item' => __( 'View Feature Project', 'gravity' ), 'search_items' => __( 'Search Feature Project', 'gravity' ), 'not_found' => __( 'No feature project found', 'gravity' ), 'not_found_in_trash' => __( 'No feature project found in trash', 'gravity' ) ), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => true, 'menu_position' => 20, 'supports' => array('title', 'editor', 'thumbnail') ); register_post_type('feature',$feature_args); } add_filter("manage_feature_edit_columns", "feature_edit_columns"); function feature_edit_columns($feature_columns){ $feature_columns = array( "cb" => "", "title" => "Title", ); return $feature_columns; } //Add Meta Boxes add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() { add_meta_box( 'my-meta-box-id', 'Link to Project', 'cd_meta_box_cb', 'feature', 'normal', 'high' ); } function cd_meta_box_cb( $post ) { $url = get_post_meta($post->ID, 'url', true); wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' ); ?>

array( // on allow a tags 'href' => array() // and those anchors can only have href attribute ) ); // Probably a good idea to make sure your data is set if( isset( $_POST['url'] ) ) update_post_meta( $post_id, 'url', wp_kses( $_POST['url'], $allowed ) ); } function recentPosts() { $rPosts = new WP_Query(); $rPosts->query('showposts=3'); while ($rPosts->have_posts()) : $rPosts->the_post(); ?> )|(\)|(\
)/", " ", $content); $content = strip_tags($content); if(strlen($content) < $size) return $content; $content = substr($content, 0, $size); $spaceloc = strrpos($content, " "); if($spaceloc) { $content = substr($content, 0, $spaceloc); $content.= "..."; } return $content; } /* a custom callback function that displays a meaningful title * depending on the page being rendered */ function gravity_filter_wp_title($title, $sep, $sep_location) { // add white space around $sep $sep = ' ' . $sep . ' '; $site_description = get_bloginfo('description'); if ($site_description && (is_home() || is_front_page())) $custom = $sep . $site_description; elseif(is_category()) $custom = $sep . __('Category', 'gravity'); elseif(is_tag()) $custom = $sep . __('Tag', 'gravity'); elseif(is_author()) $custom = $sep . __('Author', 'gravity'); elseif(is_year() || is_month() || is_day()) $custom = $sep . __('Archives', 'gravity'); else $custom = ''; // get the page number (main page or an archive) if(get_query_var('paged')) $page_number = $sep . __('Page ', 'gravity') . get_query_var('paged'); // get the page number (post with multipages) elseif(get_query_var('page')) $page_number = $sep . __('Page ', 'gravity') . get_query_var('page'); else $page_number = ''; // Comment the 4 lines of code below and see how odd the title format becomes if($sep_location == 'right' && !(is_home() || is_front_page())) { $custom = $custom . $sep; $title = substr($title, 0, -2); } // return full title return get_bloginfo('name') . $custom . $title . $page_number; } // end of function gravity_filter_wp_title /* add function 'gravity_filter_wp_title()' to the * wp_title filter, with priority 10 and 3 args */ add_filter('wp_title', 'gravity_filter_wp_title', 10, 3); function display_images_in_list($size = full) { if($images = get_posts(array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => -1, // show all 'post_status' => null, 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', ))) { foreach($images as $image) { $attimg = wp_get_attachment_image($image->ID,$size); echo $attimg; } } } ?>