Changeset 1057
- Timestamp:
- 12/19/2014 09:57:26 PM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-reference.php
r1053 r1057 46 46 47 47 <?php 48 $explanation = '';48 $explanation = get_explanation_field( 'post_content', get_the_ID() ); 49 49 if ( $explanation ) : 50 50 ?> … … 52 52 <section class="explanation"> 53 53 <h2><?php _e( 'Explanation', 'wporg' ); ?></h2> 54 <?php the_content(); ?>54 <?php echo apply_filters( 'the_content', apply_filters( 'get_the_content', $explanation ) ); ?> 55 55 </section> 56 56 <?php endif; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/content-wp-parser-hook.php
r1053 r1057 44 44 45 45 <?php 46 $explanation = '';46 $explanation = get_explanation_field( 'post_content', get_the_ID() ); 47 47 if ( $explanation ) : 48 48 ?> … … 50 50 <section class="explanation"> 51 51 <h2><?php _e( 'Explanation', 'wporg' ); ?></h2> 52 <?php the_content(); ?>52 <?php echo apply_filters( 'the_content', apply_filters( 'get_the_content', $explanation ) ); ?> 53 53 </section> 54 54 <?php endif; ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php
r1045 r1057 45 45 */ 46 46 require __DIR__ . '/inc/user-content-voting.php'; 47 48 /** 49 * Explanations for functions. hooks, classes, and methods. 50 */ 51 require( __DIR__ . '/inc/explanations.php' ); 47 52 48 53 /** … … 80 85 add_action( 'pre_get_posts', __NAMESPACE__ . '\\pre_get_posts' ); 81 86 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\theme_scripts_styles' ); 87 82 88 add_filter( 'post_type_link', __NAMESPACE__ . '\\method_permalink', 10, 2 ); 83 89 add_filter( 'term_link', __NAMESPACE__ . '\\taxonomy_permalink', 10, 3 ); 84 90 add_filter( 'the_posts', __NAMESPACE__ . '\\rerun_empty_exact_search', 10, 2 ); 91 85 92 add_theme_support( 'automatic-feed-links' ); 86 93 add_theme_support( 'post-thumbnails' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/parsed-content.php
r942 r1057 70 70 $ticket_label = get_post_meta( $post->ID, 'wporg_ticket_title', true ); 71 71 $ticket_info = get_post_meta( $post->ID, 'wporg_parsed_ticket_info', true ); 72 $content = get_post_meta( $post->ID, 'wporg_parsed_content', true );72 $content = $post->post_content; 73 73 74 74 if ( $ticket ) { … … 99 99 <div class="wporg_parsed_readonly <?php echo $ticket ? 'hidden' : ''; ?>"><?php echo apply_filters( 'the_content', $content ); ?></div> 100 100 <div class="wporg_parsed_content <?php echo $ticket ? '' : 'hidden'; ?>"> 101 <?php wp_editor( $content, ' wporg_parsed_content_editor', array(101 <?php wp_editor( $content, 'content', array( 102 102 'media_buttons' => false, 103 103 'tinymce' => false, 104 104 'quicktags' => true, 105 105 'textarea_rows' => 10, 106 'textarea_name' => ' wporg_parsed_content',106 'textarea_name' => 'content', 107 107 ) ); ?> 108 108 </div> … … 164 164 // Only enqueue 'wporg-parsed-content' script and styles on Code Reference post type screens. 165 165 if ( in_array( get_current_screen()->id, $this->post_types ) ) { 166 wp_enqueue_style( 'wporg- parsed-content', get_template_directory_uri() . '/stylesheets/admin.css', array(), '20140826' );166 wp_enqueue_style( 'wporg-admin', get_template_directory_uri() . '/stylesheets/admin.css', array(), '20140826' ); 167 167 wp_enqueue_script( 'wporg-parsed-content', get_template_directory_uri() . '/js/parsed-content.js', array( 'jquery', 'utils' ), '20140826', true ); 168 168 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r1054 r1057 1104 1104 } 1105 1105 1106 /** 1107 * Retrieve an explanation for the given post. 1108 * 1109 * @param int|WP_Post $post Post ID or WP_Post object. 1110 * @param bool $published Optional. Whether to only retrieve the explanation if it's published. 1111 * Default false. 1112 * @return WP_Post|null WP_Post object for the Explanation, null otherwise. 1113 */ 1114 function get_explanation( $post, $published = false ) { 1115 if ( ! $post = get_post( $post ) ) { 1116 return null; 1117 } 1118 1119 $args = array( 1120 'post_type' => 'wporg_explanations', 1121 'post_parent' => $post->ID, 1122 'no_found_rows' => true, 1123 'posts_per_page' => 1, 1124 ); 1125 1126 if ( true === $published ) { 1127 $args['post_status'] = 'publish'; 1128 } 1129 1130 $explanation = get_children( $args, OBJECT ); 1131 1132 if ( empty( $explanation ) ) { 1133 return null; 1134 } 1135 1136 $explanation = reset( $explanation ); 1137 1138 if ( ! $explanation ) { 1139 return null; 1140 } 1141 return $explanation; 1142 } 1143 1144 /** 1145 * Retrieve data from an explanation post field. 1146 * 1147 * Works only for published explanations. 1148 * 1149 * @see get_post_field() 1150 * 1151 * @param string $field Post field name. 1152 * @param int|WP_Post $post Post ID or object for the function, hook, class, or method post 1153 * to retrieve an explanation field for. 1154 * @param string $context Optional. How to filter the field. Accepts 'raw', 'edit', 'db', 1155 * or 'display'. Default 'display'. 1156 * @return string The value of the post field on success, empty string on failure. 1157 */ 1158 function get_explanation_field( $field, $post, $context = 'display' ) { 1159 if ( ! $explanation = get_explanation( $post, $published = true ) ) { 1160 return ''; 1161 } 1162 return get_post_field( $field, $explanation, $context ); 1163 } 1106 1164 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/admin.scss
r831 r1057 21 21 display: block; 22 22 } 23 24 25 /* Explanations */ 26 27 .post-type-wporg_explanations .add-new-h2 { 28 display: none; 29 } 30 31 .expl-row-actions { 32 display: block; 33 34 a { 35 display: inline-block; 36 37 &:first-child { 38 padding-right: 6px; 39 padding-left: 0; 40 } 41 &:nth-child(n+2) { 42 padding-left: 8px; 43 border-left: 1px solid #ccc; 44 } 45 } 46 } 47 48 .status { 49 font-weight: bold; 50 51 &.pending { 52 color: red; 53 } 54 55 &.publish { 56 color: green; 57 } 58 } 59 .post-type-wp-parser-function, 60 .post-type-wp-parser-class, 61 .post-type-wp-parser-method, 62 .post-type-wp-parser-hook { 63 .form-table { 64 th { 65 padding-top: 10px; 66 padding-bottom: 10px; 67 } 68 td { 69 padding: 10px; 70 71 p { 72 margin-top: 0; 73 } 74 } 75 } 76 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/admin.css
r831 r1057 20 20 display: block; 21 21 } 22 23 /* Explanations */ 24 .post-type-wporg_explanations .add-new-h2 { 25 display: none; 26 } 27 28 .expl-row-actions { 29 display: block; 30 } 31 .expl-row-actions a { 32 display: inline-block; 33 } 34 .expl-row-actions a:first-child { 35 padding-right: 6px; 36 padding-left: 0; 37 } 38 .expl-row-actions a:nth-child(n+2) { 39 padding-left: 8px; 40 border-left: 1px solid #ccc; 41 } 42 43 .status { 44 font-weight: bold; 45 } 46 .status.pending { 47 color: red; 48 } 49 .status.publish { 50 color: green; 51 } 52 53 .post-type-wp-parser-function .form-table th, 54 .post-type-wp-parser-class .form-table th, 55 .post-type-wp-parser-method .form-table th, 56 .post-type-wp-parser-hook .form-table th { 57 padding-top: 10px; 58 padding-bottom: 10px; 59 } 60 .post-type-wp-parser-function .form-table td, 61 .post-type-wp-parser-class .form-table td, 62 .post-type-wp-parser-method .form-table td, 63 .post-type-wp-parser-hook .form-table td { 64 padding: 10px; 65 } 66 .post-type-wp-parser-function .form-table td p, 67 .post-type-wp-parser-class .form-table td p, 68 .post-type-wp-parser-method .form-table td p, 69 .post-type-wp-parser-hook .form-table td p { 70 margin-top: 0; 71 }
Note: See TracChangeset
for help on using the changeset viewer.