Making WordPress.org


Ignore:
Timestamp:
08/12/2014 06:26:08 AM (10 years ago)
Author:
coffee2code
Message:

Code Reference: streamline UI for archive/search listings

  • Add content-reference-archive.php template and use it for archive and search listings
  • Add wporg_filter_archive_excerpt() and use it to prefix post type label to excerpts in archive listings
  • Add wporg_filter_archive_title() and use it to append '()' to titles for function-like post types in archive listings
  • Add get_line_number() to get either start or end line number
  • Display simplified archive listing (no full method signature, no parts highlighting)
  • Add post type label, source file relative path, and start line number to archive listed items

fixes #450
props nicolealleyinteractivecom

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r773 r781  
    623623
    624624    /**
     625     * Retrieve either the starting or ending line number.
     626     *
     627     * @param  int    $post_id Optional. The post ID.
     628     * @param  string $type    Optional. Either 'start' for starting line number, or 'end' for ending line number.
     629     *
     630     * @return int
     631     */
     632    function get_line_number( $post_id = null, $type = 'start' ) {
     633
     634        $post_id  = empty( $post_id ) ? get_the_ID() : $post_id;
     635        $meta_key = ( 'end' == $type ) ? '_wp-parser_end_line_num' : '_wp-parser_line_num';
     636
     637        return (int) get_post_meta( $post_id, $meta_key, true );
     638    }
     639
     640    /**
    625641     * Retrieve the URL to the actual source file and line.
    626642     *
Note: See TracChangeset for help on using the changeset viewer.