[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-includes/ -> post-template.php (source)

   1  <?php
   2  /**
   3   * WordPress Post Template Functions.
   4   *
   5   * Gets content for the current post in the loop.
   6   *
   7   * @package WordPress
   8   * @subpackage Template
   9   */
  10  
  11  /**
  12   * Display the ID of the current item in the WordPress Loop.
  13   *
  14   * @since 0.71
  15   */
  16  function the_ID() {
  17      echo get_the_ID();
  18  }
  19  
  20  /**
  21   * Retrieve the ID of the current item in the WordPress Loop.
  22   *
  23   * @since 2.1.0
  24   *
  25   * @return int|false The ID of the current item in the WordPress Loop. False if $post is not set.
  26   */
  27  function get_the_ID() {
  28      $post = get_post();
  29      return ! empty( $post ) ? $post->ID : false;
  30  }
  31  
  32  /**
  33   * Display or retrieve the current post title with optional markup.
  34   *
  35   * @since 0.71
  36   *
  37   * @param string $before Optional. Markup to prepend to the title. Default empty.
  38   * @param string $after  Optional. Markup to append to the title. Default empty.
  39   * @param bool   $echo   Optional. Whether to echo or return the title. Default true for echo.
  40   * @return string|void Current post title if $echo is false.
  41   */
  42  function the_title( $before = '', $after = '', $echo = true ) {
  43      $title = get_the_title();
  44  
  45      if ( strlen( $title ) == 0 ) {
  46          return;
  47      }
  48  
  49      $title = $before . $title . $after;
  50  
  51      if ( $echo ) {
  52          echo $title;
  53      } else {
  54          return $title;
  55      }
  56  }
  57  
  58  /**
  59   * Sanitize the current title when retrieving or displaying.
  60   *
  61   * Works like the_title(), except the parameters can be in a string or
  62   * an array. See the function for what can be override in the $args parameter.
  63   *
  64   * The title before it is displayed will have the tags stripped and esc_attr()
  65   * before it is passed to the user or displayed. The default as with the_title(),
  66   * is to display the title.
  67   *
  68   * @since 2.3.0
  69   *
  70   * @param string|array $args {
  71   *     Title attribute arguments. Optional.
  72   *
  73   *     @type string  $before Markup to prepend to the title. Default empty.
  74   *     @type string  $after  Markup to append to the title. Default empty.
  75   *     @type bool    $echo   Whether to echo or return the title. Default true for echo.
  76   *     @type WP_Post $post   Current post object to retrieve the title for.
  77   * }
  78   * @return string|void String when echo is false.
  79   */
  80  function the_title_attribute( $args = '' ) {
  81      $defaults = array(
  82          'before' => '',
  83          'after'  => '',
  84          'echo'   => true,
  85          'post'   => get_post(),
  86      );
  87      $r        = wp_parse_args( $args, $defaults );
  88  
  89      $title = get_the_title( $r['post'] );
  90  
  91      if ( strlen( $title ) == 0 ) {
  92          return;
  93      }
  94  
  95      $title = $r['before'] . $title . $r['after'];
  96      $title = esc_attr( strip_tags( $title ) );
  97  
  98      if ( $r['echo'] ) {
  99          echo $title;
 100      } else {
 101          return $title;
 102      }
 103  }
 104  
 105  /**
 106   * Retrieve post title.
 107   *
 108   * If the post is protected and the visitor is not an admin, then "Protected"
 109   * will be displayed before the post title. If the post is private, then
 110   * "Private" will be located before the post title.
 111   *
 112   * @since 0.71
 113   *
 114   * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 115   * @return string
 116   */
 117  function get_the_title( $post = 0 ) {
 118      $post = get_post( $post );
 119  
 120      $title = isset( $post->post_title ) ? $post->post_title : '';
 121      $id    = isset( $post->ID ) ? $post->ID : 0;
 122  
 123      if ( ! is_admin() ) {
 124          if ( ! empty( $post->post_password ) ) {
 125  
 126              /**
 127               * Filters the text prepended to the post title for protected posts.
 128               *
 129               * The filter is only applied on the front end.
 130               *
 131               * @since 2.8.0
 132               *
 133               * @param string  $prepend Text displayed before the post title.
 134               *                         Default 'Protected: %s'.
 135               * @param WP_Post $post    Current post object.
 136               */
 137              $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ), $post );
 138              $title                  = sprintf( $protected_title_format, $title );
 139          } elseif ( isset( $post->post_status ) && 'private' == $post->post_status ) {
 140  
 141              /**
 142               * Filters the text prepended to the post title of private posts.
 143               *
 144               * The filter is only applied on the front end.
 145               *
 146               * @since 2.8.0
 147               *
 148               * @param string  $prepend Text displayed before the post title.
 149               *                         Default 'Private: %s'.
 150               * @param WP_Post $post    Current post object.
 151               */
 152              $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
 153              $title                = sprintf( $private_title_format, $title );
 154          }
 155      }
 156  
 157      /**
 158       * Filters the post title.
 159       *
 160       * @since 0.71
 161       *
 162       * @param string $title The post title.
 163       * @param int    $id    The post ID.
 164       */
 165      return apply_filters( 'the_title', $title, $id );
 166  }
 167  
 168  /**
 169   * Display the Post Global Unique Identifier (guid).
 170   *
 171   * The guid will appear to be a link, but should not be used as a link to the
 172   * post. The reason you should not use it as a link, is because of moving the
 173   * blog across domains.
 174   *
 175   * URL is escaped to make it XML-safe.
 176   *
 177   * @since 1.5.0
 178   *
 179   * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
 180   */
 181  function the_guid( $post = 0 ) {
 182      $post = get_post( $post );
 183  
 184      $guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
 185      $id   = isset( $post->ID ) ? $post->ID : 0;
 186  
 187      /**
 188       * Filters the escaped Global Unique Identifier (guid) of the post.
 189       *
 190       * @since 4.2.0
 191       *
 192       * @see get_the_guid()
 193       *
 194       * @param string $guid Escaped Global Unique Identifier (guid) of the post.
 195       * @param int    $id   The post ID.
 196       */
 197      echo apply_filters( 'the_guid', $guid, $id );
 198  }
 199  
 200  /**
 201   * Retrieve the Post Global Unique Identifier (guid).
 202   *
 203   * The guid will appear to be a link, but should not be used as an link to the
 204   * post. The reason you should not use it as a link, is because of moving the
 205   * blog across domains.
 206   *
 207   * @since 1.5.0
 208   *
 209   * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
 210   * @return string
 211   */
 212  function get_the_guid( $post = 0 ) {
 213      $post = get_post( $post );
 214  
 215      $guid = isset( $post->guid ) ? $post->guid : '';
 216      $id   = isset( $post->ID ) ? $post->ID : 0;
 217  
 218      /**
 219       * Filters the Global Unique Identifier (guid) of the post.
 220       *
 221       * @since 1.5.0
 222       *
 223       * @param string $guid Global Unique Identifier (guid) of the post.
 224       * @param int    $id   The post ID.
 225       */
 226      return apply_filters( 'get_the_guid', $guid, $id );
 227  }
 228  
 229  /**
 230   * Display the post content.
 231   *
 232   * @since 0.71
 233   *
 234   * @param string $more_link_text Optional. Content for when there is more text.
 235   * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
 236   */
 237  function the_content( $more_link_text = null, $strip_teaser = false ) {
 238      $content = get_the_content( $more_link_text, $strip_teaser );
 239  
 240      /**
 241       * Filters the post content.
 242       *
 243       * @since 0.71
 244       *
 245       * @param string $content Content of the current post.
 246       */
 247      $content = apply_filters( 'the_content', $content );
 248      $content = str_replace( ']]>', ']]&gt;', $content );
 249      echo $content;
 250  }
 251  
 252  /**
 253   * Retrieve the post content.
 254   *
 255   * @since 0.71
 256   * @since 5.2.0 Added the `$post` parameter.
 257   *
 258   * @global int   $page      Page number of a single post/page.
 259   * @global int   $more      Boolean indicator for whether single post/page is being viewed.
 260   * @global bool  $preview   Whether post/page is in preview mode.
 261   * @global array $pages     Array of all pages in post/page. Each array element contains
 262   *                          part of the content separated by the `<!--nextpage-->` tag.
 263   * @global int   $multipage Boolean indicator for whether multiple pages are in play.
 264   *
 265   * @param string             $more_link_text Optional. Content for when there is more text.
 266   * @param bool               $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
 267   * @param WP_Post|object|int $post           Optional. WP_Post instance or Post ID/object. Default is null.
 268   * @return string
 269   */
 270  function get_the_content( $more_link_text = null, $strip_teaser = false, $post = null ) {
 271      global $page, $more, $preview, $pages, $multipage;
 272  
 273      $_post = get_post( $post );
 274  
 275      if ( ! ( $_post instanceof WP_Post ) ) {
 276          return '';
 277      }
 278  
 279      if ( null === $post ) {
 280          $elements = compact( 'page', 'more', 'preview', 'pages', 'multipage' );
 281      } else {
 282          $elements = generate_postdata( $_post );
 283      }
 284  
 285      if ( null === $more_link_text ) {
 286          $more_link_text = sprintf(
 287              '<span aria-label="%1$s">%2$s</span>',
 288              sprintf(
 289                  /* translators: %s: Name of current post */
 290                  __( 'Continue reading %s' ),
 291                  the_title_attribute(
 292                      array(
 293                          'echo' => false,
 294                          'post' => $_post,
 295                      )
 296                  )
 297              ),
 298              __( '(more&hellip;)' )
 299          );
 300      }
 301  
 302      $output     = '';
 303      $has_teaser = false;
 304  
 305      // If post password required and it doesn't match the cookie.
 306      if ( post_password_required( $_post ) ) {
 307          return get_the_password_form( $_post );
 308      }
 309  
 310      if ( $elements['page'] > count( $elements['pages'] ) ) { // if the requested page doesn't exist
 311          $elements['page'] = count( $elements['pages'] ); // give them the highest numbered page that DOES exist
 312      }
 313  
 314      $page_no = $elements['page'];
 315      $content = $elements['pages'][ $page_no - 1 ];
 316      if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) {
 317          if ( has_block( 'more', $content ) ) {
 318              // Remove the core/more block delimiters. They will be left over after $content is split up.
 319              $content = preg_replace( '/<!-- \/?wp:more(.*?) -->/', '', $content );
 320          }
 321  
 322          $content = explode( $matches[0], $content, 2 );
 323  
 324          if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) {
 325              $more_link_text = strip_tags( wp_kses_no_null( trim( $matches[1] ) ) );
 326          }
 327  
 328          $has_teaser = true;
 329      } else {
 330          $content = array( $content );
 331      }
 332  
 333      if ( false !== strpos( $_post->post_content, '<!--noteaser-->' ) && ( ! $elements['multipage'] || $elements['page'] == 1 ) ) {
 334          $strip_teaser = true;
 335      }
 336  
 337      $teaser = $content[0];
 338  
 339      if ( $elements['more'] && $strip_teaser && $has_teaser ) {
 340          $teaser = '';
 341      }
 342  
 343      $output .= $teaser;
 344  
 345      if ( count( $content ) > 1 ) {
 346          if ( $elements['more'] ) {
 347              $output .= '<span id="more-' . $_post->ID . '"></span>' . $content[1];
 348          } else {
 349              if ( ! empty( $more_link_text ) ) {
 350  
 351                  /**
 352                   * Filters the Read More link text.
 353                   *
 354                   * @since 2.8.0
 355                   *
 356                   * @param string $more_link_element Read More link element.
 357                   * @param string $more_link_text    Read More text.
 358                   */
 359                  $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink( $_post ) . "#more-{$_post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
 360              }
 361              $output = force_balance_tags( $output );
 362          }
 363      }
 364  
 365      if ( $preview ) { // Preview fix for JavaScript bug with foreign languages.
 366          $output = preg_replace_callback( '/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output );
 367      }
 368  
 369      return $output;
 370  }
 371  
 372  /**
 373   * Preview fix for JavaScript bug with foreign languages.
 374   *
 375   * @since 3.1.0
 376   * @access private
 377   *
 378   * @param array $match Match array from preg_replace_callback.
 379   * @return string
 380   */
 381  function _convert_urlencoded_to_entities( $match ) {
 382      return '&#' . base_convert( $match[1], 16, 10 ) . ';';
 383  }
 384  
 385  /**
 386   * Display the post excerpt.
 387   *
 388   * @since 0.71
 389   */
 390  function the_excerpt() {
 391  
 392      /**
 393       * Filters the displayed post excerpt.
 394       *
 395       * @since 0.71
 396       *
 397       * @see get_the_excerpt()
 398       *
 399       * @param string $post_excerpt The post excerpt.
 400       */
 401      echo apply_filters( 'the_excerpt', get_the_excerpt() );
 402  }
 403  
 404  /**
 405   * Retrieves the post excerpt.
 406   *
 407   * @since 0.71
 408   * @since 4.5.0 Introduced the `$post` parameter.
 409   *
 410   * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 411   * @return string Post excerpt.
 412   */
 413  function get_the_excerpt( $post = null ) {
 414      if ( is_bool( $post ) ) {
 415          _deprecated_argument( __FUNCTION__, '2.3.0' );
 416      }
 417  
 418      $post = get_post( $post );
 419      if ( empty( $post ) ) {
 420          return '';
 421      }
 422  
 423      if ( post_password_required( $post ) ) {
 424          return __( 'There is no excerpt because this is a protected post.' );
 425      }
 426  
 427      /**
 428       * Filters the retrieved post excerpt.
 429       *
 430       * @since 1.2.0
 431       * @since 4.5.0 Introduced the `$post` parameter.
 432       *
 433       * @param string $post_excerpt The post excerpt.
 434       * @param WP_Post $post Post object.
 435       */
 436      return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
 437  }
 438  
 439  /**
 440   * Determines whether the post has a custom excerpt.
 441   *
 442   * For more information on this and similar theme functions, check out
 443   * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
 444   * Conditional Tags} article in the Theme Developer Handbook.
 445   *
 446   * @since 2.3.0
 447   *
 448   * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 449   * @return bool True if the post has a custom excerpt, false otherwise.
 450   */
 451  function has_excerpt( $post = 0 ) {
 452      $post = get_post( $post );
 453      return ( ! empty( $post->post_excerpt ) );
 454  }
 455  
 456  /**
 457   * Displays the classes for the post container element.
 458   *
 459   * @since 2.7.0
 460   *
 461   * @param string|array $class   One or more classes to add to the class list.
 462   * @param int|WP_Post  $post_id Optional. Post ID or post object. Defaults to the global `$post`.
 463   */
 464  function post_class( $class = '', $post_id = null ) {
 465      // Separates classes with a single space, collates classes for post DIV
 466      echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
 467  }
 468  
 469  /**
 470   * Retrieves an array of the class names for the post container element.
 471   *
 472   * The class names are many. If the post is a sticky, then the 'sticky'
 473   * class name. The class 'hentry' is always added to each post. If the post has a
 474   * post thumbnail, 'has-post-thumbnail' is added as a class. For each taxonomy that
 475   * the post belongs to, a class will be added of the format '{$taxonomy}-{$slug}' -
 476   * eg 'category-foo' or 'my_custom_taxonomy-bar'.
 477   *
 478   * The 'post_tag' taxonomy is a special
 479   * case; the class has the 'tag-' prefix instead of 'post_tag-'. All class names are
 480   * passed through the filter, {@see 'post_class'}, with the list of class names, followed by
 481   * $class parameter value, with the post ID as the last parameter.
 482   *
 483   * @since 2.7.0
 484   * @since 4.2.0 Custom taxonomy class names were added.
 485   *
 486   * @param string|string[] $class   Space-separated string or array of class names to add to the class list.
 487   * @param int|WP_Post     $post_id Optional. Post ID or post object.
 488   * @return string[] Array of class names.
 489   */
 490  function get_post_class( $class = '', $post_id = null ) {
 491      $post = get_post( $post_id );
 492  
 493      $classes = array();
 494  
 495      if ( $class ) {
 496          if ( ! is_array( $class ) ) {
 497              $class = preg_split( '#\s+#', $class );
 498          }
 499          $classes = array_map( 'esc_attr', $class );
 500      } else {
 501          // Ensure that we always coerce class to being an array.
 502          $class = array();
 503      }
 504  
 505      if ( ! $post ) {
 506          return $classes;
 507      }
 508  
 509      $classes[] = 'post-' . $post->ID;
 510      if ( ! is_admin() ) {
 511          $classes[] = $post->post_type;
 512      }
 513      $classes[] = 'type-' . $post->post_type;
 514      $classes[] = 'status-' . $post->post_status;
 515  
 516      // Post Format
 517      if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
 518          $post_format = get_post_format( $post->ID );
 519  
 520          if ( $post_format && ! is_wp_error( $post_format ) ) {
 521              $classes[] = 'format-' . sanitize_html_class( $post_format );
 522          } else {
 523              $classes[] = 'format-standard';
 524          }
 525      }
 526  
 527      $post_password_required = post_password_required( $post->ID );
 528  
 529      // Post requires password.
 530      if ( $post_password_required ) {
 531          $classes[] = 'post-password-required';
 532      } elseif ( ! empty( $post->post_password ) ) {
 533          $classes[] = 'post-password-protected';
 534      }
 535  
 536      // Post thumbnails.
 537      if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
 538          $classes[] = 'has-post-thumbnail';
 539      }
 540  
 541      // sticky for Sticky Posts
 542      if ( is_sticky( $post->ID ) ) {
 543          if ( is_home() && ! is_paged() ) {
 544              $classes[] = 'sticky';
 545          } elseif ( is_admin() ) {
 546              $classes[] = 'status-sticky';
 547          }
 548      }
 549  
 550      // hentry for hAtom compliance
 551      $classes[] = 'hentry';
 552  
 553      // All public taxonomies
 554      $taxonomies = get_taxonomies( array( 'public' => true ) );
 555      foreach ( (array) $taxonomies as $taxonomy ) {
 556          if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
 557              foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) {
 558                  if ( empty( $term->slug ) ) {
 559                      continue;
 560                  }
 561  
 562                  $term_class = sanitize_html_class( $term->slug, $term->term_id );
 563                  if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
 564                      $term_class = $term->term_id;
 565                  }
 566  
 567                  // 'post_tag' uses the 'tag' prefix for backward compatibility.
 568                  if ( 'post_tag' == $taxonomy ) {
 569                      $classes[] = 'tag-' . $term_class;
 570                  } else {
 571                      $classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id );
 572                  }
 573              }
 574          }
 575      }
 576  
 577      $classes = array_map( 'esc_attr', $classes );
 578  
 579      /**
 580       * Filters the list of CSS class names for the current post.
 581       *
 582       * @since 2.7.0
 583       *
 584       * @param string[] $classes An array of post class names.
 585       * @param string[] $class   An array of additional class names added to the post.
 586       * @param int      $post_id The post ID.
 587       */
 588      $classes = apply_filters( 'post_class', $classes, $class, $post->ID );
 589  
 590      return array_unique( $classes );
 591  }
 592  
 593  /**
 594   * Displays the class names for the body element.
 595   *
 596   * @since 2.8.0
 597   *
 598   * @param string|string[] $class Space-separated string or array of class names to add to the class list.
 599   */
 600  function body_class( $class = '' ) {
 601      // Separates class names with a single space, collates class names for body element
 602      echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';
 603  }
 604  
 605  /**
 606   * Retrieves an array of the class names for the body element.
 607   *
 608   * @since 2.8.0
 609   *
 610   * @global WP_Query $wp_query
 611   *
 612   * @param string|string[] $class Space-separated string or array of class names to add to the class list.
 613   * @return string[] Array of class names.
 614   */
 615  function get_body_class( $class = '' ) {
 616      global $wp_query;
 617  
 618      $classes = array();
 619  
 620      if ( is_rtl() ) {
 621          $classes[] = 'rtl';
 622      }
 623  
 624      if ( is_front_page() ) {
 625          $classes[] = 'home';
 626      }
 627      if ( is_home() ) {
 628          $classes[] = 'blog';
 629      }
 630      if ( is_privacy_policy() ) {
 631          $classes[] = 'privacy-policy';
 632      }
 633      if ( is_archive() ) {
 634          $classes[] = 'archive';
 635      }
 636      if ( is_date() ) {
 637          $classes[] = 'date';
 638      }
 639      if ( is_search() ) {
 640          $classes[] = 'search';
 641          $classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
 642      }
 643      if ( is_paged() ) {
 644          $classes[] = 'paged';
 645      }
 646      if ( is_attachment() ) {
 647          $classes[] = 'attachment';
 648      }
 649      if ( is_404() ) {
 650          $classes[] = 'error404';
 651      }
 652  
 653      if ( is_singular() ) {
 654          $post_id   = $wp_query->get_queried_object_id();
 655          $post      = $wp_query->get_queried_object();
 656          $post_type = $post->post_type;
 657  
 658          if ( is_page_template() ) {
 659              $classes[] = "{$post_type}-template";
 660  
 661              $template_slug  = get_page_template_slug( $post_id );
 662              $template_parts = explode( '/', $template_slug );
 663  
 664              foreach ( $template_parts as $part ) {
 665                  $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) );
 666              }
 667              $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) );
 668          } else {
 669              $classes[] = "{$post_type}-template-default";
 670          }
 671  
 672          if ( is_single() ) {
 673              $classes[] = 'single';
 674              if ( isset( $post->post_type ) ) {
 675                  $classes[] = 'single-' . sanitize_html_class( $post->post_type, $post_id );
 676                  $classes[] = 'postid-' . $post_id;
 677  
 678                  // Post Format
 679                  if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
 680                      $post_format = get_post_format( $post->ID );
 681  
 682                      if ( $post_format && ! is_wp_error( $post_format ) ) {
 683                          $classes[] = 'single-format-' . sanitize_html_class( $post_format );
 684                      } else {
 685                          $classes[] = 'single-format-standard';
 686                      }
 687                  }
 688              }
 689          }
 690  
 691          if ( is_attachment() ) {
 692              $mime_type   = get_post_mime_type( $post_id );
 693              $mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
 694              $classes[]   = 'attachmentid-' . $post_id;
 695              $classes[]   = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
 696          } elseif ( is_page() ) {
 697              $classes[] = 'page';
 698  
 699              $page_id = $wp_query->get_queried_object_id();
 700  
 701              $post = get_post( $page_id );
 702  
 703              $classes[] = 'page-id-' . $page_id;
 704  
 705              if ( get_pages(
 706                  array(
 707                      'parent' => $page_id,
 708                      'number' => 1,
 709                  )
 710              ) ) {
 711                  $classes[] = 'page-parent';
 712              }
 713  
 714              if ( $post->post_parent ) {
 715                  $classes[] = 'page-child';
 716                  $classes[] = 'parent-pageid-' . $post->post_parent;
 717              }
 718          }
 719      } elseif ( is_archive() ) {
 720          if ( is_post_type_archive() ) {
 721              $classes[] = 'post-type-archive';
 722              $post_type = get_query_var( 'post_type' );
 723              if ( is_array( $post_type ) ) {
 724                  $post_type = reset( $post_type );
 725              }
 726              $classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
 727          } elseif ( is_author() ) {
 728              $author    = $wp_query->get_queried_object();
 729              $classes[] = 'author';
 730              if ( isset( $author->user_nicename ) ) {
 731                  $classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID );
 732                  $classes[] = 'author-' . $author->ID;
 733              }
 734          } elseif ( is_category() ) {
 735              $cat       = $wp_query->get_queried_object();
 736              $classes[] = 'category';
 737              if ( isset( $cat->term_id ) ) {
 738                  $cat_class = sanitize_html_class( $cat->slug, $cat->term_id );
 739                  if ( is_numeric( $cat_class ) || ! trim( $cat_class, '-' ) ) {
 740                      $cat_class = $cat->term_id;
 741                  }
 742  
 743                  $classes[] = 'category-' . $cat_class;
 744                  $classes[] = 'category-' . $cat->term_id;
 745              }
 746          } elseif ( is_tag() ) {
 747              $tag       = $wp_query->get_queried_object();
 748              $classes[] = 'tag';
 749              if ( isset( $tag->term_id ) ) {
 750                  $tag_class = sanitize_html_class( $tag->slug, $tag->term_id );
 751                  if ( is_numeric( $tag_class ) || ! trim( $tag_class, '-' ) ) {
 752                      $tag_class = $tag->term_id;
 753                  }
 754  
 755                  $classes[] = 'tag-' . $tag_class;
 756                  $classes[] = 'tag-' . $tag->term_id;
 757              }
 758          } elseif ( is_tax() ) {
 759              $term = $wp_query->get_queried_object();
 760              if ( isset( $term->term_id ) ) {
 761                  $term_class = sanitize_html_class( $term->slug, $term->term_id );
 762                  if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
 763                      $term_class = $term->term_id;
 764                  }
 765  
 766                  $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
 767                  $classes[] = 'term-' . $term_class;
 768                  $classes[] = 'term-' . $term->term_id;
 769              }
 770          }
 771      }
 772  
 773      if ( is_user_logged_in() ) {
 774          $classes[] = 'logged-in';
 775      }
 776  
 777      if ( is_admin_bar_showing() ) {
 778          $classes[] = 'admin-bar';
 779          $classes[] = 'no-customize-support';
 780      }
 781  
 782      if ( current_theme_supports( 'custom-background' )
 783          && ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) ) {
 784          $classes[] = 'custom-background';
 785      }
 786  
 787      if ( has_custom_logo() ) {
 788          $classes[] = 'wp-custom-logo';
 789      }
 790  
 791      if ( current_theme_supports( 'responsive-embeds' ) ) {
 792          $classes[] = 'wp-embed-responsive';
 793      }
 794  
 795      $page = $wp_query->get( 'page' );
 796  
 797      if ( ! $page || $page < 2 ) {
 798          $page = $wp_query->get( 'paged' );
 799      }
 800  
 801      if ( $page && $page > 1 && ! is_404() ) {
 802          $classes[] = 'paged-' . $page;
 803  
 804          if ( is_single() ) {
 805              $classes[] = 'single-paged-' . $page;
 806          } elseif ( is_page() ) {
 807              $classes[] = 'page-paged-' . $page;
 808          } elseif ( is_category() ) {
 809              $classes[] = 'category-paged-' . $page;
 810          } elseif ( is_tag() ) {
 811              $classes[] = 'tag-paged-' . $page;
 812          } elseif ( is_date() ) {
 813              $classes[] = 'date-paged-' . $page;
 814          } elseif ( is_author() ) {
 815              $classes[] = 'author-paged-' . $page;
 816          } elseif ( is_search() ) {
 817              $classes[] = 'search-paged-' . $page;
 818          } elseif ( is_post_type_archive() ) {
 819              $classes[] = 'post-type-paged-' . $page;
 820          }
 821      }
 822  
 823      if ( ! empty( $class ) ) {
 824          if ( ! is_array( $class ) ) {
 825              $class = preg_split( '#\s+#', $class );
 826          }
 827          $classes = array_merge( $classes, $class );
 828      } else {
 829          // Ensure that we always coerce class to being an array.
 830          $class = array();
 831      }
 832  
 833      $classes = array_map( 'esc_attr', $classes );
 834  
 835      /**
 836       * Filters the list of CSS body class names for the current post or page.
 837       *
 838       * @since 2.8.0
 839       *
 840       * @param string[] $classes An array of body class names.
 841       * @param string[] $class   An array of additional class names added to the body.
 842       */
 843      $classes = apply_filters( 'body_class', $classes, $class );
 844  
 845      return array_unique( $classes );
 846  }
 847  
 848  /**
 849   * Whether post requires password and correct password has been provided.
 850   *
 851   * @since 2.7.0
 852   *
 853   * @param int|WP_Post|null $post An optional post. Global $post used if not provided.
 854   * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
 855   */
 856  function post_password_required( $post = null ) {
 857      $post = get_post( $post );
 858  
 859      if ( empty( $post->post_password ) ) {
 860          /** This filter is documented in wp-includes/post-template.php */
 861          return apply_filters( 'post_password_required', false, $post );
 862      }
 863  
 864      if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) {
 865          /** This filter is documented in wp-includes/post-template.php */
 866          return apply_filters( 'post_password_required', true, $post );
 867      }
 868  
 869      require_once  ABSPATH . WPINC . '/class-phpass.php';
 870      $hasher = new PasswordHash( 8, true );
 871  
 872      $hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
 873      if ( 0 !== strpos( $hash, '$P$B' ) ) {
 874          $required = true;
 875      } else {
 876          $required = ! $hasher->CheckPassword( $post->post_password, $hash );
 877      }
 878  
 879      /**
 880       * Filters whether a post requires the user to supply a password.
 881       *
 882       * @since 4.7.0
 883       *
 884       * @param bool    $required Whether the user needs to supply a password. True if password has not been
 885       *                          provided or is incorrect, false if password has been supplied or is not required.
 886       * @param WP_Post $post     Post data.
 887       */
 888      return apply_filters( 'post_password_required', $required, $post );
 889  }
 890  
 891  //
 892  // Page Template Functions for usage in Themes
 893  //
 894  
 895  /**
 896   * The formatted output of a list of pages.
 897   *
 898   * Displays page links for paginated posts (i.e. including the `<!--nextpage-->`
 899   * Quicktag one or more times). This tag must be within The Loop.
 900   *
 901   * @since 1.2.0
 902   * @since 5.1.0 Added the `aria_current` argument.
 903   *
 904   * @global int $page
 905   * @global int $numpages
 906   * @global int $multipage
 907   * @global int $more
 908   *
 909   * @param string|array $args {
 910   *     Optional. Array or string of default arguments.
 911   *
 912   *     @type string       $before           HTML or text to prepend to each link. Default is `<p> Pages:`.
 913   *     @type string       $after            HTML or text to append to each link. Default is `</p>`.
 914   *     @type string       $link_before      HTML or text to prepend to each link, inside the `<a>` tag.
 915   *                                          Also prepended to the current item, which is not linked. Default empty.
 916   *     @type string       $link_after       HTML or text to append to each Pages link inside the `<a>` tag.
 917   *                                          Also appended to the current item, which is not linked. Default empty.
 918   *     @type string       $aria_current     The value for the aria-current attribute. Possible values are 'page',
 919   *                                          'step', 'location', 'date', 'time', 'true', 'false'. Default is 'page'.
 920   *     @type string       $next_or_number   Indicates whether page numbers should be used. Valid values are number
 921   *                                          and next. Default is 'number'.
 922   *     @type string       $separator        Text between pagination links. Default is ' '.
 923   *     @type string       $nextpagelink     Link text for the next page link, if available. Default is 'Next Page'.
 924   *     @type string       $previouspagelink Link text for the previous page link, if available. Default is 'Previous Page'.
 925   *     @type string       $pagelink         Format string for page numbers. The % in the parameter string will be
 926   *                                          replaced with the page number, so 'Page %' generates "Page 1", "Page 2", etc.
 927   *                                          Defaults to '%', just the page number.
 928   *     @type int|bool     $echo             Whether to echo or not. Accepts 1|true or 0|false. Default 1|true.
 929   * }
 930   * @return string Formatted output in HTML.
 931   */
 932  function wp_link_pages( $args = '' ) {
 933      global $page, $numpages, $multipage, $more;
 934  
 935      $defaults = array(
 936          'before'           => '<p class="post-nav-links">' . __( 'Pages:' ),
 937          'after'            => '</p>',
 938          'link_before'      => '',
 939          'link_after'       => '',
 940          'aria_current'     => 'page',
 941          'next_or_number'   => 'number',
 942          'separator'        => ' ',
 943          'nextpagelink'     => __( 'Next page' ),
 944          'previouspagelink' => __( 'Previous page' ),
 945          'pagelink'         => '%',
 946          'echo'             => 1,
 947      );
 948  
 949      $params = wp_parse_args( $args, $defaults );
 950  
 951      /**
 952       * Filters the arguments used in retrieving page links for paginated posts.
 953       *
 954       * @since 3.0.0
 955       *
 956       * @param array $params An array of arguments for page links for paginated posts.
 957       */
 958      $r = apply_filters( 'wp_link_pages_args', $params );
 959  
 960      $output = '';
 961      if ( $multipage ) {
 962          if ( 'number' == $r['next_or_number'] ) {
 963              $output .= $r['before'];
 964              for ( $i = 1; $i <= $numpages; $i++ ) {
 965                  $link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
 966                  if ( $i != $page || ! $more && 1 == $page ) {
 967                      $link = _wp_link_page( $i ) . $link . '</a>';
 968                  } elseif ( $i === $page ) {
 969                      $link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $r['aria_current'] ) . '">' . $link . '</span>';
 970                  }
 971                  /**
 972                   * Filters the HTML output of individual page number links.
 973                   *
 974                   * @since 3.6.0
 975                   *
 976                   * @param string $link The page number HTML output.
 977                   * @param int    $i    Page number for paginated posts' page links.
 978                   */
 979                  $link = apply_filters( 'wp_link_pages_link', $link, $i );
 980  
 981                  // Use the custom links separator beginning with the second link.
 982                  $output .= ( 1 === $i ) ? ' ' : $r['separator'];
 983                  $output .= $link;
 984              }
 985              $output .= $r['after'];
 986          } elseif ( $more ) {
 987              $output .= $r['before'];
 988              $prev    = $page - 1;
 989              if ( $prev > 0 ) {
 990                  $link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
 991  
 992                  /** This filter is documented in wp-includes/post-template.php */
 993                  $output .= apply_filters( 'wp_link_pages_link', $link, $prev );
 994              }
 995              $next = $page + 1;
 996              if ( $next <= $numpages ) {
 997                  if ( $prev ) {
 998                      $output .= $r['separator'];
 999                  }
1000                  $link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
1001  
1002                  /** This filter is documented in wp-includes/post-template.php */
1003                  $output .= apply_filters( 'wp_link_pages_link', $link, $next );
1004              }
1005              $output .= $r['after'];
1006          }
1007      }
1008  
1009      /**
1010       * Filters the HTML output of page links for paginated posts.
1011       *
1012       * @since 3.6.0
1013       *
1014       * @param string $output HTML output of paginated posts' page links.
1015       * @param array  $args   An array of arguments.
1016       */
1017      $html = apply_filters( 'wp_link_pages', $output, $args );
1018  
1019      if ( $r['echo'] ) {
1020          echo $html;
1021      }
1022      return $html;
1023  }
1024  
1025  /**
1026   * Helper function for wp_link_pages().
1027   *
1028   * @since 3.1.0
1029   * @access private
1030   *
1031   * @global WP_Rewrite $wp_rewrite
1032   *
1033   * @param int $i Page number.
1034   * @return string Link.
1035   */
1036  function _wp_link_page( $i ) {
1037      global $wp_rewrite;
1038      $post       = get_post();
1039      $query_args = array();
1040  
1041      if ( 1 == $i ) {
1042          $url = get_permalink();
1043      } else {
1044          if ( '' == get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ) ) ) {
1045              $url = add_query_arg( 'page', $i, get_permalink() );
1046          } elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
1047              $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' );
1048          } else {
1049              $url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' );
1050          }
1051      }
1052  
1053      if ( is_preview() ) {
1054  
1055          if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
1056              $query_args['preview_id']    = wp_unslash( $_GET['preview_id'] );
1057              $query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
1058          }
1059  
1060          $url = get_preview_post_link( $post, $query_args, $url );
1061      }
1062  
1063      return '<a href="' . esc_url( $url ) . '" class="post-page-numbers">';
1064  }
1065  
1066  //
1067  // Post-meta: Custom per-post fields.
1068  //
1069  
1070  /**
1071   * Retrieve post custom meta data field.
1072   *
1073   * @since 1.5.0
1074   *
1075   * @param string $key Meta data key name.
1076   * @return false|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
1077   */
1078  function post_custom( $key = '' ) {
1079      $custom = get_post_custom();
1080  
1081      if ( ! isset( $custom[ $key ] ) ) {
1082          return false;
1083      } elseif ( 1 == count( $custom[ $key ] ) ) {
1084          return $custom[ $key ][0];
1085      } else {
1086          return $custom[ $key ];
1087      }
1088  }
1089  
1090  /**
1091   * Display a list of post custom fields.
1092   *
1093   * @since 1.2.0
1094   *
1095   * @internal This will probably change at some point...
1096   */
1097  function the_meta() {
1098      if ( $keys = get_post_custom_keys() ) {
1099          $li_html = '';
1100          foreach ( (array) $keys as $key ) {
1101              $keyt = trim( $key );
1102              if ( is_protected_meta( $keyt, 'post' ) ) {
1103                  continue;
1104              }
1105  
1106              $values = array_map( 'trim', get_post_custom_values( $key ) );
1107              $value  = implode( ', ', $values );
1108  
1109              $html = sprintf(
1110                  "<li><span class='post-meta-key'>%s</span> %s</li>\n",
1111                  /* translators: %s: Post custom field name */
1112                  sprintf( _x( '%s:', 'Post custom field name' ), $key ),
1113                  $value
1114              );
1115  
1116              /**
1117               * Filters the HTML output of the li element in the post custom fields list.
1118               *
1119               * @since 2.2.0
1120               *
1121               * @param string $html  The HTML output for the li element.
1122               * @param string $key   Meta key.
1123               * @param string $value Meta value.
1124               */
1125              $li_html .= apply_filters( 'the_meta_key', $html, $key, $value );
1126          }
1127  
1128          if ( $li_html ) {
1129              echo "<ul class='post-meta'>\n{$li_html}</ul>\n";
1130          }
1131      }
1132  }
1133  
1134  //
1135  // Pages
1136  //
1137  
1138  /**
1139   * Retrieve or display a list of pages as a dropdown (select list).
1140   *
1141   * @since 2.1.0
1142   * @since 4.2.0 The `$value_field` argument was added.
1143   * @since 4.3.0 The `$class` argument was added.
1144   *
1145   * @see get_pages()
1146   *
1147   * @param array|string $args {
1148   *     Optional. Array or string of arguments to generate a page dropdown. See `get_pages()` for additional arguments.
1149   *
1150   *     @type int          $depth                 Maximum depth. Default 0.
1151   *     @type int          $child_of              Page ID to retrieve child pages of. Default 0.
1152   *     @type int|string   $selected              Value of the option that should be selected. Default 0.
1153   *     @type bool|int     $echo                  Whether to echo or return the generated markup. Accepts 0, 1,
1154   *                                               or their bool equivalents. Default 1.
1155   *     @type string       $name                  Value for the 'name' attribute of the select element.
1156   *                                               Default 'page_id'.
1157   *     @type string       $id                    Value for the 'id' attribute of the select element.
1158   *     @type string       $class                 Value for the 'class' attribute of the select element. Default: none.
1159   *                                               Defaults to the value of `$name`.
1160   *     @type string       $show_option_none      Text to display for showing no pages. Default empty (does not display).
1161   *     @type string       $show_option_no_change Text to display for "no change" option. Default empty (does not display).
1162   *     @type string       $option_none_value     Value to use when no page is selected. Default empty.
1163   *     @type string       $value_field           Post field used to populate the 'value' attribute of the option
1164   *                                               elements. Accepts any valid post field. Default 'ID'.
1165   * }
1166   * @return string HTML content, if not displaying.
1167   */
1168  function wp_dropdown_pages( $args = '' ) {
1169      $defaults = array(
1170          'depth'                 => 0,
1171          'child_of'              => 0,
1172          'selected'              => 0,
1173          'echo'                  => 1,
1174          'name'                  => 'page_id',
1175          'id'                    => '',
1176          'class'                 => '',
1177          'show_option_none'      => '',
1178          'show_option_no_change' => '',
1179          'option_none_value'     => '',
1180          'value_field'           => 'ID',
1181      );
1182  
1183      $r = wp_parse_args( $args, $defaults );
1184  
1185      $pages  = get_pages( $r );
1186      $output = '';
1187      // Back-compat with old system where both id and name were based on $name argument
1188      if ( empty( $r['id'] ) ) {
1189          $r['id'] = $r['name'];
1190      }
1191  
1192      if ( ! empty( $pages ) ) {
1193          $class = '';
1194          if ( ! empty( $r['class'] ) ) {
1195              $class = " class='" . esc_attr( $r['class'] ) . "'";
1196          }
1197  
1198          $output = "<select name='" . esc_attr( $r['name'] ) . "'" . $class . " id='" . esc_attr( $r['id'] ) . "'>\n";
1199          if ( $r['show_option_no_change'] ) {
1200              $output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
1201          }
1202          if ( $r['show_option_none'] ) {
1203              $output .= "\t<option value=\"" . esc_attr( $r['option_none_value'] ) . '">' . $r['show_option_none'] . "</option>\n";
1204          }
1205          $output .= walk_page_dropdown_tree( $pages, $r['depth'], $r );
1206          $output .= "</select>\n";
1207      }
1208  
1209      /**
1210       * Filters the HTML output of a list of pages as a drop down.
1211       *
1212       * @since 2.1.0
1213       * @since 4.4.0 `$r` and `$pages` added as arguments.
1214       *
1215       * @param string $output HTML output for drop down list of pages.
1216       * @param array  $r      The parsed arguments array.
1217       * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1218       */
1219      $html = apply_filters( 'wp_dropdown_pages', $output, $r, $pages );
1220  
1221      if ( $r['echo'] ) {
1222          echo $html;
1223      }
1224      return $html;
1225  }
1226  
1227  /**
1228   * Retrieve or display a list of pages (or hierarchical post type items) in list (li) format.
1229   *
1230   * @since 1.5.0
1231   * @since 4.7.0 Added the `item_spacing` argument.
1232   *
1233   * @see get_pages()
1234   *
1235   * @global WP_Query $wp_query
1236   *
1237   * @param array|string $args {
1238   *     Optional. Array or string of arguments to generate a list of pages. See `get_pages()` for additional arguments.
1239   *
1240   *     @type int          $child_of     Display only the sub-pages of a single page by ID. Default 0 (all pages).
1241   *     @type string       $authors      Comma-separated list of author IDs. Default empty (all authors).
1242   *     @type string       $date_format  PHP date format to use for the listed pages. Relies on the 'show_date' parameter.
1243   *                                      Default is the value of 'date_format' option.
1244   *     @type int          $depth        Number of levels in the hierarchy of pages to include in the generated list.
1245   *                                      Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to
1246   *                                      the given n depth). Default 0.
1247   *     @type bool         $echo         Whether or not to echo the list of pages. Default true.
1248   *     @type string       $exclude      Comma-separated list of page IDs to exclude. Default empty.
1249   *     @type array        $include      Comma-separated list of page IDs to include. Default empty.
1250   *     @type string       $link_after   Text or HTML to follow the page link label. Default null.
1251   *     @type string       $link_before  Text or HTML to precede the page link label. Default null.
1252   *     @type string       $post_type    Post type to query for. Default 'page'.
1253   *     @type string|array $post_status  Comma-separated list or array of post statuses to include. Default 'publish'.
1254   *     @type string       $show_date    Whether to display the page publish or modified date for each page. Accepts
1255   *                                      'modified' or any other value. An empty value hides the date. Default empty.
1256   *     @type string       $sort_column  Comma-separated list of column names to sort the pages by. Accepts 'post_author',
1257   *                                      'post_date', 'post_title', 'post_name', 'post_modified', 'post_modified_gmt',
1258   *                                      'menu_order', 'post_parent', 'ID', 'rand', or 'comment_count'. Default 'post_title'.
1259   *     @type string       $title_li     List heading. Passing a null or empty value will result in no heading, and the list
1260   *                                      will not be wrapped with unordered list `<ul>` tags. Default 'Pages'.
1261   *     @type string       $item_spacing Whether to preserve whitespace within the menu's HTML. Accepts 'preserve' or 'discard'.
1262   *                                      Default 'preserve'.
1263   *     @type Walker       $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
1264   * }
1265   * @return string|void HTML list of pages.
1266   */
1267  function wp_list_pages( $args = '' ) {
1268      $defaults = array(
1269          'depth'        => 0,
1270          'show_date'    => '',
1271          'date_format'  => get_option( 'date_format' ),
1272          'child_of'     => 0,
1273          'exclude'      => '',
1274          'title_li'     => __( 'Pages' ),
1275          'echo'         => 1,
1276          'authors'      => '',
1277          'sort_column'  => 'menu_order, post_title',
1278          'link_before'  => '',
1279          'link_after'   => '',
1280          'item_spacing' => 'preserve',
1281          'walker'       => '',
1282      );
1283  
1284      $r = wp_parse_args( $args, $defaults );
1285  
1286      if ( ! in_array( $r['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
1287          // invalid value, fall back to default.
1288          $r['item_spacing'] = $defaults['item_spacing'];
1289      }
1290  
1291      $output       = '';
1292      $current_page = 0;
1293  
1294      // sanitize, mostly to keep spaces out
1295      $r['exclude'] = preg_replace( '/[^0-9,]/', '', $r['exclude'] );
1296  
1297      // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)
1298      $exclude_array = ( $r['exclude'] ) ? explode( ',', $r['exclude'] ) : array();
1299  
1300      /**
1301       * Filters the array of pages to exclude from the pages list.
1302       *
1303       * @since 2.1.0
1304       *
1305       * @param array $exclude_array An array of page IDs to exclude.
1306       */
1307      $r['exclude'] = implode( ',', apply_filters( 'wp_list_pages_excludes', $exclude_array ) );
1308  
1309      // Query pages.
1310      $r['hierarchical'] = 0;
1311      $pages             = get_pages( $r );
1312  
1313      if ( ! empty( $pages ) ) {
1314          if ( $r['title_li'] ) {
1315              $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
1316          }
1317          global $wp_query;
1318          if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
1319              $current_page = get_queried_object_id();
1320          } elseif ( is_singular() ) {
1321              $queried_object = get_queried_object();
1322              if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
1323                  $current_page = $queried_object->ID;
1324              }
1325          }
1326  
1327          $output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
1328  
1329          if ( $r['title_li'] ) {
1330              $output .= '</ul></li>';
1331          }
1332      }
1333  
1334      /**
1335       * Filters the HTML output of the pages to list.
1336       *
1337       * @since 1.5.1
1338       * @since 4.4.0 `$pages` added as arguments.
1339       *
1340       * @see wp_list_pages()
1341       *
1342       * @param string $output HTML output of the pages list.
1343       * @param array  $r      An array of page-listing arguments.
1344       * @param array  $pages  List of WP_Post objects returned by `get_pages()`
1345       */
1346      $html = apply_filters( 'wp_list_pages', $output, $r, $pages );
1347  
1348      if ( $r['echo'] ) {
1349          echo $html;
1350      } else {
1351          return $html;
1352      }
1353  }
1354  
1355  /**
1356   * Displays or retrieves a list of pages with an optional home link.
1357   *
1358   * The arguments are listed below and part of the arguments are for wp_list_pages() function.
1359   * Check that function for more info on those arguments.
1360   *
1361   * @since 2.7.0
1362   * @since 4.4.0 Added `menu_id`, `container`, `before`, `after`, and `walker` arguments.
1363   * @since 4.7.0 Added the `item_spacing` argument.
1364   *
1365   * @param array|string $args {
1366   *     Optional. Array or string of arguments to generate a page menu. See `wp_list_pages()` for additional arguments.
1367   *
1368   *     @type string          $sort_column  How to sort the list of pages. Accepts post column names.
1369   *                                         Default 'menu_order, post_title'.
1370   *     @type string          $menu_id      ID for the div containing the page list. Default is empty string.
1371   *     @type string          $menu_class   Class to use for the element containing the page list. Default 'menu'.
1372   *     @type string          $container    Element to use for the element containing the page list. Default 'div'.
1373   *     @type bool            $echo         Whether to echo the list or return it. Accepts true (echo) or false (return).
1374   *                                         Default true.
1375   *     @type int|bool|string $show_home    Whether to display the link to the home page. Can just enter the text
1376   *                                         you'd like shown for the home link. 1|true defaults to 'Home'.
1377   *     @type string          $link_before  The HTML or text to prepend to $show_home text. Default empty.
1378   *     @type string          $link_after   The HTML or text to append to $show_home text. Default empty.
1379   *     @type string          $before       The HTML or text to prepend to the menu. Default is '<ul>'.
1380   *     @type string          $after        The HTML or text to append to the menu. Default is '</ul>'.
1381   *     @type string          $item_spacing Whether to preserve whitespace within the menu's HTML. Accepts 'preserve'
1382   *                                         or 'discard'. Default 'discard'.
1383   *     @type Walker          $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
1384   * }
1385   * @return string|void HTML menu
1386   */
1387  function wp_page_menu( $args = array() ) {
1388      $defaults = array(
1389          'sort_column'  => 'menu_order, post_title',
1390          'menu_id'      => '',
1391          'menu_class'   => 'menu',
1392          'container'    => 'div',
1393          'echo'         => true,
1394          'link_before'  => '',
1395          'link_after'   => '',
1396          'before'       => '<ul>',
1397          'after'        => '</ul>',
1398          'item_spacing' => 'discard',
1399          'walker'       => '',
1400      );
1401      $args     = wp_parse_args( $args, $defaults );
1402  
1403      if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ) ) ) {
1404          // invalid value, fall back to default.
1405          $args['item_spacing'] = $defaults['item_spacing'];
1406      }
1407  
1408      if ( 'preserve' === $args['item_spacing'] ) {
1409          $t = "\t";
1410          $n = "\n";
1411      } else {
1412          $t = '';
1413          $n = '';
1414      }
1415  
1416      /**
1417       * Filters the arguments used to generate a page-based menu.
1418       *
1419       * @since 2.7.0
1420       *
1421       * @see wp_page_menu()
1422       *
1423       * @param array $args An array of page menu arguments.
1424       */
1425      $args = apply_filters( 'wp_page_menu_args', $args );
1426  
1427      $menu = '';
1428  
1429      $list_args = $args;
1430  
1431      // Show Home in the menu
1432      if ( ! empty( $args['show_home'] ) ) {
1433          if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) {
1434              $text = __( 'Home' );
1435          } else {
1436              $text = $args['show_home'];
1437          }
1438          $class = '';
1439          if ( is_front_page() && ! is_paged() ) {
1440              $class = 'class="current_page_item"';
1441          }
1442          $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
1443          // If the front page is a page, add it to the exclude list
1444          if ( get_option( 'show_on_front' ) == 'page' ) {
1445              if ( ! empty( $list_args['exclude'] ) ) {
1446                  $list_args['exclude'] .= ',';
1447              } else {
1448                  $list_args['exclude'] = '';
1449              }
1450              $list_args['exclude'] .= get_option( 'page_on_front' );
1451          }
1452      }
1453  
1454      $list_args['echo']     = false;
1455      $list_args['title_li'] = '';
1456      $menu                 .= wp_list_pages( $list_args );
1457  
1458      $container = sanitize_text_field( $args['container'] );
1459  
1460      // Fallback in case `wp_nav_menu()` was called without a container.
1461      if ( empty( $container ) ) {
1462          $container = 'div';
1463      }
1464  
1465      if ( $menu ) {
1466  
1467          // wp_nav_menu doesn't set before and after
1468          if ( isset( $args['fallback_cb'] ) &&
1469              'wp_page_menu' === $args['fallback_cb'] &&
1470              'ul' !== $container ) {
1471              $args['before'] = "<ul>{$n}";
1472              $args['after']  = '</ul>';
1473          }
1474  
1475          $menu = $args['before'] . $menu . $args['after'];
1476      }
1477  
1478      $attrs = '';
1479      if ( ! empty( $args['menu_id'] ) ) {
1480          $attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"';
1481      }
1482  
1483      if ( ! empty( $args['menu_class'] ) ) {
1484          $attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"';
1485      }
1486  
1487      $menu = "<{$container}{$attrs}>" . $menu . "</{$container}>{$n}";
1488  
1489      /**
1490       * Filters the HTML output of a page-based menu.
1491       *
1492       * @since 2.7.0
1493       *
1494       * @see wp_page_menu()
1495       *
1496       * @param string $menu The HTML output.
1497       * @param array  $args An array of arguments.
1498       */
1499      $menu = apply_filters( 'wp_page_menu', $menu, $args );
1500      if ( $args['echo'] ) {
1501          echo $menu;
1502      } else {
1503          return $menu;
1504      }
1505  }
1506  
1507  //
1508  // Page helpers
1509  //
1510  
1511  /**
1512   * Retrieve HTML list content for page list.
1513   *
1514   * @uses Walker_Page to create HTML list content.
1515   * @since 2.1.0
1516   *
1517   * @param array $pages
1518   * @param int   $depth
1519   * @param int   $current_page
1520   * @param array $r
1521   * @return string
1522   */
1523  function walk_page_tree( $pages, $depth, $current_page, $r ) {
1524      if ( empty( $r['walker'] ) ) {
1525          $walker = new Walker_Page;
1526      } else {
1527          $walker = $r['walker'];
1528      }
1529  
1530      foreach ( (array) $pages as $page ) {
1531          if ( $page->post_parent ) {
1532              $r['pages_with_children'][ $page->post_parent ] = true;
1533          }
1534      }
1535  
1536      $args = array( $pages, $depth, $r, $current_page );
1537      return call_user_func_array( array( $walker, 'walk' ), $args );
1538  }
1539  
1540  /**
1541   * Retrieve HTML dropdown (select) content for page list.
1542   *
1543   * @uses Walker_PageDropdown to create HTML dropdown content.
1544   * @since 2.1.0
1545   * @see Walker_PageDropdown::walk() for parameters and return description.
1546   *
1547   * @return string
1548   */
1549  function walk_page_dropdown_tree() {
1550      $args = func_get_args();
1551      if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter
1552          $walker = new Walker_PageDropdown;
1553      } else {
1554          $walker = $args[2]['walker'];
1555      }
1556  
1557      return call_user_func_array( array( $walker, 'walk' ), $args );
1558  }
1559  
1560  //
1561  // Attachments
1562  //
1563  
1564  /**
1565   * Display an attachment page link using an image or icon.
1566   *
1567   * @since 2.0.0
1568   *
1569   * @param int|WP_Post $id Optional. Post ID or post object.
1570   * @param bool        $fullsize     Optional, default is false. Whether to use full size.
1571   * @param bool        $deprecated   Deprecated. Not used.
1572   * @param bool        $permalink    Optional, default is false. Whether to include permalink.
1573   */
1574  function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
1575      if ( ! empty( $deprecated ) ) {
1576          _deprecated_argument( __FUNCTION__, '2.5.0' );
1577      }
1578  
1579      if ( $fullsize ) {
1580          echo wp_get_attachment_link( $id, 'full', $permalink );
1581      } else {
1582          echo wp_get_attachment_link( $id, 'thumbnail', $permalink );
1583      }
1584  }
1585  
1586  /**
1587   * Retrieve an attachment page link using an image or icon, if possible.
1588   *
1589   * @since 2.5.0
1590   * @since 4.4.0 The `$id` parameter can now accept either a post ID or `WP_Post` object.
1591   *
1592   * @param int|WP_Post  $id        Optional. Post ID or post object.
1593   * @param string|array $size      Optional. Image size. Accepts any valid image size, or an array
1594   *                                of width and height values in pixels (in that order).
1595   *                                Default 'thumbnail'.
1596   * @param bool         $permalink Optional, Whether to add permalink to image. Default false.
1597   * @param bool         $icon      Optional. Whether the attachment is an icon. Default false.
1598   * @param string|false $text      Optional. Link text to use. Activated by passing a string, false otherwise.
1599   *                                Default false.
1600   * @param array|string $attr      Optional. Array or string of attributes. Default empty.
1601   * @return string HTML content.
1602   */
1603  function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
1604      $_post = get_post( $id );
1605  
1606      if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) {
1607          return __( 'Missing Attachment' );
1608      }
1609  
1610      if ( $permalink ) {
1611          $url = get_attachment_link( $_post->ID );
1612      }
1613  
1614      if ( $text ) {
1615          $link_text = $text;
1616      } elseif ( $size && 'none' != $size ) {
1617          $link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr );
1618      } else {
1619          $link_text = '';
1620      }
1621  
1622      if ( '' === trim( $link_text ) ) {
1623          $link_text = $_post->post_title;
1624      }
1625  
1626      if ( '' === trim( $link_text ) ) {
1627          $link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) );
1628      }
1629      /**
1630       * Filters a retrieved attachment page link.
1631       *
1632       * @since 2.7.0
1633       * @since 5.1.0 Added the $attr parameter.
1634       *
1635       * @param string       $link_html The page link HTML output.
1636       * @param int          $id        Post ID.
1637       * @param string|array $size      Size of the image. Image size or array of width and height values (in that order).
1638       *                                Default 'thumbnail'.
1639       * @param bool         $permalink Whether to add permalink to image. Default false.
1640       * @param bool         $icon      Whether to include an icon. Default false.
1641       * @param string|bool  $text      If string, will be link text. Default false.
1642       * @param array|string $attr      Array or string of attributes. Default empty.
1643       */
1644      return apply_filters( 'wp_get_attachment_link', "<a href='" . esc_url( $url ) . "'>$link_text</a>", $id, $size, $permalink, $icon, $text, $attr );
1645  }
1646  
1647  /**
1648   * Wrap attachment in paragraph tag before content.
1649   *
1650   * @since 2.0.0
1651   *
1652   * @param string $content
1653   * @return string
1654   */
1655  function prepend_attachment( $content ) {
1656      $post = get_post();
1657  
1658      if ( empty( $post->post_type ) || $post->post_type != 'attachment' ) {
1659          return $content;
1660      }
1661  
1662      if ( wp_attachment_is( 'video', $post ) ) {
1663          $meta = wp_get_attachment_metadata( get_the_ID() );
1664          $atts = array( 'src' => wp_get_attachment_url() );
1665          if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
1666              $atts['width']  = (int) $meta['width'];
1667              $atts['height'] = (int) $meta['height'];
1668          }
1669          if ( has_post_thumbnail() ) {
1670              $atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() );
1671          }
1672          $p = wp_video_shortcode( $atts );
1673      } elseif ( wp_attachment_is( 'audio', $post ) ) {
1674          $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
1675      } else {
1676          $p = '<p class="attachment">';
1677          // show the medium sized image representation of the attachment if available, and link to the raw file
1678          $p .= wp_get_attachment_link( 0, 'medium', false );
1679          $p .= '</p>';
1680      }
1681  
1682      /**
1683       * Filters the attachment markup to be prepended to the post content.
1684       *
1685       * @since 2.0.0
1686       *
1687       * @see prepend_attachment()
1688       *
1689       * @param string $p The attachment HTML output.
1690       */
1691      $p = apply_filters( 'prepend_attachment', $p );
1692  
1693      return "$p\n$content";
1694  }
1695  
1696  //
1697  // Misc
1698  //
1699  
1700  /**
1701   * Retrieve protected post password form content.
1702   *
1703   * @since 1.0.0
1704   *
1705   * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1706   * @return string HTML content for password form for password protected post.
1707   */
1708  function get_the_password_form( $post = 0 ) {
1709      $post   = get_post( $post );
1710      $label  = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID );
1711      $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
1712      <p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
1713      <p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>
1714      ';
1715  
1716      /**
1717       * Filters the HTML output for the protected post password form.
1718       *
1719       * If modifying the password field, please note that the core database schema
1720       * limits the password field to 20 characters regardless of the value of the
1721       * size attribute in the form input.
1722       *
1723       * @since 2.7.0
1724       *
1725       * @param string $output The password form HTML output.
1726       */
1727      return apply_filters( 'the_password_form', $output );
1728  }
1729  
1730  /**
1731   * Determines whether currently in a page template.
1732   *
1733   * This template tag allows you to determine if you are in a page template.
1734   * You can optionally provide a template name or array of template names
1735   * and then the check will be specific to that template.
1736   *
1737   * For more information on this and similar theme functions, check out
1738   * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
1739   * Conditional Tags} article in the Theme Developer Handbook.
1740   *
1741   * @since 2.5.0
1742   * @since 4.2.0 The `$template` parameter was changed to also accept an array of page templates.
1743   * @since 4.7.0 Now works with any post type, not just pages.
1744   *
1745   * @param string|array $template The specific template name or array of templates to match.
1746   * @return bool True on success, false on failure.
1747   */
1748  function is_page_template( $template = '' ) {
1749      if ( ! is_singular() ) {
1750          return false;
1751      }
1752  
1753      $page_template = get_page_template_slug( get_queried_object_id() );
1754  
1755      if ( empty( $template ) ) {
1756          return (bool) $page_template;
1757      }
1758  
1759      if ( $template == $page_template ) {
1760          return true;
1761      }
1762  
1763      if ( is_array( $template ) ) {
1764          if ( ( in_array( 'default', $template, true ) && ! $page_template )
1765              || in_array( $page_template, $template, true )
1766          ) {
1767              return true;
1768          }
1769      }
1770  
1771      return ( 'default' === $template && ! $page_template );
1772  }
1773  
1774  /**
1775   * Get the specific template name for a given post.
1776   *
1777   * @since 3.4.0
1778   * @since 4.7.0 Now works with any post type, not just pages.
1779   *
1780   * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1781   * @return string|false Page template filename. Returns an empty string when the default page template
1782   *  is in use. Returns false if the post does not exist.
1783   */
1784  function get_page_template_slug( $post = null ) {
1785      $post = get_post( $post );
1786  
1787      if ( ! $post ) {
1788          return false;
1789      }
1790  
1791      $template = get_post_meta( $post->ID, '_wp_page_template', true );
1792  
1793      if ( ! $template || 'default' == $template ) {
1794          return '';
1795      }
1796  
1797      return $template;
1798  }
1799  
1800  /**
1801   * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
1802   *
1803   * @since 2.6.0
1804   *
1805   * @param int|object $revision Revision ID or revision object.
1806   * @param bool       $link     Optional, default is true. Link to revisions's page?
1807   * @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
1808   */
1809  function wp_post_revision_title( $revision, $link = true ) {
1810      if ( ! $revision = get_post( $revision ) ) {
1811          return $revision;
1812      }
1813  
1814      if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
1815          return false;
1816      }
1817  
1818      /* translators: revision date format, see https://secure.php.net/date */
1819      $datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
1820      /* translators: %s: revision date */
1821      $autosavef = __( '%s [Autosave]' );
1822      /* translators: %s: revision date */
1823      $currentf = __( '%s [Current Revision]' );
1824  
1825      $date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1826      if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) {
1827          $date = "<a href='$link'>$date</a>";
1828      }
1829  
1830      if ( ! wp_is_post_revision( $revision ) ) {
1831          $date = sprintf( $currentf, $date );
1832      } elseif ( wp_is_post_autosave( $revision ) ) {
1833          $date = sprintf( $autosavef, $date );
1834      }
1835  
1836      return $date;
1837  }
1838  
1839  /**
1840   * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
1841   *
1842   * @since 3.6.0
1843   *
1844   * @param int|object $revision Revision ID or revision object.
1845   * @param bool       $link     Optional, default is true. Link to revisions's page?
1846   * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
1847   */
1848  function wp_post_revision_title_expanded( $revision, $link = true ) {
1849      if ( ! $revision = get_post( $revision ) ) {
1850          return $revision;
1851      }
1852  
1853      if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
1854          return false;
1855      }
1856  
1857      $author = get_the_author_meta( 'display_name', $revision->post_author );
1858      /* translators: revision date format, see https://secure.php.net/date */
1859      $datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
1860  
1861      $gravatar = get_avatar( $revision->post_author, 24 );
1862  
1863      $date = date_i18n( $datef, strtotime( $revision->post_modified ) );
1864      if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) {
1865          $date = "<a href='$link'>$date</a>";
1866      }
1867  
1868      $revision_date_author = sprintf(
1869          /* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */
1870          __( '%1$s %2$s, %3$s ago (%4$s)' ),
1871          $gravatar,
1872          $author,
1873          human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ),
1874          $date
1875      );
1876  
1877      /* translators: %s: revision date with author avatar */
1878      $autosavef = __( '%s [Autosave]' );
1879      /* translators: %s: revision date with author avatar */
1880      $currentf = __( '%s [Current Revision]' );
1881  
1882      if ( ! wp_is_post_revision( $revision ) ) {
1883          $revision_date_author = sprintf( $currentf, $revision_date_author );
1884      } elseif ( wp_is_post_autosave( $revision ) ) {
1885          $revision_date_author = sprintf( $autosavef, $revision_date_author );
1886      }
1887  
1888      /**
1889       * Filters the formatted author and date for a revision.
1890       *
1891       * @since 4.4.0
1892       *
1893       * @param string  $revision_date_author The formatted string.
1894       * @param WP_Post $revision             The revision object.
1895       * @param bool    $link                 Whether to link to the revisions page, as passed into
1896       *                                      wp_post_revision_title_expanded().
1897       */
1898      return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link );
1899  }
1900  
1901  /**
1902   * Display a list of a post's revisions.
1903   *
1904   * Can output either a UL with edit links or a TABLE with diff interface, and
1905   * restore action links.
1906   *
1907   * @since 2.6.0
1908   *
1909   * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
1910   * @param string      $type    'all' (default), 'revision' or 'autosave'
1911   */
1912  function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
1913      if ( ! $post = get_post( $post_id ) ) {
1914          return;
1915      }
1916  
1917      // $args array with (parent, format, right, left, type) deprecated since 3.6
1918      if ( is_array( $type ) ) {
1919          $type = ! empty( $type['type'] ) ? $type['type'] : $type;
1920          _deprecated_argument( __FUNCTION__, '3.6.0' );
1921      }
1922  
1923      if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) {
1924          return;
1925      }
1926  
1927      $rows = '';
1928      foreach ( $revisions as $revision ) {
1929          if ( ! current_user_can( 'read_post', $revision->ID ) ) {
1930              continue;
1931          }
1932  
1933          $is_autosave = wp_is_post_autosave( $revision );
1934          if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) {
1935              continue;
1936          }
1937  
1938          $rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
1939      }
1940  
1941      echo "<div class='hide-if-js'><p>" . __( 'JavaScript must be enabled to use this feature.' ) . "</p></div>\n";
1942  
1943      echo "<ul class='post-revisions hide-if-no-js'>\n";
1944      echo $rows;
1945      echo '</ul>';
1946  }


Generated: Mon Jun 17 08:20:02 2019 Cross-referenced by PHPXref 0.7