Make WordPress Core


Ignore:
Timestamp:
09/25/2013 04:49:36 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Eleven: update code comments to reflect WP inline docs standards. Props DrewAPicture, see #25256.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/functions.php

    r24709 r25625  
    5252if ( ! function_exists( 'twentyeleven_setup' ) ):
    5353/**
    54  * Sets up theme defaults and registers support for various WordPress features.
     54 * Set up theme defaults and registers support for various WordPress features.
    5555 *
    5656 * Note that this function is hooked into the after_setup_theme hook, which runs
     
    6161 * functions.php file.
    6262 *
    63  * @uses load_theme_textdomain() For translation/localization support.
    64  * @uses add_editor_style() To style the visual editor.
    65  * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
    66  *  and backgrounds, and post formats.
    67  * @uses register_nav_menus() To add support for navigation menus.
     63 * @uses load_theme_textdomain()    For translation/localization support.
     64 * @uses add_editor_style()         To style the visual editor.
     65 * @uses add_theme_support()        To add support for post thumbnails, automatic feed links, custom headers
     66 *                                  and backgrounds, and post formats.
     67 * @uses register_nav_menus()       To add support for navigation menus.
    6868 * @uses register_default_headers() To register the default custom header images provided with the theme.
    69  * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
     69 * @uses set_post_thumbnail_size()  To set a custom post thumbnail size.
    7070 *
    7171 * @since Twenty Eleven 1.0
     
    7373function twentyeleven_setup() {
    7474
    75     /* Make Twenty Eleven available for translation.
     75    /**
     76     * Make Twenty Eleven available for translation.
    7677     * Translations can be added to the /languages/ directory.
    77      * If you're building a theme based on Twenty Eleven, use a find and replace
    78      * to change 'twentyeleven' to the name of your theme in all the template files.
     78     * If you're building a theme based on Twenty Eleven, use
     79     * a find and replace to change 'twentyeleven' to the name
     80     * of your theme in all the template files.
    7981     */
    8082    load_theme_textdomain( 'twentyeleven', get_template_directory() . '/languages' );
     
    106108    // Add support for custom backgrounds.
    107109    add_theme_support( 'custom-background', array(
    108         // Let WordPress know what our default background color is.
    109         // This is dependent on our current color scheme.
     110        /**
     111         * Let WordPress know what our default background color is.
     112         * This is dependent on our current color scheme.
     113         */
    110114        'default-color' => $default_background_color,
    111115    ) );
     
    119123        'default-text-color' => '000',
    120124        // The height and width of our custom header.
     125        /**
     126         * Filter the Twenty Eleven default header image width.
     127         *
     128         * @since Twenty Eleven 1.0
     129         *
     130         * @param int The default header image width in pixels. Default 1000.
     131         */
    121132        'width' => apply_filters( 'twentyeleven_header_image_width', 1000 ),
     133        /**
     134         * Filter the Twenty Eleven default header image height.
     135         *
     136         * @since Twenty Eleven 1.0
     137         *
     138         * @param int The default header image height in pixels. Default 288.
     139         */
    122140        'height' => apply_filters( 'twentyeleven_header_image_height', 288 ),
    123141        // Support flexible heights.
     
    145163    }
    146164
    147     // We'll be using post thumbnails for custom header images on posts and pages.
    148     // We want them to be the size of the header image that we just defined
    149     // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
     165    /**
     166     * We'll be using post thumbnails for custom header images on posts and pages.
     167     * We want them to be the size of the header image that we just defined.
     168     * Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
     169     */
    150170    set_post_thumbnail_size( $custom_header_support['width'], $custom_header_support['height'], true );
    151171
    152     // Add Twenty Eleven's custom image sizes.
    153     // Used for large feature (header) images.
     172    /**
     173     * Add Twenty Eleven's custom image sizes.
     174     * Used for large feature (header) images.
     175     */
    154176    add_image_size( 'large-feature', $custom_header_support['width'], $custom_header_support['height'], true );
    155177    // Used for featured posts if a large-feature doesn't exist.
     
    212234if ( ! function_exists( 'twentyeleven_header_style' ) ) :
    213235/**
    214  * Styles the header image and text displayed on the blog
     236 * Styles the header image and text displayed on the blog.
    215237 *
    216238 * @since Twenty Eleven 1.0
     
    328350
    329351/**
    330  * Sets the post excerpt length to 40 words.
    331  *
    332  * To override this length in a child theme, remove the filter and add your own
    333  * function tied to the excerpt_length filter hook.
     352 * Set the post excerpt length to 40 words.
     353 *
     354 * To override this length in a child theme, remove
     355 * the filter and add your own function tied to
     356 * the excerpt_length filter hook.
     357 *
     358 * @since Twenty Eleven 1.0
     359 *
     360 * @param int $length The number of excerpt characters.
     361 * @return int The filtered number of characters.
    334362 */
    335363function twentyeleven_excerpt_length( $length ) {
     
    340368if ( ! function_exists( 'twentyeleven_continue_reading_link' ) ) :
    341369/**
    342  * Returns a "Continue Reading" link for excerpts
     370 * Return a "Continue Reading" link for excerpts
     371 *
     372 * @since Twenty Eleven 1.0
     373 *
     374 * @return string The "Continue Reading" HTML link.
    343375 */
    344376function twentyeleven_continue_reading_link() {
     
    348380
    349381/**
    350  * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link().
     382 * Replace "[...]" in the Read More link with an ellipsis.
     383 *
     384 * The "[...]" is appended to automatically generated excerpts.
    351385 *
    352386 * To override this in a child theme, remove the filter and add your own
    353387 * function tied to the excerpt_more filter hook.
     388 *
     389 * @since Twenty Eleven 1.0
     390 *
     391 * @param string $more The Read More text.
     392 * @return The filtered Read More text.
    354393 */
    355394function twentyeleven_auto_excerpt_more( $more ) {
     
    359398
    360399/**
    361  * Adds a pretty "Continue Reading" link to custom post excerpts.
     400 * Add a pretty "Continue Reading" link to custom post excerpts.
    362401 *
    363402 * To override this link in a child theme, remove the filter and add your own
    364403 * function tied to the get_the_excerpt filter hook.
     404 *
     405 * @since Twenty Eleven 1.0
     406 *
     407 * @param string $output The "Continue Reading" link.
     408 * @return string The filtered "Continue Reading" link.
    365409 */
    366410function twentyeleven_custom_excerpt_more( $output ) {
     
    373417
    374418/**
    375  * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
     419 * Show a home link for the wp_nav_menu() fallback, wp_page_menu().
     420 *
     421 * @since Twenty Eleven 1.0
     422 *
     423 * @param array $args The page menu arguments. @see wp_page_menu()
     424 * @return array The filtered page menu arguments.
    376425 */
    377426function twentyeleven_page_menu_args( $args ) {
     
    383432
    384433/**
    385  * Register our sidebars and widgetized areas. Also register the default Epherma widget.
     434 * Register sidebars and widgetized areas.
     435 *
     436 * Also register the default Epherma widget.
    386437 *
    387438 * @since Twenty Eleven 1.0
     
    444495if ( ! function_exists( 'twentyeleven_content_nav' ) ) :
    445496/**
    446  * Display navigation to next/previous pages when applicable
     497 * Display navigation to next/previous pages when applicable.
     498 *
     499 * @since Twenty Eleven 1.0
     500 *
     501 * @param string $html_id The HTML id attribute.
    447502 */
    448503function twentyeleven_content_nav( $html_id ) {
     
    463518 * post permalink is used as a fallback.
    464519 *
     520 * @since Twenty Eleven 1.0
     521 *
    465522 * @uses get_url_in_content() to get the first URL from the post content.
    466523 *
    467  * @return string
     524 * @return string The first link.
    468525 */
    469526function twentyeleven_get_first_url() {
     
    474531        $has_url = twentyeleven_url_grabber();
    475532
     533    //duplicate_hook
    476534    return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
    477535}
     
    481539 *
    482540 * @since Twenty Eleven 1.0
     541 *
    483542 * @return string|bool URL or false when no link is present.
    484543 */
     
    491550
    492551/**
    493  * Count the number of footer sidebars to enable dynamic classes for the footer
     552 * Count the number of footer sidebars to enable dynamic classes for the footer.
     553 *
     554 * @since Twenty Eleven 1.0
    494555 */
    495556function twentyeleven_footer_sidebar_class() {
     
    533594 *
    534595 * @since Twenty Eleven 1.0
     596 *
     597 * @param object $comment The comment object.
     598 * @param array  $args    An array of comment arguments. @see get_comment_reply_link()
     599 * @param int    $depth   The depth of the comment.
    535600 */
    536601function twentyeleven_comment( $comment, $args, $depth ) {
     
    594659if ( ! function_exists( 'twentyeleven_posted_on' ) ) :
    595660/**
    596  * Prints HTML with meta information for the current post-date/time and author.
     661 * Print HTML with meta information for the current post-date/time and author.
     662 *
    597663 * Create your own twentyeleven_posted_on to override in a child theme
    598664 *
     
    613679
    614680/**
    615  * Adds two classes to the array of body classes.
     681 * Add two classes to the array of body classes.
     682 *
    616683 * The first is if the site has only had one author with published posts.
    617684 * The second is if a singular post being displayed
    618685 *
    619686 * @since Twenty Eleven 1.0
     687 *
     688 * @param array $classes Existing body classes.
     689 * @return array The filtered array of body classes.
    620690 */
    621691function twentyeleven_body_classes( $classes ) {
     
    632702
    633703/**
    634  * Retrieves the IDs for images in a gallery.
    635  *
    636  * @uses get_post_galleries() first, if available. Falls back to shortcode parsing,
    637  * then as last option uses a get_posts() call.
     704 * Retrieve the IDs for images in a gallery.
     705 *
     706 * @uses get_post_galleries() First, if available. Falls back to shortcode parsing,
     707 *                            then as last option uses a get_posts() call.
    638708 *
    639709 * @since Twenty Eleven 1.6.
Note: See TracChangeset for help on using the changeset viewer.