Making WordPress.org

Changeset 943


Ignore:
Timestamp:
10/28/2014 08:45:54 PM (12 years ago)
Author:
coffee2code
Message:

Code Reference: display prominent callout above content to flag deprecated items when applicable

fixes #449.
props nicolealleyinteractivecom.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
4 edited

Legend:

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

    r938 r943  
    22
    33<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     4
     5        <?php echo get_deprecated(); ?>
    46
    57        <h1><a href="<?php the_permalink() ?>"><?php echo get_signature(); ?></a></h1>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r938 r943  
    720720
    721721        /**
     722         * Retrieve deprecated flag
     723         *
     724         * @param int $post_id
     725         *
     726         * @return string
     727         */
     728        function get_deprecated( $post_id = null ) {
     729                if ( empty( $post_id ) ) {
     730                        $post_id = get_the_ID();
     731                }
     732
     733                $types          = explode( '-', get_post_type( $post_id ) );
     734                $type           = array_pop( $types );
     735                $tags           = get_post_meta( $post_id, '_wp-parser_tags', true );
     736                $all_deprecated = wp_filter_object_list( $tags, array( 'name' => 'deprecated' ) );
     737
     738                if ( empty( $all_deprecated ) ) {
     739                        return '';
     740                }
     741
     742                $deprecated  = array_shift( $all_deprecated );
     743                // Multi-@deprecated may have been defined, with the second actually having the deprecation text.
     744                if ( empty( $deprecated['content'] ) ) {
     745                        $deprecated  = array_shift( $all_deprecated );
     746                }
     747                $description = empty( $deprecated['content'] ) ? '' : esc_html( $deprecated['content'] );
     748
     749                return "<div class='deprecated'>"
     750                        . wp_kses_post( sprintf( __( 'Warning: This %s has been deprecated. %s', 'wporg' ), $type, $description ) )
     751                        . '</div>';
     752        }
     753
     754        /**
    722755         * Retrieve URL to source file archive.
    723756         *
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

    r940 r943  
    941941                        padding: 20px;
    942942                }
     943                .deprecated {
     944                        background-color: #be2423;
     945                        border: 1px solid #a4322f;
     946                        padding: 20px;
     947                        color: #ffffff;
     948                }
    943949        }
    944950
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

    r940 r943  
    11461146  padding: 20px;
    11471147}
     1148.devhub-wrap .wp-parser-class .deprecated, .devhub-wrap .wp-parser-function .deprecated, .devhub-wrap .wp-parser-hook .deprecated, .devhub-wrap .wp-parser-method .deprecated {
     1149  background-color: #be2423;
     1150  border: 1px solid #a4322f;
     1151  padding: 20px;
     1152  color: #ffffff;
     1153}
    11481154.devhub-wrap.archive .wp-parser-class h1 a, .devhub-wrap.archive .wp-parser-function h1 a, .devhub-wrap.archive .wp-parser-hook h1 a, .devhub-wrap.archive .wp-parser-method h1 a, .devhub-wrap.search .wp-parser-class h1 a, .devhub-wrap.search .wp-parser-function h1 a, .devhub-wrap.search .wp-parser-hook h1 a, .devhub-wrap.search .wp-parser-method h1 a {
    11491155  font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
Note: See TracChangeset for help on using the changeset viewer.