'; }); add_shortcode( 'logosy', function() { return '
'; }); add_shortcode( 'pliki', function() { global $hide_block_zalaczniki_at_bottom; $hide_block_zalaczniki_at_bottom=true; return '
'; }); function wpdocs_register_meta_boxes() { global $post; if (isset($post) && has_category('event',$post)) { add_meta_box( 'lista_zapisow', "Lista zapisów", 'msz_lista_zapisow', 'post' ); } } add_action( 'add_meta_boxes', 'wpdocs_register_meta_boxes' ); function msz_lista_zapisow( $post ) { $meta=get_post_meta($post->ID,'Rejestracja'); ?> Pobierz dane jako CSV ID); if ($fields) foreach ($fields as $f) { $label=$f['nazwa_pola']; $name=sanitize_title($f['nazwa_pola']); echo ''; } ?> '; echo ''; echo ''; } echo '
Imię i nazwiskoEmailData wydarzeniaData rejestracji '.$label.'
'.str_replace(';;','',$row).'
'; } add_filter('acf/load_value/type=textarea', function($value,$post_id,$field) { if (!is_admin() && $field['name']=='lead') return sierotki($value); return $value; }, 10, 3); /* * Add columns to post list */ function add_acf_columns ( $columns ) { return array_merge ( $columns, array ( 'related_parent' => 'Nadrzędny wpis' // ,'end_date' => __ ( 'Ends' ) ) ); } add_filter ( 'manage_post_posts_columns', 'add_acf_columns' ); /* * Add columns to post list */ function post_custom_column ( $column, $post_id ) { switch ( $column ) { case 'related_parent': $rel=get_field('nadrzedny_wpis',$post_id); if ($rel) foreach ($rel as $r) { ?> 'Obrazek' // ,'end_date' => __ ( 'Ends' ) ) ); } add_filter ( 'manage_logosy_posts_columns', 'add_acf_columns_logosy' ); /* * Add columns to post list */ function logosy_custom_column ( $column, $post_id ) { switch ( $column ) { case 'pix': $pix=get_featured_image('thumbnail',$post_id); if ($pix) { ?> post_type=='post') { // $content=$p->post_content; // wp_update_post( array( 'ID' => $post_id, 'post_content' => $content ) ); // } // add_action( 'save_post', 'post_save_postprocessing' ); } add_action( 'save_post', 'post_save_postprocessing' ); function getDates($year) { $dates = array(); date("L", mktime(0,0,0, 7,7, $year)) ? $days = 366 : $days = 365; for($i = 1; $i <= $days; $i++){ $month = date('m', mktime(0,0,0,1,$i,$year)); $wk = date('W', mktime(0,0,0,1,$i,$year)); $wkDay = date('D', mktime(0,0,0,1,$i,$year)); $day = date('d', mktime(0,0,0,1,$i,$year)); $dates[$month][$wk][$wkDay] = $day; } return $dates; } function array_msort($array, $cols) { $colarr = array(); foreach ($cols as $col => $order) { $colarr[$col] = array(); foreach ($array as $k => $row) { $colarr[$col]['_'.$k] = strtolower($row[$col]); } } $eval = 'array_multisort('; foreach ($cols as $col => $order) { $eval .= '$colarr[\''.$col.'\'],'.$order.','; } $eval = substr($eval,0,-1).');'; eval($eval); $ret = array(); foreach ($colarr as $col => $arr) { foreach ($arr as $k => $v) { $k = substr($k,1); if (!isset($ret[$k])) $ret[$k] = $array[$k]; $ret[$k][$col] = $array[$k][$col]; } } return $ret; } function flat_title($title) { $title=str_replace('
'," ",$title); $title=str_replace('||'," ",$title); return $title; } add_filter('the_title', 'msz_title_filter', 10, 2); function msz_title_filter($title, $pid=false) { if (!$pid) return $title; if (!is_admin()) { if (!$title) $title="BEZ TYTUŁU"; $title=str_replace('||','
',$title); if (get_post_type($pid)=='ludzie') return msz_format_autor($title); } return sierotki($title); } add_filter('the_content', 'msz_content_filter', 10, 2); function msz_content_filter($txt, $pid=false) { if (!is_admin()) { $txt=sierotki($txt); } return $txt; } function msz_format_autor($autor) { // zmienia kowalski, jan na jan kowalski $autor=explode(',',$autor); if (count($autor)>1) { return trim($autor[1]).' '.trim($autor[0]); } else { return implode(' ',$autor); } } function msz_lead($sierotki=true) { global $post; $l=get_field('lead',$post->ID); if ($l) return $l; $l=get_field('meta_description_seo',$post->ID); if($l) return $l; $l=truncate(strip_tags(apply_filters('the_content',$post->post_content)),140); if ($sierotki) return sierotki($l); return $l; } add_action('wp-less_init', function($WPLess) { $WPLess->getCompiler()->setFormatter('compressed'); } ); 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_filter('post_gallery','customFormatGallery',10,2); function customFormatGallery($string,$attr){ // wszystkie obrazki dostają takie proporcje jak pierwszy w galerii // [columns] => 2 [ids] => 28237,28236,28235,28234 [orderby] => post__in [include] => 28237,28236,28235,28234 ) if (!isset($attr['ids'])) return false; $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); $tn=wp_get_attachment_image_src($imagePost->ID,'postlink'); $pix=wp_get_attachment_image_src($imagePost->ID, wp_is_mobile() ? 'large' : 'large'); if ($nr==0) $pix0=$pix; ?>