__('Primary Navigation', 'reverie'), 'utility_navigation' => __('Utility Navigation', 'reverie') )); } add_action('after_setup_theme', 'reverie_setup'); //theme options page include ('theme-options.php'); //-------------------------- // start meta page //-------------------------- // $shortname add_action('admin_menu', 'bricks_add_box'); // Add meta box function bricks_add_box() { /* Add meta boxes on the 'add_meta_boxes' hook. */ add_action( 'add_meta_boxes', 'bricks_add_post_meta_boxes' ); /* Save post meta on the 'save_post' hook. */ add_action( 'save_post', 'bricks_save_post_class_meta', 10, 2 ); } function bricks_add_post_meta_boxes() { add_meta_box( 'brick-width', // Unique ID esc_html__( 'Brick Width', 'example' ), // Title 'bricks_post_class_meta_box', // Callback function 'post', // Admin page (or post type) 'side', // Context 'default' // Priority ); } /* Display the post meta box. */ function bricks_post_class_meta_box( $object, $box ) { ?>


post_type ); /* Check if the current user has permission to edit the post. */ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id; /* Get the posted data and sanitize it for use as an HTML class. */ $new_meta_value = ( isset( $_POST['brick-post-class'] ) ? sanitize_html_class( $_POST['brick-post-class'] ) : '' ); /* Get the meta key. */ $meta_key = 'brick_size'; /* Get the meta value of the custom field key. */ $meta_value = get_post_meta( $post_id, $meta_key, true ); /* If a new meta value was added and there was no previous value, add it. */ if ( $new_meta_value && '' == $meta_value ) add_post_meta( $post_id, $meta_key, $new_meta_value, true ); /* If the new meta value does not match the old value, update it. */ elseif ( $new_meta_value && $new_meta_value != $meta_value ) update_post_meta( $post_id, $meta_key, $new_meta_value ); /* If there is no new meta value but an old value exists, delete it. */ elseif ( '' == $new_meta_value && $meta_value ) delete_post_meta( $post_id, $meta_key, $meta_value ); } //-------------------------- // end meta page //-------------------------- // create widget areas: sidebar, footer $sidebars = array('Sidebar'); foreach ($sidebars as $sidebar) { register_sidebar(array('name'=> $sidebar, 'before_widget' => '
', 'before_title' => '
', 'after_title' => '
' )); } $sidebars = array('Footer'); foreach ($sidebars as $sidebar) { register_sidebar(array('name'=> $sidebar, 'before_widget' => '
', 'before_title' => '
', 'after_title' => '
' )); } // return entry meta information for posts, used by multiple loops. function reverie_entry_meta() { echo ''; echo '

'. __('Written by', 'reverie') .'

'; } /* Customized the output of caption, you can remove the filter to restore back to the WP default output. Courtesy of DevPress. http://devpress.com/blog/captions-in-wordpress/ */ add_filter( 'img_caption_shortcode', 'cleaner_caption', 10, 3 ); function cleaner_caption( $output, $attr, $content ) { /* We're not worried abut captions in feeds, so just return the output here. */ if ( is_feed() ) return $output; /* Set up the default arguments. */ $defaults = array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ); /* Merge the defaults with user input. */ $attr = shortcode_atts( $defaults, $attr ); /* If the width is less than 1 or there is no caption, return the content wrapped between the [caption]< tags. */ if ( 1 > $attr['width'] || empty( $attr['caption'] ) ) return $content; /* Set up the attributes for the caption
. */ $attributes .= ' class="figure ' . esc_attr( $attr['align'] ) . '"'; /* Open the caption
. */ $output = ''; /* Allow shortcodes for the content the caption was created for. */ $output .= do_shortcode( $content ); /* Append the caption text. */ $output .= '
' . $attr['caption'] . '
'; /* Close the caption
. */ $output .= ''; /* Return the formatted, clean caption. */ return $output; } // Clean the output of attributes of images in editor. Courtesy of SitePoint. http://www.sitepoint.com/wordpress-change-img-tag-html/ function image_tag_class($class, $id, $align, $size) { $align = 'align' . esc_attr($align); return $align; } add_filter('get_image_tag_class', 'image_tag_class', 0, 4); function image_tag($html, $id, $alt, $title) { return preg_replace(array( '/\s+width="\d+"/i', '/\s+height="\d+"/i', '/alt=""/i' ), array( '', '', '', 'alt="' . $title . '"' ), $html); } add_filter('get_image_tag', 'image_tag', 0, 4); // Customize the output of menus to fit the ZURB navigation style. Courtesy of Kriesi.at. http://www.kriesi.at/archives/improve-your-wordpress-navigation-menu-output class description_walker extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="'. esc_attr( $class_names ) . '"'; $output .= $indent . '