From dc9703bac6a1d59f78e1ebf351bf0996a80c03c4 Mon Sep 17 00:00:00 2001 From: andrewmbacon Date: Thu, 15 Jan 2015 08:58:19 -0500 Subject: [PATCH] Adding featured image support back --- content-az.php | 194 ++++++++++----------- functions.php | 457 ++++++++++++++++++++++++------------------------- 2 files changed, 325 insertions(+), 326 deletions(-) diff --git a/content-az.php b/content-az.php index 2d3bf4e..8138a95 100644 --- a/content-az.php +++ b/content-az.php @@ -1,97 +1,97 @@ -.<]#'; -?> - - -
> -
- ', '' ); ?> -
- -
- - '', - ) ); - ?> -
- -
- ID); - if($parent !== false) $page = $parent; - else $page = $pg->ID; - $private = get_post_meta($page, 'uc-private', true); - if($private == 'admins' || $private == 'users' || $private == 'list'){ - continue; - } - $title = ucwords($pg->post_title); - $char = $title{0}; - if( !(is_numeric($char)) && !in_array($char, $letters) ){ - array_push($letters, $char); - } - } - return $letters; - } - - // Generate AZ Navigation - echo ''; - - // Generate AZ List - $pages = get_pages(array('sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => false, 'exclude' => $exclude)); - if( !preg_match($pattern, $exclude, $matches) ){ - $letters = array(); - echo '
'; - foreach( (array) $pages as $pg ){ - $parent = is_parent_private($pg->ID); - if($parent !== false) $page = $parent; - else $page = $pg->ID; - $private = get_post_meta($page, 'uc-private', true); - if($private == 'admins' || $private == 'users' || $private == 'list'){ - continue; - } - $title = ucwords($pg->post_title); - $char = $title{0}; - if( !( is_numeric($char) || empty($char) ) ){ - if( $char != end($letters) && !empty($letters) ){ - echo '
'; - } - if( !in_array($char, $letters) ){ - echo '

'.$char.'

    '; - array_push($letters, $char); - } - echo '
  1. '.$title.'
  2. '; - } - } - echo '
'; - } else { - echo '

Invalid input in field: "exclude"

'; - } - ?> - -
- ', '' ); ?> -
-
+.<]#'; +?> + + +
> +
+ ', '' ); ?> +
+ +
+ + '', + ) ); + ?> +
+ +
+ ID); + if($parent !== false) $page = $parent; + else $page = $pg->ID; + $private = get_post_meta($page, 'uc-private', true); + if($private == 'admins' || $private == 'users' || $private == 'list'){ + continue; + } + $title = ucwords($pg->post_title); + $char = $title{0}; + if( !(is_numeric($char)) && !in_array($char, $letters) ){ + array_push($letters, $char); + } + } + return $letters; + } + + // Generate AZ Navigation + echo ''; + + // Generate AZ List + $pages = get_pages(array('sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => false, 'exclude' => $exclude)); + if( !preg_match($pattern, $exclude, $matches) ){ + $letters = array(); + echo '
'; + foreach( (array) $pages as $pg ){ + $parent = is_parent_private($pg->ID); + if($parent !== false) $page = $parent; + else $page = $pg->ID; + $private = get_post_meta($page, 'uc-private', true); + if($private == 'admins' || $private == 'users' || $private == 'list'){ + continue; + } + $title = ucwords($pg->post_title); + $char = $title{0}; + if( !( is_numeric($char) || empty($char) ) ){ + if( $char != end($letters) && !empty($letters) ){ + echo '
'; + } + if( !in_array($char, $letters) ){ + echo '

'.$char.'

    '; + array_push($letters, $char); + } + echo '
  1. '.$title.'
  2. '; + } + } + echo '
'; + } else { + echo '

Invalid input in field: "exclude"

'; + } + ?> + +
+ ', '' ); ?> +
+
diff --git a/functions.php b/functions.php index be6d6f2..fa63f4f 100644 --- a/functions.php +++ b/functions.php @@ -1,230 +1,229 @@ - __( 'Primary Menu', 'cs' ), - ) ); - - // Enable support for Post Formats. - add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); - - // Setup the WordPress core custom background feature. - add_theme_support( 'custom-background', apply_filters( 'cs_custom_background_args', array( - 'default-color' => 'ffffff', - 'default-image' => '', - ) ) ); - - // Enable support for HTML5 markup. - add_theme_support( 'html5', array( - 'comment-list', - 'search-form', - 'comment-form', - 'gallery', - 'caption', - 'post-thumbnails', - ) ); -} -endif; // cs_setup -add_action( 'after_setup_theme', 'cs_setup' ); - -if(!function_exists('is_parent_private')){ - function is_parent_private($id){ - $page = get_post($id); - if($page->post_parent > 0){ - $parent = get_post($page->post_parent); - $private = get_post_meta($parent->ID, 'uc-private', true); - if($private == 'admins' || $private == 'users' || $private == 'list'){ - return $parent->ID; - } - else return is_parent_private($parent->ID); - } - else{ - return false; - } - } -} - -/** - * Register widget area. - * - * @link http://codex.wordpress.org/Function_Reference/register_sidebar - */ -function cs_widgets_init() { - require get_template_directory() . '/inc/reg-sidebars.php'; -} -add_action( 'widgets_init', 'cs_widgets_init' ); - -/** - * Enqueue scripts and styles. - */ -require get_template_directory() . '/inc/scripts-and-styles.php'; - -/** - * Browser hacks - */ -require get_template_directory() . '/inc/ie-hacks.php'; - -/** - * Private Pages - */ -require get_template_directory() . '/inc/private-pages.php'; - -/** - * Implement the Custom Header feature. - */ -require get_template_directory() . '/inc/custom-header.php'; - -/** - * Custom template tags for this theme. - */ -require get_template_directory() . '/inc/template-tags.php'; - -/** - * Custom functions that act independently of the theme templates. - */ -require get_template_directory() . '/inc/extras.php'; - -/** - * Customizer additions. - */ -require get_template_directory() . '/inc/customizer.php'; - -/** -* New versions of functions from Hale, added as includes -*/ -require get_template_directory() . '/inc/nav-walker.php'; - -/** -* Bootstrap the comment form. -*/ -require get_template_directory() . '/inc/bootstrap-forms.php'; - -/** -* Custom site settings -*/ -require get_template_directory() . '/inc/settings.php'; - -/** -* Bootstrap Whitelist -*/ -require get_template_directory() . '/inc/bootstrap-whitelist.php'; - - - - - - - -// Change what's hidden by default -add_filter('default_hidden_meta_boxes', 'be_hidden_meta_boxes', 10, 2); -function be_hidden_meta_boxes($hidden, $screen) { - if ( 'post' == $screen->base || 'page' == $screen->base ) - $hidden = array('slugdiv', 'trackbacksdiv', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); - // removed 'postcustom', - return $hidden; -} - - - -/*the fallback from wp_nav_menu, we want to replicate the output of wp_page_menu to be similar to wp_nav_menu -@param args, it comes from the wp_nav_menu arguments*/ -function hale_main_nav_fallback($args) { - $args['echo'] = 0; // don't echo the output yet. - $nav_menu = wp_page_menu($args); - if(!empty($nav_menu)){ - $doc = new DOMDocument(); - @$doc->loadHTML($nav_menu);//surpress the warnings - $data = $doc->getElementsByTagName('li'); - //the default behaviour of wp_page_menu is that it wraps the list items with a ul and div - //menu_class is for div in wp_page_menu, but is for the ul in wp_nav_menu - //create the container, if any - //container class and id come from wp_nav_menu arguments. Which is not used in wp_page_menu. - if($args['container'] != false) { - $attributes = (!empty($args['container_class'])?' class="'.$args['container_class'].'"':''); - $attributes .= (!empty($args['container_id'])?' id="'.$args['container_id'].'"':''); - if($args['container'] == 'nav') { - echo ''; - } else { - echo ''; - } - - } - $attributes = (!empty($args['menu_class'])?' class="'.$args['menu_class'].'"':''); - $attributes .= (!empty($args['menu_id'])?' id="'.$args['menu_id'].'"':''); - echo ''; - if($data->length > 0) { - foreach($data as $item) { - echo $item->ownerDocument->saveXML($item);//saveHTML wouldn't accept it as paramater. - } - } - echo ''; - //close the container, if any - if($args['container'] != false) { - if($args['container'] == 'nav') { - echo ''; - } else { - echo ''; - } - - } - } - return; -} - -function disable_comments_media_attachments( $open, $post_id ){ - $post = get_post_type( $post_id ); - if( $post == 'attachment' ) { - $open = false; - } - return $open; -} -add_filter('comments_open', 'disable_comments_media_attachments', 10 , 2); - -function metaslider_filmstrip_alt_tags( $list_item, $post, $url ) { - $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); - $list_item = "
  • ID} post-{$post->ID}\" style=\"display: none;\">\"{$alt}
  • "; - return $list_item; -} -add_filter( 'metaslider_filmstrip_list_item', 'metaslider_filmstrip_alt_tags', 10, 3 ); - + __( 'Primary Menu', 'cs' ), + ) ); + + // Enable support for Post Formats. + add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); + + // Setup the WordPress core custom background feature. + add_theme_support( 'custom-background', apply_filters( 'cs_custom_background_args', array( + 'default-color' => 'ffffff', + 'default-image' => '', + ) ) ); + + // Enable support for HTML5 markup. + add_theme_support( 'html5', array( + 'comment-list', + 'search-form', + 'comment-form', + 'gallery', + 'caption', + ) ); +} +endif; // cs_setup +add_action( 'after_setup_theme', 'cs_setup' ); + +if(!function_exists('is_parent_private')){ + function is_parent_private($id){ + $page = get_post($id); + if($page->post_parent > 0){ + $parent = get_post($page->post_parent); + $private = get_post_meta($parent->ID, 'uc-private', true); + if($private == 'admins' || $private == 'users' || $private == 'list'){ + return $parent->ID; + } + else return is_parent_private($parent->ID); + } + else{ + return false; + } + } +} + +/** + * Register widget area. + * + * @link http://codex.wordpress.org/Function_Reference/register_sidebar + */ +function cs_widgets_init() { + require get_template_directory() . '/inc/reg-sidebars.php'; +} +add_action( 'widgets_init', 'cs_widgets_init' ); + +/** + * Enqueue scripts and styles. + */ +require get_template_directory() . '/inc/scripts-and-styles.php'; + +/** + * Browser hacks + */ +require get_template_directory() . '/inc/ie-hacks.php'; + +/** + * Private Pages + */ +require get_template_directory() . '/inc/private-pages.php'; + +/** + * Implement the Custom Header feature. + */ +require get_template_directory() . '/inc/custom-header.php'; + +/** + * Custom template tags for this theme. + */ +require get_template_directory() . '/inc/template-tags.php'; + +/** + * Custom functions that act independently of the theme templates. + */ +require get_template_directory() . '/inc/extras.php'; + +/** + * Customizer additions. + */ +require get_template_directory() . '/inc/customizer.php'; + +/** +* New versions of functions from Hale, added as includes +*/ +require get_template_directory() . '/inc/nav-walker.php'; + +/** +* Bootstrap the comment form. +*/ +require get_template_directory() . '/inc/bootstrap-forms.php'; + +/** +* Custom site settings +*/ +require get_template_directory() . '/inc/settings.php'; + +/** +* Bootstrap Whitelist +*/ +require get_template_directory() . '/inc/bootstrap-whitelist.php'; + + + + + + + +// Change what's hidden by default +add_filter('default_hidden_meta_boxes', 'be_hidden_meta_boxes', 10, 2); +function be_hidden_meta_boxes($hidden, $screen) { + if ( 'post' == $screen->base || 'page' == $screen->base ) + $hidden = array('slugdiv', 'trackbacksdiv', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); + // removed 'postcustom', + return $hidden; +} + + + +/*the fallback from wp_nav_menu, we want to replicate the output of wp_page_menu to be similar to wp_nav_menu +@param args, it comes from the wp_nav_menu arguments*/ +function hale_main_nav_fallback($args) { + $args['echo'] = 0; // don't echo the output yet. + $nav_menu = wp_page_menu($args); + if(!empty($nav_menu)){ + $doc = new DOMDocument(); + @$doc->loadHTML($nav_menu);//surpress the warnings + $data = $doc->getElementsByTagName('li'); + //the default behaviour of wp_page_menu is that it wraps the list items with a ul and div + //menu_class is for div in wp_page_menu, but is for the ul in wp_nav_menu + //create the container, if any + //container class and id come from wp_nav_menu arguments. Which is not used in wp_page_menu. + if($args['container'] != false) { + $attributes = (!empty($args['container_class'])?' class="'.$args['container_class'].'"':''); + $attributes .= (!empty($args['container_id'])?' id="'.$args['container_id'].'"':''); + if($args['container'] == 'nav') { + echo ''; + } else { + echo ''; + } + + } + $attributes = (!empty($args['menu_class'])?' class="'.$args['menu_class'].'"':''); + $attributes .= (!empty($args['menu_id'])?' id="'.$args['menu_id'].'"':''); + echo ''; + if($data->length > 0) { + foreach($data as $item) { + echo $item->ownerDocument->saveXML($item);//saveHTML wouldn't accept it as paramater. + } + } + echo ''; + //close the container, if any + if($args['container'] != false) { + if($args['container'] == 'nav') { + echo ''; + } else { + echo ''; + } + + } + } + return; +} + +function disable_comments_media_attachments( $open, $post_id ){ + $post = get_post_type( $post_id ); + if( $post == 'attachment' ) { + $open = false; + } + return $open; +} +add_filter('comments_open', 'disable_comments_media_attachments', 10 , 2); + +function metaslider_filmstrip_alt_tags( $list_item, $post, $url ) { + $alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); + $list_item = "
  • ID} post-{$post->ID}\" style=\"display: none;\">\"{$alt}
  • "; + return $list_item; +} +add_filter( 'metaslider_filmstrip_list_item', 'metaslider_filmstrip_alt_tags', 10, 3 ); + ?> \ No newline at end of file