html-admin-acf-header.php 933 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. //phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included template file.
  3. global $post_type, $post_type_object, $acf_page_title;
  4. $post_new_file = sprintf(
  5. 'post-new.php?post_type=%s',
  6. is_string( $post_type ) ? $post_type : 'acf-field-group'
  7. );
  8. $page_title = false;
  9. if ( isset( $acf_page_title ) ) {
  10. $page_title = $acf_page_title;
  11. } elseif ( is_object( $post_type_object ) ) {
  12. $page_title = $post_type_object->labels->name;
  13. }
  14. if ( $page_title ) {
  15. ?>
  16. <div class="acf-headerbar">
  17. <h1 class="acf-page-title">
  18. <?php
  19. echo esc_html( $page_title );
  20. ?>
  21. </h1>
  22. <?php
  23. if ( ! empty( $post_type_object ) && current_user_can( $post_type_object->cap->create_posts ) ) {
  24. echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="acf-btn acf-btn-sm"><i class="acf-icon acf-icon-plus"></i>' . esc_html( $post_type_object->labels->add_new ) . '</a>';
  25. }
  26. ?>
  27. </div>
  28. <?php } ?>