posts . " WHERE post_status='inherit' AND post_parent = 122 AND (post_mime_type = 'image/jpeg' OR post_mime_type = 'image/gif' OR post_mime_type = 'image/png') ORDER BY menu_order LIMIT 10"; $posts = $wpdb->get_results($sql); $i=1; $temp .= '
'; foreach ($posts as $post){ $temp .= ''.$post->post_title.''; if($i==2){ $i=1; }else{ $i++; } } $temp .= '
'; $temp .= '
'; return $temp; } function dej_team($lang){ global $wpdb; $posts = $wpdb->get_results("SELECT post_content, ID, post_title FROM ".$wpdb->posts." WHERE post_status = 'publish' AND post_type = 'team' ORDER BY post_date ASC LIMIT 200"); $i=1; $team_pos = 'l'; foreach ($posts as $post){ if($post->post_content){ if($lang == 'en'){ $content = apply_filters('the_content', get_field('obsah_en',$post->ID)); }else{ $content = apply_filters('the_content', $post->post_content); } $hover = 'hover'; }else{ $content = ''; $hover = ''; } if($lang == 'en'){ $pozice = get_field('text_pod_jmenem_en',$post->ID); }else{ $pozice = get_field('text_pod_jmenem',$post->ID); } $temp .= '
'.$post->post_title.'

'.$post->post_title.'

'.$pozice.'

'.get_field('telefon_2',$post->ID).'

'.get_field('telefon',$post->ID).'

'.get_field('email',$post->ID).'

'; if($content){ $temp .= ' '; $temp .=''; } if($team_pos == 'l'){$team_pos = 'r';} elseif($team_pos == 'r'){$team_pos = 'l';$temp .= '
';} $i++; } $temp .= '
'; return $temp; } function dej_clanky($lang){ global $wpdb; $posts = $wpdb->get_results("SELECT post_date, post_content, ID, post_title FROM ".$wpdb->posts." WHERE post_status = 'publish' AND post_type = 'clanky' ORDER BY post_date DESC LIMIT 0,2"); $i=1; foreach ($posts as $post){ if($lang == 'en'){ //$title = get_field('titulek_en',$post->ID); //$content = get_field('anotace',$post->ID); $title = $post->post_title; $content = apply_filters('the_content', get_field('anotace',$post->ID)); $podnadpis = get_field('podnadpis',$post->ID); $datum = get_the_date('d. m. Y',$post->ID);//the_date('d. m. Y'); $cely = 'Source'; $pdf_text = 'Download PDF'; }else{ $title = $post->post_title; $content = apply_filters('the_content', get_field('anotace',$post->ID)); $podnadpis = get_field('podnadpis',$post->ID); $datum = get_the_date('d. n. Y',$post->ID);//the_date('d. m. Y'); $cely = 'Zdroj'; $pdf_text = 'Stáhnout PDF'; } $pdf = get_field('soubor',$post->ID)[url]; $odkaz = get_field('odkaz',$post->ID); if($i==1){ $temp .= '
'; }else{ $temp .= '
'; } $odkazin = ''; $celyp= ''; if($odkaz || $pdf){ if($odkaz){ $odkazin = ''.$cely.''; } if($pdf){ $pdf = '      '.$pdf_text.''; } $celyp = '

'.$odkazin.''.$pdf.'

'; } $temp .= '

'.$title.'

'.$datum.'   I   '.$podnadpis.'

'.$content.' '.$celyp.'
'; $i++; } $sql = "SELECT post_date, post_content, ID, post_title FROM ".$wpdb->posts." WHERE post_status = 'publish' AND post_type = 'clanky' ORDER BY post_date DESC LIMIT 2,2"; //echo $sql; $posts2 = $wpdb->get_results($sql); $i=1; foreach ($posts2 as $post2){ $temp2 = 1; } if(!$temp2){ $temp .= " "; } return $temp; } function dej_sluzby_i($lang){ global $wpdb; $posts = $wpdb->get_results("SELECT post_content, ID, post_title FROM ".$wpdb->posts." WHERE post_status = 'publish' AND post_type = 'info' ORDER BY post_date ASC LIMIT 200"); $i=1; foreach ($posts as $post){ if($lang == 'en'){ $title = get_field('titulek_en',$post->ID); $content = get_field('obsah_en',$post->ID); }else{ $title = $post->post_title; $content = $post->post_content; } $temp_popis = ''; $scont = ''; if($post->post_content){ $temp_popis ='
'.apply_filters('the_content', $content).'
'; $scont = 'scont'; } $temp .='

'.$title.'

'.$temp_popis; if($temp_popis){ $temp .=' '; } $i++; } return $temp; } function dej_sluzby($lang){ global $wpdb; $posts = $wpdb->get_results("SELECT post_content, ID, post_title FROM ".$wpdb->posts." WHERE post_status = 'publish' AND post_type = 'sluzby' ORDER BY post_date ASC LIMIT 200"); $i=1; foreach ($posts as $post){ if($lang == 'en'){ $title = get_field('titulek_en',$post->ID); $content = get_field('obsah_en',$post->ID); }else{ $title = $post->post_title; $content = $post->post_content; } $temp_popis = ''; $scont = ''; if($post->post_content){ $temp_popis ='
'.apply_filters('the_content', $content).'
'; $scont = 'scont'; } $temp .='

'.$title.'

'.$temp_popis; if($temp_popis){ $temp .=' '; } $i++; } return $temp; } function wpse_81939_post_types_admin_order( $wp_query ) { if (is_admin()) { // Get the post type from the query $post_type = $wp_query->query['post_type']; if ( $post_type == 'clanky' ||$post_type == 'clanky-drobecky' ) { $wp_query->set('orderby', 'post_date'); $wp_query->set('order', 'DESC'); } if ($post_type == 'sluzby' ) { $wp_query->set('orderby', 'post_date'); $wp_query->set('order', 'ASC'); } } } add_filter('pre_get_posts', 'wpse_81939_post_types_admin_order'); function customs_post_type() { $labels = array( 'name' => _x( 'Články', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Články', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Články', 'text_domain' ), 'parent_item_colon' => __( 'Články - nadřazená:', 'text_domain' ), 'all_items' => __( 'Všechny články', 'text_domain' ), 'view_item' => __( 'Zobrazit článek', 'text_domain' ), 'add_new_item' => __( 'Přidat článek', 'text_domain' ), 'add_new' => __( 'Nový článek', 'text_domain' ), 'edit_item' => __( 'Upravit článek', 'text_domain' ), 'update_item' => __( 'Update článek', 'text_domain' ), 'search_items' => __( 'Hledej článek', 'text_domain' ), 'not_found' => __( 'Žádné články', 'text_domain' ), 'not_found_in_trash' => __( 'Žádné články v koši', 'text_domain' ), ); $args = array( 'label' => __( 'clanky', 'text_domain' ), 'description' => __( 'Product information pages', 'text_domain' ), 'labels' => $labels, //'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', ), 'supports' => array( 'title', 'editor' ), //'taxonomies' => array( 'category', 'post_tag' ), // 'taxonomies' => array( 'category'), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 10, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', 'rewrite' => array('slug' => 'clanky','with_front' => false) ); register_post_type( 'clanky', $args ); $labels = array( 'name' => _x( 'Služby', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Služby', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Služby', 'text_domain' ), 'parent_item_colon' => __( 'Služby - nadřazená:', 'text_domain' ), 'all_items' => __( 'Všechny Služby', 'text_domain' ), 'view_item' => __( 'Zobrazit Služby', 'text_domain' ), 'add_new_item' => __( 'Přidat Službu', 'text_domain' ), 'add_new' => __( 'Nová Služba', 'text_domain' ), 'edit_item' => __( 'Upravit Služby', 'text_domain' ), 'update_item' => __( 'Update Služby', 'text_domain' ), 'search_items' => __( 'Hledej Služby', 'text_domain' ), 'not_found' => __( 'Žádné Služby', 'text_domain' ), 'not_found_in_trash' => __( 'Žádné Služby v koši', 'text_domain' ), ); $args = array( 'label' => __( 'sluzby', 'text_domain' ), 'description' => __( 'Product information pages', 'text_domain' ), 'labels' => $labels, //'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', ), 'supports' => array( 'title', 'editor' ), //'taxonomies' => array( 'category', 'post_tag' ), 'taxonomies' => array( ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 10, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'sluzby', $args ); $labels = array( 'name' => _x( 'Info', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Info', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Info', 'text_domain' ), 'parent_item_colon' => __( 'Info - nadřazená:', 'text_domain' ), 'all_items' => __( 'Všechny Info', 'text_domain' ), 'view_item' => __( 'Zobrazit Info', 'text_domain' ), 'add_new_item' => __( 'Přidat Info', 'text_domain' ), 'add_new' => __( 'Nové Info', 'text_domain' ), 'edit_item' => __( 'Upravit Info', 'text_domain' ), 'update_item' => __( 'Update Info', 'text_domain' ), 'search_items' => __( 'Hledej Info', 'text_domain' ), 'not_found' => __( 'Žádné Info', 'text_domain' ), 'not_found_in_trash' => __( 'Žádné Info v koši', 'text_domain' ), ); $args = array( 'label' => __( 'info', 'text_domain' ), 'description' => __( 'Product information pages', 'text_domain' ), 'labels' => $labels, //'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', ), 'supports' => array( 'title', 'editor' ), //'taxonomies' => array( 'category', 'post_tag' ), 'taxonomies' => array( ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 10, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'info', $args ); $labels = array( 'name' => _x( 'Team', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Team', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Team', 'text_domain' ), 'parent_item_colon' => __( 'Nadřazený Team:', 'text_domain' ), 'all_items' => __( 'Všechny Team', 'text_domain' ), 'view_item' => __( 'Zobrazit Team', 'text_domain' ), 'add_new_item' => __( 'Přidat nový Team', 'text_domain' ), 'add_new' => __( 'Nový Team', 'text_domain' ), 'edit_item' => __( 'Upravit Team', 'text_domain' ), 'update_item' => __( 'Update Team', 'text_domain' ), 'search_items' => __( 'Hledej Team', 'text_domain' ), 'not_found' => __( 'Žádný Team', 'text_domain' ), 'not_found_in_trash' => __( 'Žádný Team v koši', 'text_domain' ), ); $args = array( 'label' => __( 'team', 'text_domain' ), 'description' => __( 'Product information pages', 'text_domain' ), 'labels' => $labels, //'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', ), 'supports' => array( 'title', 'editor' ), //'taxonomies' => array( 'category', 'post_tag' ), 'taxonomies' => array( ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 10, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'capability_type' => 'page', ); register_post_type( 'team', $args ); } add_action( 'init', 'customs_post_type', 0 ); ?>