Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Categories
- $start = microtime(true);
- $cats = get_the_category();
- if ( $cats ) {
- foreach ( $cats as $cat ) {
- $cat_list[] = '<a href="' . get_category_link( $cat->term_id ) . '">' . $cat->cat_name . '</a>';
- }
- }
- /**
- * Filters the list of category links to be displyaed on Post's entry meta
- *
- * @see tujtheme_post_entry_meta()
- *
- * @param string $array Category links.
- */
- $cat_list = apply_filters( 'tujtheme_filter_post_entry_meta_cat', $cat_list );
- $cat_list = implode( ', ', $cat_list );
- $cat_list = rtrim( $cat_list, ',' );
- echo microtime(true) - $start, PHP_EOL;
- 0.0013430118560791
- // Categories
- $start = microtime(true);
- $cats = get_the_category();
- if ( $cats ) {
- $i = 1;
- $sep = ', ';
- foreach ( $cats as $cat ) {
- if ( $i === count( $cats ) ) {
- $sep = '';
- }
- $cat_list[] = '<a href="' . get_category_link( $cat->term_id ) . '">' . $cat->cat_name . '</a>' . $sep;
- $i++;
- }
- }
- /**
- * Filters the list of category links to be displyaed on Post's entry meta
- *
- * @see tujtheme_post_entry_meta()
- *
- * @param string $array Category links.
- */
- $cat_list = apply_filters( 'tujtheme_filter_post_entry_meta_cat', $cat_list );
- $cat_list = implode( '', $cat_list );
- echo microtime(true) - $start, PHP_EOL;
- 0.00087213516235352
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement