/** * Radiate Child functions and definitions * * @package ThemeGrill * @subpackage Radiate Child (Noble) * @since Radiate 1.0 */ function my_home_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '10'); } } add_action( 'pre_get_posts', 'my_home_category' ); function search_filter( $query ) { if ( $query->is_search && $query->is_main_query() ) { $query->set( 'post__not_in', array( 218 ) ); } } function new_excerpt_more( $more ) { return ' ... ' . __('Read More ยป', 'your-text-domain') . ''; } add_filter( 'excerpt_more', 'new_excerpt_more' ); function twentytwenty_register_styles() { $theme_version = wp_get_theme()->get( 'Version' ); // Add CSS. wp_enqueue_style( 'twentytwenty-fonts-css', 'https://use.typekit.net/xix7wru.css', null, $theme_version, 'all' ); wp_enqueue_style( 'twentytwenty-lity-css', get_stylesheet_directory_uri() . '/css/lity.min.css', null, $theme_version, '' ); wp_enqueue_style( 'twentytwenty-home', get_stylesheet_directory_uri() . '/css/home.css', null, $theme_version, '' ); wp_enqueue_style( 'twentytwenty-about', get_stylesheet_directory_uri() . '/css/about.css', null, $theme_version, '' ); wp_enqueue_style( 'twentytwenty-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.css', null, $theme_version, '' ); wp_deregister_script( 'radiate-navigation' ); wp_dequeue_script('radiate-navigation'); wp_enqueue_script( 'twentytwenty-lity-js', get_stylesheet_directory_uri() . '/js/lity.min.js', array(), '2.4.1', false ); wp_enqueue_script( 'twentytwenty-custom', get_stylesheet_directory_uri() . '/js/custom.js', array(), $theme_version, false ); wp_script_add_data( 'twentytwenty-custom', 'async', true ); } add_action( 'wp_enqueue_scripts', 'twentytwenty_register_styles' ); add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 ); function your_custom_menu_item ( $items, $args ) { if ($args->theme_location == 'primary') { $items .= ''; } return $items; } function my_custom_sidebar() { register_sidebar( array ( 'name' => __( 'Footer', 'your-theme-domain' ), 'id' => 'footer-side-bar', 'description' => __( 'Custom Sidebar', 'your-theme-domain' ), 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'my_custom_sidebar' ); function custom_post_type() { $sortOrder = 5; // Set UI labels for Custom Post Type $labels = array( 'name' => _x('Events', 'Post Type General Name', 'tbwdf'), 'singular_name' => _x('Event', 'Post Type Singular Name', 'tbwdf'), 'menu_name' => __('Events', 'tbwdf'), 'parent_item_colon' => __('Parent ' . 'Event', 'tbwdf'), 'all_items' => __('All ' . 'Events', 'tbwdf'), 'view_item' => __('View ' . 'Event', 'tbwdf'), 'add_new_item' => __('Add New ' . 'Event', 'tbwdf'), 'add_new' => __('Add New', 'tbwdf'), 'edit_item' => __('Edit ' . 'Event', 'tbwdf'), 'update_item' => __('Update ' . 'Event', 'tbwdf'), 'search_items' => __('Search ' . 'Event', 'tbwdf'), 'not_found' => __('Not Found', 'tbwdf'), 'not_found_in_trash' => __('Not found in Trash', 'tbwdf'), ); // Set other options for Custom Post Type $args = array( 'label' => __('Event', 'tbwdf'), 'description' => __('Event', 'tbwdf'), 'labels' => $labels, 'taxonomies' => array('event_category'), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_rest' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => $sortOrder++, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'post', "rewrite" => array("slug" => 'event', "with_front" => true), "query_var" => true, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'custom-fields'), "rest_controller_class" => "WP_REST_Posts_Controller", ); register_taxonomy( 'event_category', 'event', array( 'label' => __('Category'), "public" => true, "publicly_queryable" => true, "hierarchical" => true, "show_ui" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "query_var" => true, 'rewrite' => array('slug' => 'event_category', 'with_front' => true), "show_in_rest" => true, "rest_base" => 'event_category', "rest_controller_class" => "WP_REST_Terms_Controller", "show_in_quick_edit" => false, ) ); // Registering your Custom Post Type register_post_type('event', $args); } add_action('init', 'custom_post_type', 0); // require get_template_directory() . '/inc/custom-post-type.php'; ?>