'menu_item_parent', 'id' => 'db_id' ); function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent\n"; } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; /* Add active class */ if(in_array('current-menu-item', $classes)) { $classes[] = 'active'; unset($classes['current-menu-item']); } /* Check for children */ $children = get_posts(array('post_type' => 'nav_menu_item', 'nopaging' => true, 'numberposts' => 1, 'meta_key' => '_menu_item_menu_item_parent', 'meta_value' => $item->ID)); if (!empty($children)) { $classes[] = 'has-sub'; } $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } function end_el( &$output, $item, $depth = 0, $args = array() ) { $output .= "\n"; } } function dashboard_widgets_verwijderen(){ global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } add_action('wp_dashboard_setup', 'dashboard_widgets_verwijderen'); add_filter("gform_validation_message", "change_message", 10, 2); function change_message($message, $form){ $returnmsg = "
* Vul aub alle verplichte velden in. Verplichte velden zijn rood gemerkt.
"; return $returnmsg; } include_once('addons/jld-branding/jld-branding.php' ); include_once('addons/jld-reset-password/jld-reset-password.php' ); include_once('addons/btn-uitslagen/btn-uitslagen.php' ); add_action('init', 'cptui_register_my_cpt_sponsorgroup'); function cptui_register_my_cpt_sponsorgroup() { register_post_type('sponsorgroup', array( 'label' => 'Sponsorgroepen', 'description' => '', 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'capability_type' => 'page', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => array('slug' => 'sponsorgroup', 'with_front' => true), 'query_var' => true, 'supports' => array('title','thumbnail'), 'labels' => array ( 'name' => 'Sponsorgroepen', 'singular_name' => 'Sponsorgroep', 'menu_name' => 'Sponsorgroepen', 'add_new' => 'Add Sponsorgroep', 'add_new_item' => 'Add New Sponsorgroep', 'edit' => 'Edit', 'edit_item' => 'Edit Sponsorgroepen', 'new_item' => 'New Sponsorgroepen', 'view' => 'View Sponsorgroepen', 'view_item' => 'View Sponsorgroepen', 'search_items' => 'Search Sponsorgroepen', 'not_found' => 'No Sponsorgroepen Found', 'not_found_in_trash' => 'No Sponsorgroepen Found in Trash', 'parent' => 'Parent Sponsorgroep', ) )); } add_action('init', 'cptui_register_my_cpt_sponsor'); function cptui_register_my_cpt_sponsor() { register_post_type('sponsor', array( 'label' => 'Sponsors', 'description' => '', 'public' => false, 'show_ui' => true, 'show_in_menu' => "edit.php?post_type=sponsorgroup", // 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => array('slug' => 'sponsor', 'with_front' => true), 'query_var' => false, 'supports' => array('title','thumbnail'), 'labels' => array ( 'name' => 'Sponsors', 'singular_name' => 'Sponsor', 'menu_name' => 'Sponsors', 'add_new' => 'Add Sponsor', 'add_new_item' => 'Add New Sponsor', 'edit' => 'Edit', 'edit_item' => 'Edit Sponsor', 'new_item' => 'New Sponsor', 'view' => 'View Sponsor', 'view_item' => 'View Sponsor', 'search_items' => 'Search Sponsors', 'not_found' => 'No Sponsors Found', 'not_found_in_trash' => 'No Sponsors Found in Trash', 'parent' => 'Parent Sponsor', ) )); } // define( 'ACF_LITE' , true ); include_once('addons/advanced-custom-fields/acf.php' ); include_once('addons/acf-repeater/acf-repeater.php' ); if(function_exists("register_field_group")){ register_field_group(array ( 'id' => 'acf_sponsor-details', 'title' => 'Sponsor Details', 'fields' => array ( array ( 'key' => 'field_52b1c87fe066a', 'label' => 'Website', 'name' => 'sponsor_website', 'type' => 'text', 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'formatting' => 'none', 'maxlength' => '', ), array ( 'key' => 'field_52b1c8cee066b', 'label' => 'Actief', 'name' => 'sponsor_actief', 'type' => 'radio', 'required' => 1, 'choices' => array ( 'true' => 'Actief', 'false' => 'Niet actief', ), 'default_value' => 'true', 'layout' => 'horizontal', ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'sponsor', 'order_no' => 0, 'group_no' => 0, ), ), ), 'options' => array ( 'position' => 'acf_after_title', 'layout' => 'no_box', 'hide_on_screen' => array ( 0 => 'permalink', 1 => 'the_content', 2 => 'excerpt', 3 => 'custom_fields', 4 => 'discussion', 5 => 'comments', 6 => 'revisions', 7 => 'slug', 8 => 'author', 9 => 'format', 10 => 'categories', 11 => 'tags', 12 => 'send-trackbacks', ), ), 'menu_order' => 0, )); register_field_group(array ( 'id' => 'acf_sponsorgroep-inhoud', 'title' => 'Sponsorgroep Inhoud', 'fields' => array ( array ( 'key' => 'field_52b1cb0f5ff16', 'label' => 'Sponsors', 'name' => 'sponsors', 'type' => 'relationship', 'return_format' => 'object', 'post_type' => array ( 0 => 'sponsor', ), 'taxonomy' => array ( 0 => 'all', ), 'filters' => array ( 0 => 'search', ), 'result_elements' => array ( 0 => 'post_title', ), 'max' => '', ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'sponsorgroup', 'order_no' => 0, 'group_no' => 0, ), ), ), 'options' => array ( 'position' => 'normal', 'layout' => 'no_box', 'hide_on_screen' => array ( 0 => 'permalink', 1 => 'the_content', 2 => 'excerpt', 3 => 'custom_fields', 4 => 'discussion', 5 => 'comments', 6 => 'revisions', 7 => 'slug', 8 => 'author', 9 => 'format', 10 => 'categories', 11 => 'tags', 12 => 'send-trackbacks', ), ), 'menu_order' => 0, )); } // Register CSS for sponsor icon in admin menu add_action('admin_head', 'jld_bpr_pst_sponsors_icon'); function jld_bpr_pst_sponsors_icon() { echo " "; } // Register Custom Post Type function cptui_register_my_cpt_uitslag() { $labels = array( 'name' => _x( 'Uitslagen', 'Post Type General Name', 'jldbrabant' ), 'singular_name' => _x( 'Uitslag', 'Post Type Singular Name', 'jldbrabant' ), 'menu_name' => __( 'Uitslagen', 'jldbrabant' ), 'parent_item_colon' => __( 'Parent Item:', 'jldbrabant' ), 'all_items' => __( 'Alle Uitslagen', 'jldbrabant' ), 'view_item' => __( 'View Uitslag', 'jldbrabant' ), 'add_new_item' => __( 'Add New Uitslag', 'jldbrabant' ), 'add_new' => __( 'Add New', 'jldbrabant' ), 'edit_item' => __( 'Edit Uitslag', 'jldbrabant' ), 'update_item' => __( 'Update Uitslag', 'jldbrabant' ), 'search_items' => __( 'Search Uitslagen', 'jldbrabant' ), 'not_found' => __( 'Not found', 'jldbrabant' ), 'not_found_in_trash' => __( 'Not found in Trash', 'jldbrabant' ), ); $rewrite = array( 'slug' => 'uitslagen', 'with_front' => true, 'pages' => true, 'feeds' => true, ); $args = array( 'label' => __( 'uitslag', 'jldbrabant' ), 'description' => __( 'Uitslagen', 'jldbrabant' ), 'labels' => $labels, 'supports' => array( 'page-attributes','title', ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'menu_icon' => '', 'can_export' => false, 'has_archive' => true, 'exclude_from_search' => true, 'publicly_queryable' => true, 'rewrite' => $rewrite, 'capability_type' => 'page', ); register_post_type( 'uitslag', $args ); } add_action( 'init', 'cptui_register_my_cpt_uitslag', 0 ); // Register Custom Post Type function cptui_register_my_cpt_uitslag_club() { $labels = array( 'name' => _x( 'Clubs', 'Post Type General Name', 'jldbrabant' ), 'singular_name' => _x( 'Club', 'Post Type Singular Name', 'jldbrabant' ), 'menu_name' => __( 'Clubs', 'jldbrabant' ), 'parent_item_colon' => __( 'Parent Item:', 'jldbrabant' ), 'all_items' => __( 'Clubs', 'jldbrabant' ), 'view_item' => __( 'View Club', 'jldbrabant' ), 'add_new_item' => __( 'Add New Club', 'jldbrabant' ), 'add_new' => __( 'Add New', 'jldbrabant' ), 'edit_item' => __( 'Edit Club', 'jldbrabant' ), 'update_item' => __( 'Update Club', 'jldbrabant' ), 'search_items' => __( 'Search Clubs', 'jldbrabant' ), 'not_found' => __( 'Not found', 'jldbrabant' ), 'not_found_in_trash' => __( 'Not found in Trash', 'jldbrabant' ), ); $args = array( 'label' => __( 'uitslag_club', 'jldbrabant' ), 'description' => __( 'Clubs', 'jldbrabant' ), 'labels' => $labels, 'supports' => array( 'title', ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => "edit.php?post_type=uitslag", 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'menu_icon' => '', 'can_export' => false, 'has_archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'uitslag_club', $args ); } add_action( 'init', 'cptui_register_my_cpt_uitslag_club', 0 ); // Change sort order in Uitslagen archive function wpa_66507( $query ) { if ( is_post_type_archive('uitslag') && is_main_query() ) { //where 'nasc_report' is assumed to be your post type name set_query_var( 'orderby', 'menu_order' ); set_query_var( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'wpa_66507' ); // Add Shortcode function shortdoce_uitslag( $atts ) { // Attributes extract( shortcode_atts(array('id' => '1',), $atts )); $output = ""; $outputTop = " "; $outputBottom = "
NR Thuis Uit Uitslag Datum Tijd Scheidsrechter
"; $outputContent = ""; $outputTitle = ""; $args = array ( 'post_type' => 'uitslag', 'page_id' => $id, ); $query = new WP_Query( $args ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); $outputTitle = "

" . get_the_title() . "

"; if( have_rows('uitslagen') ): while ( have_rows('uitslagen') ) : the_row(); $nr = get_sub_field('nr'); $club_thuis = get_sub_field('club_thuis')->post_title; $club_thuis_goals = get_sub_field('club_thuis_goals'); $club_uit = get_sub_field('club_uit')->post_title; $club_uit_goals = get_sub_field('club_uit_goals'); $datum = ""; $dateX = ""; if(get_sub_field('datum') != "") { $datum = get_sub_field('datum'); $date = date_create($datum); $dateX = $date->format("d M."); } $tijd = get_sub_field('tijd'); $scheids = get_sub_field('scheidsrechter'); if($club_thuis_goals > $club_uit_goals) { $club_thuis = "" . $club_thuis . ""; } if($club_uit_goals > $club_thuis_goals) { $club_uit = "" . $club_uit . ""; } $outputContent .= " {$nr} {$club_thuis} {$club_uit} {$club_thuis_goals}-{$club_uit_goals} {$dateX} {$tijd} {$scheids} "; endwhile; else : // no rows found endif; } } else { $outputContent = "Not found!"; // no posts found } wp_reset_postdata(); return $outputTitle . $outputTop . $outputContent . $outputBottom; } add_shortcode( 'uitslag', 'shortdoce_uitslag' ); ?>