slug}.php") ) { return TEMPLATEPATH . "/single-{$cat->slug}.php"; } } return $t; } //COMMENTED //Changed "none" to "null" function add_category_to_single($classes, $class = null) { if (is_single() ) { global $post; foreach((get_the_category($post->ID)) as $category) { // add category slug to the $classes array $classes[] = $category->category_nicename; } } // return the $classes array return $classes; } add_filter('page_css_class', 'my_css_attributes_filter', 100, 2); function my_css_attributes_filter($classes, $page){ global $post; $activeNav = false; if (!is_home()) { $category_holder = get_field('category_holder', $page->ID); foreach((get_the_category($post->ID)) as $category) { // add category slug to the $classes array if ($category->category_nicename == $category_holder) { $activeNav = true; } } if ($activeNav) { $classes[] = "active"; } return $classes; } } add_filter( 'tiny_mce_before_init', 'unhide_kitchensink' ); function unhide_kitchensink( $args ) { $args['wordpress_adv_hidden'] = false; return $args; } /** * Sets up the content width value based on the theme's design and stylesheet. */ if ( ! isset( $content_width ) ) $content_width = 625; /** * Sets up theme defaults and registers the various WordPress features that * Transparency International supports. * * @uses load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To add a Visual Editor stylesheet. * @uses add_theme_support() To add support for post thumbnails, automatic feed links, * custom background, and post formats. * @uses register_nav_menu() To add support for navigation menus. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since Transparency International 1.0 */ function ti_international_setup() { /* * Makes Transparency International available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on Transparency International, use a find and replace * to change 'ti_international' to the name of your theme in all the template files. */ load_theme_textdomain( 'ti_international', get_template_directory() . '/languages' ); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // Adds RSS feed links to
for posts and comments. add_theme_support( 'automatic-feed-links' ); // This theme supports a variety of post formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Primary Menu', 'ti_international' ) ); register_nav_menu( 'footer', __( 'Footer Menu', 'ti_international' ) ); /* * This theme supports custom background color and image, and here * we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', ) ); // This theme uses a custom image size for featured images, displayed on "standard" posts. add_theme_support( 'post-thumbnails' ); add_image_size( 'event', 280 ); add_image_size( 'featured', 605 ); add_image_size( 'slide', 698, 345, true ); add_image_size( 'publication', 116, 164, true ); add_image_size( 'block-thumb', 300, 300, true ); set_post_thumbnail_size( 160, 160, true ); update_option('medium_size_w', 280, true); } add_action( 'after_setup_theme', 'ti_international_setup' ); /** * Adds support for a custom header image. */ require( get_template_directory() . '/inc/custom-header.php' ); /** * Enqueues scripts and styles for front-end. * * @since Transparency International 1.0 */ function ti_international_scripts_styles() { global $wp_styles; /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); /* * Adds JavaScript for handling the navigation menu hide-and-show behavior. */ wp_enqueue_script( 'ti_international-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true ); /* * Loads our special font CSS file. * * The use of Open Sans by default is localized. For languages that use * characters not supported by the font, the font can be disabled. * * To disable in a child theme, use wp_dequeue_style() * function mytheme_dequeue_fonts() { * wp_dequeue_style( 'ti_international-fonts' ); * } * add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_fonts', 11 ); */ /* translators: If there are characters in your language that are not supported by Open Sans, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'ti_international' ) ) { $subsets = 'latin,latin-ext'; /* translators: To add an additional Open Sans character subset specific to your language, translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */ $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'ti_international' ); if ( 'cyrillic' == $subset ) $subsets .= ',cyrillic,cyrillic-ext'; elseif ( 'greek' == $subset ) $subsets .= ',greek,greek-ext'; elseif ( 'vietnamese' == $subset ) $subsets .= ',vietnamese'; $protocol = is_ssl() ? 'https' : 'http'; $query_args = array( 'family' => 'Open+Sans:400italic,700italic,400,700', 'subset' => $subsets, ); wp_enqueue_style( 'ti_international-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null ); } /* * Loads our main stylesheet. */ wp_enqueue_style( 'transparency_international', get_stylesheet_uri() ); /* * Loads the Internet Explorer specific stylesheet. */ wp_enqueue_style( 'ti_international-ie', get_template_directory_uri() . '/css/ie.css', array( 'ti_international-style' ), '20121010' ); $wp_styles->add_data( 'ti_international-ie', 'conditional', 'lt IE 9' ); } //add_action( 'wp_enqueue_scripts', 'ti_international_scripts_styles' ); /** * Creates a nicely formatted and more specific title element text * for output in head of document, based on current view. * * @since Transparency International 1.0 * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string Filtered title. */ function ti_international_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'ti_international' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'ti_international_wp_title', 10, 2 ); /** * Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link. * * @since Transparency International 1.0 */ function ti_international_page_menu_args( $args ) { if ( ! isset( $args['show_home'] ) ) $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'ti_international_page_menu_args' ); /** * Registers our main widget area and the front page widget areas. * * @since Transparency International 1.0 */ function ti_international_widgets_init() { register_sidebar( array( 'name' => __( 'Main Sidebar', 'ti_international' ), 'id' => 'sidebar-1', 'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'ti_international' ), 'before_widget' => '', 'before_title' => '', '' ); ?>
'.$desc.'':''; } function my_theme_menu() { add_options_page( 'Theme options', 'TI Theme', 'manage_options', 'ti_theme', 'ti_options_page'); } function ti_options_page() { ?>
Transparency International Theme
Custom settings relating to the TI theme.', 'after_title' => '
', ) ); register_sidebar( array( 'name' => __( 'Membership Form Sidebar', 'ti_international' ), 'id' => 'membership-form', 'description' => __( 'Appears on membership application form pages' ), 'before_widget' => '', 'after_widget' => '
', 'after_title' => '
', ) ); /* BREAD CRUMBS */ function the_breadcrumb() { global $post; if (!is_front_page()) { echo ''; echo '- ';
echo 'Home';
echo '
- /
';
if (is_category() || is_single()) {
echo '- ';
the_category('
- /
- ');
if (is_single()) {
echo '
- /
- ';
the_title();
echo '
';
}
} elseif (is_page()) {
if($post->post_parent){
$anc = get_post_ancestors( $post->ID );
$title = get_the_title();
foreach ( $anc as $ancestor ) {
$output = '- '.get_the_title($ancestor).'
- /
';
}
echo $output;
echo ' '.$title.'';
} else {
echo '- '.get_the_title().'
';
}
}
}
elseif (is_tag()) {single_tag_title();}
elseif (is_day()) {echo"- Archive for "; the_time('F jS, Y'); echo'
';}
elseif (is_month()) {echo"- Archive for "; the_time('F, Y'); echo'
';}
elseif (is_year()) {echo"- Archive for "; the_time('Y'); echo'
';}
elseif (is_author()) {echo"- Author Archive"; echo'
';}
elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "- Blog Archives"; echo'
';}
elseif (is_search()) {echo"- Search Results"; echo'
';}
echo '
'; } function breadcrump_page( $post ) { echo ''; $format = '- %s
- /
';
$anc = array_map( 'get_post', array_reverse( (array) get_post_ancestors( $post ) ) );
$links = array_map( 'get_permalink', $anc );
foreach ( $anc as $i => $apost ) {
$title = apply_filters( 'the_title', $apost->post_title );
printf( $format, $links[$i], esc_attr($title), esc_html($title) );
}
echo apply_filters( 'the_title', $post->post_title );
echo '
'; } ///// MEMBERS ONLY SECTION ///// add_filter( 'wpmem_block', 'block_minutes_archive' ); add_filter( 'wpmem_login_form', 'my_login_form_filter', 10, 2); function my_login_form_filter( $form, $action ) { return $form; } function block_minutes_archive( $block ) { get_post_type(); if (is_page_template('page-minutes.php') || is_singular( 'minutes') ) { $block = true; } else { $block = false; } return $block; } /* * Creating a function to create our CPT */ function custom_post_type() { // Set UI labels for Custom Post Type $labels = array( 'name' => _x( 'Meeting Minutes', 'Post Type General Name', 'twentythirteen' ), 'singular_name' => _x( 'Minutes', 'Post Type Singular Name', 'twentythirteen' ), 'menu_name' => __( 'Board Members Section', 'twentythirteen' ), 'parent_item_colon' => __( 'Parent Minutes', 'twentythirteen' ), 'all_items' => __( 'All Minutes', 'twentythirteen' ), 'view_item' => __( 'View Minutes', 'twentythirteen' ), 'add_new_item' => __( 'Add New Minutes', 'twentythirteen' ), 'add_new' => __( 'Add New', 'twentythirteen' ), 'edit_item' => __( 'Edit Minutes', 'twentythirteen' ), 'update_item' => __( 'Update Minutes', 'twentythirteen' ), 'search_items' => __( 'Search Minutes', 'twentythirteen' ), 'not_found' => __( 'Not Found', 'twentythirteen' ), 'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ), ); // Set other options for Custom Post Type $args = array( 'label' => __( 'minutes', 'twentythirteen' ), 'description' => __( 'Meeting Minutes & Documents', 'twentythirteen' ), 'labels' => $labels, // Features this CPT supports in Post Editor 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ), // You can associate this CPT with a taxonomy or custom taxonomy. //'taxonomies' => array( 'genres' ), /* A hierarchical CPT is like Pages and can have * Parent and child items. A non-hierarchical CPT * is like Posts. */ 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => true, 'capability_type' => 'post', ); // Registering your Custom Post Type register_post_type( 'minutes', $args ); } /* Hook into the 'init' action so that the function * Containing our post type registration is not * unnecessarily executed. */ add_action( 'init', 'custom_post_type', 0 );