odmiana 'komentarzy’
–
$num_comments = get_comments_number(); if ( comments_open() ) { if ( $num_comments == 0 ){ $comments = "Nie ma jeszcze komentarzy"; } elseif ( $num_comments == 1 ) { $comments = "Jest już pierwszy komentarz"; } elseif ( 5 > $num_comments > 1 ) { $comments = "Są już " . $num_comments . " komentarze"; } else { $comments = "Jest już " . $num_comments. " komentarzy"; } $write_comments = '<a href="' . get_comments_link() .'">'. $comments.'</a>'; } else { $write_comments = 'Komentarze są wyłączone'; }
–
czas czytania posta:
<?php function bm_estimated_reading_time() { $post = get_post(); $words = str_word_count( strip_tags( $post->post_content ) ); $minutes = floor( $words / 120 ); $seconds = floor( $words % 120 / ( 120 / 60 ) ); $textMinutes = 'minut'; $textSeconds = 'sekund'; if ( $minutes == 1 ) { $textMinutes = 'minuta'; } elseif ($minutes == 2 or $minutes == 3 or $minutes == 4) { $textMinutes = 'minuty'; } else { $textMinutes = 'minut'; } if ( $seconds == 1 ) { $textSeconds = 'sekunda'; } elseif ($seconds == 2 or $seconds == 3 or $seconds == 4) { $textSeconds = 'sekundy'; } else { $textSeconds = 'sekund'; } if ( 1 <= $minutes ) { $estimated_time = $minutes . ' ' . $textMinutes . ' i ' . $seconds . ' ' . $textSeconds; } else { $estimated_time = $seconds . ' ' . $textSeconds; } return $estimated_time; } ?> <?php $timeRead = bm_estimated_reading_time(); ?> <?php echo $timeRead; ?> czytania
–
Hope this helps and happy coding :)
Zobacz jeszcze
dodanie opcji child w WP
w temacie strony w pliku function.php wstawiamy kod: function is_child($pageID) { global $post; if( is_page() && ($post->post_parent==$pageID) ) { return...