Skip to content

Commit

Permalink
Stop hiding Last Updated date for GitHub handbooks
Browse files Browse the repository at this point in the history
Closes #456
  • Loading branch information
adamwoodnz committed Jan 8, 2024
1 parent ebe83c6 commit 7b5a3df
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions source/wp-content/themes/wporg-developer-2023/inc/block-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ function get_block_content_by_home_url( $block_content, $replacement_home_url =
* @return string
*/
function filter_article_meta_block( $block_content, $block ) {
// Not all handbooks come from GitHub.
$local_handbooks = array( 'plugin-handbook', 'theme-handbook' );

if ( 'wporg/article-meta-github' === $block['blockName'] ) {
// Not all handbooks come from GitHub.
$local_handbooks = array( 'plugin-handbook', 'theme-handbook' );
$post_type = get_post_type();

if ( in_array( $post_type, $local_handbooks ) ) {
Expand All @@ -76,16 +75,5 @@ function filter_article_meta_block( $block_content, $block ) {
}
}

if ( 'wporg/article-meta-date' === $block['blockName'] ) {
$post_type = get_post_type();

// Last modified date for handbooks from GitHub is the last import date, rather than the edited date.
// Don't display until we have the edited date from GitHub.
// See https://github.com/WordPress/wporg-developer/issues/456
if ( wporg_is_handbook_post_type() && ! in_array( $post_type, $local_handbooks ) && '[last_updated]' === $block['attrs']['heading'] ) {
return '';
}
}

return $block_content;
}

0 comments on commit 7b5a3df

Please sign in to comment.