',$title); } function my_acf_format_value( $value, $post_id, $field ) { return str_replace('||','
',$value); } add_filter('acf/format_value/type=text', 'my_acf_format_value', 10, 3); add_filter('og_image_init', 'my_og_image_init'); function my_og_image_init($images) { if ( empty($images) ) { $ogimage= get_field('ogimage','options'); if ($ogimage) $images[]=$ogimage['sizes']['large']; } return $images; } function limit_home_posts( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'posts_per_page', 12 ); } } add_action( 'pre_get_posts', 'limit_home_posts' ); if (class_exists('WPLessPlugin')){ error_log('less'); $less = WPLessPlugin::getInstance(); $less->addVariable('kolor', '#003cff'); $less->addVariable('blenda', '#241206'); if (get_blog_slug()=='festiwal') { $less->setVariables(array( 'kolor'=>'#E00045' )); } if (get_blog_slug()=='transformacja') { $less->setVariables(array( 'kolor'=>'#000050' )); } if (get_blog_slug()=='changenow') { $less->setVariables(array( 'kolor'=>'#ec008c' )); } if (get_blog_slug()=='tcn') { $less->setVariables(array( 'kolor'=>'#611e00' )); } } function get_blog_slug() { $b=get_blog_details(); return preg_replace('/\..*/','',$b->domain); } add_filter('body_class','msz_multisite_identifier'); function msz_multisite_identifier($classes) { $classes[]='site-'.get_blog_slug(); return $classes; } add_filter('get_the_archive_title',function($title) { return preg_replace('/.*:/','',$title); }); if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_5936cb2ea7aa7', 'title' => 'Stopka serwisu', 'fields' => array ( array ( 'key' => 'field_5936cb42cc92a', 'label' => 'Treść stopki', 'name' => 'footer', 'type' => 'textarea', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'default_value' => '', 'placeholder' => '', 'maxlength' => '', 'rows' => '', 'new_lines' => '', ), ), 'location' => array ( array ( array ( 'param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-strona-domowa', ), ), ), 'menu_order' => 110, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_592ec76ded3b8', 'title' => 'Komunikat specjalny (popup na stronie domowej)', 'fields' => array ( array ( 'key' => 'field_592ec797d411a', 'label' => 'Wybierz wpis z komunikatem', 'name' => 'kominikat_awaryjny_post', 'type' => 'relationship', 'instructions' => 'W okienku pojawi się tytuł wpisu i lead oraz guzik \'czytaj więcej\' przenoszący do wpisu. Ważne: zadbaj o to, żeby wybrany wpis miał uzupełniony lead.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'post_type' => array ( 0 => 'post', ), 'taxonomy' => array ( ), 'filters' => array ( 0 => 'search', ), 'elements' => array ( 0 => 'featured_image', ), 'min' => '', 'max' => 1, 'return_format' => 'object', ), ), 'location' => array ( array ( array ( 'param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-strona-domowa', ), ), ), 'menu_order' => 100, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_592e9ca9e9aab', 'title' => 'Obrazek dla facebooka', 'fields' => array ( array ( 'key' => 'field_592e9cdcf6768', 'label' => 'Obrazek facebook', 'name' => 'ogimage', 'type' => 'image', 'instructions' => 'Ten obrazek pojawi się na facebooku kiedy udostępniona zostanie strona domowa albo strona bez żadnego obrazka', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'return_format' => 'array', 'preview_size' => 'thumbnail', 'library' => 'all', 'min_width' => '', 'min_height' => '', 'min_size' => '', 'max_width' => '', 'max_height' => '', 'max_size' => '', 'mime_types' => '', ), ), 'location' => array ( array ( array ( 'param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-strona-domowa', ), ), ), 'menu_order' => 0, 'position' => 'side', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_59284a8e21d0f', 'title' => 'Załączniki', 'fields' => array ( array ( 'key' => 'field_59284a937d4e6', 'label' => 'Załączniki - pliki do pobrania', 'name' => 'attachments', 'type' => 'repeater', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'collapsed' => '', 'min' => 0, 'max' => 0, 'layout' => 'table', 'button_label' => 'Dodaj załącznik', 'sub_fields' => array ( array ( 'key' => 'field_59284ab77d4e7', 'label' => 'Plik', 'name' => 'file', 'type' => 'file', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'return_format' => 'array', 'library' => 'all', 'min_size' => '', 'max_size' => '', 'mime_types' => '', ), array ( 'key' => 'field_59284ac47d4e8', 'label' => 'Nazwa załącznika', 'name' => 'title', 'type' => 'text', 'instructions' => 'Opcjonalnie. Jeżeli jej nie podasz, wyświetlona zostanie nazwa pliku', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', ), ), ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'post', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'page', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'spektakl', ), ), ), 'menu_order' => 10, 'position' => 'normal', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_592589c552c8c', 'title' => 'Layout nagłówka', 'fields' => array ( array ( 'key' => 'field_59258a0859a4d', 'label' => 'Rozmiar obrazka w nagłówku', 'name' => 'header_layout', 'type' => 'select', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'choices' => array ( 'std' => 'Mały obrazek z prawej strony', 'enlarged' => 'Duży obrazek na całą stronę', ), 'default_value' => array ( 0 => 'std', ), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'return_format' => 'value', 'placeholder' => '', ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'post', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'page', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'spektakl', ), ), ), 'menu_order' => 0, 'position' => 'side', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_5922c31b3e21d', 'title' => 'Lead', 'fields' => array ( array ( 'key' => 'field_5922c31ee9050', 'label' => 'Lead, czyli krótkie wprowadzenie do treści', 'name' => 'lead', 'type' => 'text', 'instructions' => 'Maksymalnie 280 znaków', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => 280, ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'post', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'page', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'spektakl', ), ), ), 'menu_order' => 0, 'position' => 'acf_after_title', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_59281885f1533', 'title' => 'Galeria miniaturek', 'fields' => array ( array ( 'key' => 'field_5928189be519a', 'label' => 'Galeria miniaturek', 'name' => 'galeria_miniaturek', 'type' => 'repeater', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'collapsed' => '', 'min' => 0, 'max' => 0, 'layout' => 'table', 'button_label' => 'Dodaj zdjęcie', 'sub_fields' => array ( array ( 'key' => 'field_592818c6e519b', 'label' => 'Zdjęcia', 'name' => 'pixs', 'type' => 'gallery', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '70', 'class' => '', 'id' => '', ), 'min' => '', 'max' => '', 'insert' => 'append', 'library' => 'all', 'min_width' => '', 'min_height' => '', 'min_size' => '', 'max_width' => '', 'max_height' => '', 'max_size' => '', 'mime_types' => '', ), array ( 'key' => 'field_592818d7e519c', 'label' => 'Podpis', 'name' => 'podpis', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '30', 'class' => '', 'id' => '', ), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', ), ), ), ), 'location' => array ( array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'post', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'page', ), ), array ( array ( 'param' => 'post_type', 'operator' => '==', 'value' => 'spektakl', ), ), ), 'menu_order' => 0, 'position' => 'normal', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( 'key' => 'group_592c86b6b5d51', 'title' => 'Linki do mediów społecznościowych', 'fields' => array ( array ( 'key' => 'field_592c86c2a0de6', 'label' => 'Linki do mediów społecznościowych', 'name' => 'linki_do_mediow_spolecznosciowych', 'type' => 'repeater', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'collapsed' => '', 'min' => 0, 'max' => 0, 'layout' => 'table', 'button_label' => 'Dodaj link', 'sub_fields' => array ( array ( 'key' => 'field_592c8753a0de7', 'label' => 'Link', 'name' => 'link', 'type' => 'text', 'instructions' => 'np. https://www.facebook.com/AkademiaTeatralna/', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', ), array ( 'key' => 'field_592c875ca0de8', 'label' => 'Ikona', 'name' => 'ikona', 'type' => 'radio', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array ( 'width' => '', 'class' => '', 'id' => '', ), 'choices' => array ( 'facebook' => 'facebook', 'instagram' => 'instagram', 'twitter' => 'twitter', 'youtube-play' => 'youtube-play', 'vimeo' => 'vimeo', ), 'allow_null' => 0, 'other_choice' => 1, 'save_other_choice' => 0, 'default_value' => '', 'layout' => 'horizontal', 'return_format' => 'value', ), ), ), ), 'location' => array ( array ( array ( 'param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-strona-domowa', ), ), ), 'menu_order' => 20, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '', )); endif; function remove_menus(){ remove_menu_page( 'edit-comments.php' ); //Comments } add_action( 'admin_menu', 'remove_menus' ); add_action( 'save_post', 'tcn_daty_spektakli' ); function tcn_daty_spektakli($pid) { $repertuar=get_field('repertuar',$pid); if ($repertuar) { // w taki sposób sprawdzamy, czy zapisywany jest post z repertuarem, zamiast sprawdzać post_type $daty=array(); $getposts=get_posts('post_type=repertuar&orderby=modified&numberposts=7'); if ($getposts) foreach ($getposts as $p) { $repertuar=get_field('repertuar',$p->ID); if ($repertuar) foreach ($repertuar as $r) { $spektakl=$r['spektakl'][0]; if (isset($spektakl->ID)) { if (!isset($daty[$spektakl->ID])) { // robimy tabele z programem $daty[$spektakl->ID]=array(); } $data_to_copy=$r; unset($data_to_copy['spektakl']); $daty[$spektakl->ID][]=$data_to_copy; } } } // i jedziemy po spektaklach // print_r($daty); if ($daty) foreach ($daty as $id=>$data) { // update_post_meta( $post_id, $meta_key, $meta_value, $prev_value ); delete_post_meta( $id,'daty'); update_post_meta( $id, 'daty', serialize($data) ); } } } function dateV($format,$timestamp=null){ $to_convert = array( 'l'=>array('dat'=>'N','str'=>array('Poniedziałek','Wtorek','Środa','Czwartek','Piątek','Sobota','Niedziela')), 'F'=>array('dat'=>'n','str'=>array('styczeń','luty','marzec','kwiecień','maj','czerwiec','lipiec','sierpień','wrzesień','październik','listopad','grudzień')), 'f'=>array('dat'=>'n','str'=>array('stycznia','lutego','marca','kwietnia','maja','czerwca','lipca','sierpnia','września','października','listopada','grudnia')) ); if ($pieces = preg_split('#[:/.\-, ]#', $format)){ if ($timestamp === null) { $timestamp = time(); } foreach ($pieces as $datepart){ if (array_key_exists($datepart,$to_convert)){ $replace[] = $to_convert[$datepart]['str'][(date($to_convert[$datepart]['dat'],$timestamp)-1)]; }else{ $replace[] = date($datepart,$timestamp); } } $result = strtr($format,array_combine($pieces,$replace)); return $result; } } // add_action('init', 'myStartSession', 1); // function myStartSession() { // if(!session_id()) { // session_start(); // } // } // function page_categories_enable() { // register_taxonomy_for_object_type('category', 'page'); // } // add_action( 'init', 'page_categories_enable' ); // add_filter( 'jpeg_quality', create_function( '', 'return 75;' ) ); // add_theme_support('post-formats', array('gallery')); // uproszczenia w panelu admina // add_action('admin_menu', 'remove_admin_menu_items'); function msz_footer_admin () { if (!current_user_can('edit_others_pages')) { ?> '', ), $atts ); // mszdebug($atts['pageids']); ob_start(); echo '
'; global $post; if ($atts['pageids']) { $getposts=get_posts('numberposts=-1&post_type=any&orderby=menu_order&order=ASC&include='.$atts['pageids']); } else { $getposts=get_posts('numberposts=-1&orderby=menu_order&order=ASC&post_type=any&post_parent='.$post->ID); } foreach ($getposts as $post) { setup_postdata($post); $pix=get_featured_image('thumbnail'); ?>
'; wp_reset_postdata(); return ob_get_clean(); } add_shortcode( 'lista_podstron', 'lista_podstron' ); add_shortcode( 'button', 'msz_button' ); function msz_button($atts, $content=null) { return '

'.$content.'

'; } ?>ID); $target=''; } else { $addclass.=" but "; } ?> < class="" data-href="" > 2 [ids] => 28237,28236,28235,28234 [orderby] => post__in [include] => 28237,28236,28235,28234 ) $ids=explode(',',$attr['ids']); if (!isset($attr['columns'])) $attr['columns']=3; ob_start(); ?>
$attr['ids'],'post_type' => 'attachment')); // foreach($posts as $nr=>$imagePost) { foreach ($ids as $nr=>$id) { $imagePost=get_post($id); // if (is_user_logged_in()) mszdebug($imagePost); $pix=wp_get_attachment_image_src($imagePost->ID, wp_is_mobile() ? 'medium' : 'large'); if ($nr==0) $pix0=$pix; ?>