ildi-wp/functions.php

98 lines
3.2 KiB
PHP
Raw Normal View History

2018-07-18 08:03:46 -05:00
<?php
2018-08-07 15:49:34 -05:00
require_once( __DIR__ . '/includes/supporters-widget.php');
2018-07-18 08:03:46 -05:00
if (function_exists('add_theme_support')) {
2018-07-19 21:03:42 -05:00
add_theme_support('automatic-feed-links');
2018-07-18 08:03:46 -05:00
add_theme_support('post-thumbnails');
// add_image_size('large', 700, '', true);
// add_image_size('medium', 250, '', true);
// add_image_size('small', 120, '', true);
// add_image_size('custom-size', 700, 200, true); // call using the_post_thumbnail('custom-size');
2018-07-19 21:03:42 -05:00
$customHeaderArgs = array(
2018-07-26 21:36:17 -05:00
'default-image' => get_template_directory_uri() . '/images/default-header.jpg',
2018-07-19 21:03:42 -05:00
'width' => 1800,
'height' => 260,
'flex-height' => true,
'flex-width' => true,
'uploads' => true,
'header-text' => true,
);
add_theme_support( 'custom-header', $customHeaderArgs );
2018-07-24 18:52:51 -05:00
add_theme_support( 'html5', array( 'search-form' ) );
2018-07-18 08:03:46 -05:00
}
function ildi_nav($location='header-menu') {
wp_nav_menu(
array(
'theme_location' => $location,
'menu' => '',
'container' => '',
'container_class' => '',
'container_id' => '',
'menu_class' => $location,
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul class="%2$s">%3$s</ul>',
'depth' => 0,
'walker' => ''
)
);
}
2018-07-24 08:20:35 -05:00
function ildi_styles() {
wp_register_style('ildi', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');
wp_enqueue_style('ildi');
}
2018-07-18 08:03:46 -05:00
function register_ildi_menus() {
register_nav_menus(array(
'header-menu' => __('Header Menu', 'ildi'),
2018-10-07 14:41:41 -05:00
'utility-menu' => __('Utility Links', 'ildi'),
2018-11-11 23:27:09 -06:00
'homepage-list' => __('HomePage List', 'ildi')
2018-07-18 08:03:46 -05:00
));
}
2018-08-06 08:53:22 -05:00
function ildi_register_sidebars() {
2018-08-07 15:49:34 -05:00
// 'description' => __( 'This is the sponsor and partner logos section of the footer and should display a "Sponsors" widget.', 'ildi' ),
2018-08-06 08:53:22 -05:00
register_sidebar(
array(
'id' => 'footer-sponsors',
'name' => __( 'Footer Sponsors', 'ildi' ),
'description' => __( 'This is the sponsor and partner logos section of the footer.', 'ildi' ),
2018-08-07 15:49:34 -05:00
'before_widget' => '<div class="widget %2$s">',
'after_widget' => '</div>',
2018-08-06 08:53:22 -05:00
'before_title' => '<h1>',
'after_title' => '</h1>',
)
);
}
2018-07-18 08:03:46 -05:00
2018-09-10 08:58:30 -05:00
function ildi_nav_remove_empty_terms ( $items, $menu, $args ) {
global $wpdb;
$empty = $wpdb->get_col( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE count = 0" );
foreach ( $items as $key => $item ) {
if ( ( 'taxonomy' == $item->type ) && ( in_array( $item->object_id, $empty ) ) ) {
unset( $items[$key] );
}
}
return $items;
}
add_filter( 'wp_get_nav_menu_items', 'ildi_nav_remove_empty_terms', 10, 3 );
2018-07-18 08:03:46 -05:00
// add_action('init', 'register_ildi_menu');
add_action( 'after_setup_theme', 'register_ildi_menus', 0 );
2018-08-06 08:53:22 -05:00
add_action( 'wp_enqueue_scripts', 'ildi_styles' );
add_action( 'widgets_init', 'ildi_register_sidebars');
2018-08-07 15:49:34 -05:00
// add_action( 'widgets_init', function() { register_widget( 'Sponsors_Widget' ); } );
2018-07-18 08:03:46 -05:00
?>