Making WordPress.org

Changeset 109


Ignore:
Timestamp:
10/23/2013 04:31:06 PM (11 years ago)
Author:
Otto42
Message:

P2 Post Categories plugin and theme mods for make-community. See #187. props iandunn

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-p2/functions.php

    r72 r109  
    2424}
    2525
     26// Return a list of link categories applied to the current post, unless it is uncategorized
     27function wporg_p2_get_cats_with_count( $post, $format = 'list', $before = '', $sep = '', $after = '' ) {
     28    $cat_links = array();
     29    $post_cats = get_the_terms( $post->ID, 'category' );
     30
     31    if ( ! $post_cats )
     32        return '';
     33
     34    foreach ( $post_cats as $cat ) {
     35        if ( 'uncategorized' == $cat->slug ) {
     36            continue;
     37        }
     38
     39        if ( $cat->count > 1 && ! is_category( $cat->slug ) ) {
     40            $cat_link = '<a href="' . get_term_link( $cat, 'category' ) . '" rel="category">' . $cat->name . ' ( ' . number_format_i18n( $cat->count ) . ' )</a>';
     41        } else {
     42            $cat_link = $cat->name;
     43        }
     44
     45        if ( $format == 'list' )
     46            $cat_link = '<li>' . $cat_link . '</li>';
     47
     48        $cat_links[] = $cat_link;
     49    }
     50
     51    if ( empty( $cat_links ) ) {
     52        return '';
     53    }
     54
     55    return apply_filters( 'cats_with_count', $before . join( $sep, $cat_links ) . $after, $post );
     56}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-p2/style.css

    r96 r109  
    170170.postcontent table td {
    171171    vertical-align: top;
     172}
     173
     174/* Add some space below tag/category descriptions */
     175#tag-description,
     176#category-description {
     177    margin-bottom: 2em;
    172178}
    173179
Note: See TracChangeset for help on using the changeset viewer.