-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test AMP compatibility of entire site #1183
Changes from 1 commit
305c28b
9e9df92
fd50993
1324044
3c4db61
bbfafa4
db54a53
6713ff3
2655310
32ab635
1a862c7
c250bd5
71f7543
4aade51
584ffea
ae4371c
7b67efe
15ec0ed
1ef10a7
ba08f3d
bfe37a8
3d9a01c
c586c24
128ca9c
441044f
875d4ee
4e8c00c
c4b8f5f
c28e5ee
b6393cc
c638e7e
ad43100
5af8dc9
adcb901
9d11439
5e19020
f4e6bfd
8e1b031
a4c1f7a
ce2b044
cd1d09e
edfdd65
19f4feb
e34ebda
57411c6
6802175
a53bb45
d44cde9
71f4fcb
ff3a5c0
d378a37
4f8b3e9
4ea25bf
dadab10
c687ea0
09fa083
eadb61c
e8717fd
13a0cc7
f054f13
be32dcf
ff8d365
1387c5b
41cffdc
0202432
bff8fc7
5d0d464
86cd224
c31fa0e
be8d552
3dac2fd
fe8eab3
b741f01
4cf9e9d
907facd
52ff854
ab9c2d9
1f8f40b
aca16f4
2637fb8
da22efc
bfadbe2
30f7522
e1760aa
ad7e0e2
7a52751
8e2d028
edcb23a
0e9bf1b
a83a569
19ead16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,7 +96,7 @@ public static function register() { | |
'supports' => false, | ||
'public' => false, | ||
'show_ui' => true, | ||
'show_in_menu' => AMP_Options_Manager::OPTION_NAME, | ||
'show_in_menu' => ( self::should_show_in_menu() || AMP_Validation_Error_Taxonomy::should_show_in_menu() ) ? AMP_Options_Manager::OPTION_NAME : false, | ||
// @todo Show in rest. | ||
) | ||
); | ||
|
@@ -109,6 +109,22 @@ public static function register() { | |
} | ||
} | ||
|
||
/** | ||
* Determine whether the admin menu item should be included. | ||
* | ||
* @return bool Whether to show in menu. | ||
*/ | ||
public static function should_show_in_menu() { | ||
global $pagenow; | ||
if ( current_theme_supports( 'amp' ) ) { | ||
return true; | ||
} | ||
if ( 'edit.php' === $pagenow && ( isset( $_GET['post_type'] ) && self::POST_TYPE_SLUG === $_GET['post_type'] ) ) { // WPCS: CSRF OK. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not return the result of the conditional instead of explicitedly retuning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Done in a83a569. |
||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Add admin hooks. | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,7 @@ public static function register() { | |
'show_tagcloud' => false, | ||
'show_in_quick_edit' => false, | ||
'hierarchical' => false, // Or true? Code could be the parent term? | ||
'show_in_menu' => true, | ||
'show_in_menu' => ( self::should_show_in_menu() || AMP_Invalid_URL_Post_Type::should_show_in_menu() ), | ||
'meta_box_cb' => false, // See print_validation_errors_meta_box(). | ||
'capabilities' => array( | ||
'assign_terms' => 'do_not_allow', | ||
|
@@ -162,6 +162,22 @@ public static function register() { | |
self::accept_validation_errors( AMP_Core_Theme_Sanitizer::get_acceptable_errors( get_template() ) ); | ||
} | ||
|
||
/** | ||
* Determine whether the admin menu item should be included. | ||
* | ||
* @return bool Whether to show in menu. | ||
*/ | ||
public static function should_show_in_menu() { | ||
global $pagenow; | ||
if ( current_theme_supports( 'amp' ) ) { | ||
return true; | ||
} | ||
if ( 'edit-tags.php' === $pagenow && ( isset( $_GET['taxonomy'] ) && self::TAXONOMY_SLUG === $_GET['taxonomy'] ) ) { // WPCS: CSRF OK. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here....return the result of the conditional expression instead of explicit |
||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Prepare a validation error for lookup or insertion as taxonomy term. | ||
* | ||
|
@@ -459,7 +475,9 @@ public static function add_admin_hooks() { | |
add_filter( 'terms_clauses', array( __CLASS__, 'filter_terms_clauses_for_description_search' ), 10, 3 ); | ||
add_action( 'admin_notices', array( __CLASS__, 'add_admin_notices' ) ); | ||
add_filter( 'tag_row_actions', array( __CLASS__, 'filter_tag_row_actions' ), 10, 2 ); | ||
add_action( 'admin_menu', array( __CLASS__, 'add_admin_menu_validation_error_item' ) ); | ||
if ( get_taxonomy( self::TAXONOMY_SLUG )->show_in_menu ) { | ||
add_action( 'admin_menu', array( __CLASS__, 'add_admin_menu_validation_error_item' ) ); | ||
} | ||
add_filter( 'manage_' . self::TAXONOMY_SLUG . '_custom_column', array( __CLASS__, 'filter_manage_custom_columns' ), 10, 3 ); | ||
add_filter( 'views_edit-' . self::TAXONOMY_SLUG, array( __CLASS__, 'filter_views_edit' ) ); | ||
add_filter( 'posts_where', array( __CLASS__, 'filter_posts_where_for_validation_error_status' ), 10, 2 ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional will capture the Template Mode being Classic, though maybe you had in mind a more narrow check, like: