forked from WordPress/wordpress.org
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blockify everything, prefering HTML+blocks rather than patterns.
- Loading branch information
Showing
25 changed files
with
2,046 additions
and
210 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
.../public_html/wp-content/themes/pub/wporg-plugins-2024/client/components/_plugin-card.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +0,0 @@ | ||
<?php | ||
/** | ||
* The main template file. | ||
* | ||
* This is the most generic template file in a WordPress theme | ||
* and one of the two required files for a theme (the other being style.css). | ||
* It is used to display a page when nothing more specific matches a query. | ||
* E.g., it puts together the home page when no home.php file exists. | ||
* | ||
* @link https://codex.wordpress.org/Template_Hierarchy | ||
* | ||
* @package WordPressdotorg\Plugin_Directory\Theme | ||
*/ | ||
|
||
namespace WordPressdotorg\Plugin_Directory\Theme; | ||
|
||
get_header(); | ||
?> | ||
|
||
<main id="main" class="site-main" role="main"> | ||
|
||
<?php | ||
if ( have_posts() ) : | ||
if ( is_home() && ! is_front_page() ) : | ||
?> | ||
<header> | ||
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1> | ||
</header> | ||
<?php | ||
endif; | ||
|
||
/* Start the Loop */ | ||
while ( have_posts() ) : | ||
the_post(); | ||
|
||
get_template_part( 'template-parts/plugin', 'index' ); | ||
endwhile; | ||
|
||
the_posts_pagination(); | ||
|
||
else : | ||
get_template_part( 'template-parts/no-results' ); | ||
endif; | ||
?> | ||
|
||
</main><!-- #main --> | ||
|
||
<?php | ||
get_footer(); | ||
28 changes: 28 additions & 0 deletions
28
.../wp-content/themes/pub/wporg-plugins-2024/js/build/blocks/missing-template-tag/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 2, | ||
"name": "wporg/missing-template-tag", | ||
"version": "0.1.0", | ||
"title": "Missing Template Tag", | ||
"category": "design", | ||
"icon": "", | ||
"description": "A block that executes a missing template tag.", | ||
"textdomain": "wporg", | ||
"attributes": { | ||
"function": { | ||
"type": "string", | ||
"enum": [ | ||
"the_posts_pagination", | ||
"the_archive_description" | ||
] | ||
}, | ||
"args": { | ||
"type": "array" | ||
} | ||
}, | ||
"supports": { | ||
"html": false | ||
}, | ||
"editorScript": "file:./index.js", | ||
"render": "file:./render.php" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../wp-content/themes/pub/wporg-plugins-2024/js/build/blocks/missing-template-tag/render.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$function = $attributes['function'] ?? false; | ||
$args = $attributes['args'] ?? []; | ||
$valid_functions = [ | ||
'the_posts_pagination', | ||
'the_archive_description' | ||
]; | ||
|
||
// Validated by block.json enum, but duplicated here. | ||
if ( $function && in_array( $function, $valid_functions ) && function_exists( $function ) ) { | ||
call_user_func_array( $function, $args ); | ||
} |
20 changes: 20 additions & 0 deletions
20
...blic_html/wp-content/themes/pub/wporg-plugins-2024/js/build/blocks/plugin-card/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 2, | ||
"name": "wporg/plugin-card", | ||
"version": "0.1.0", | ||
"title": "Single Plugin Card", | ||
"category": "design", | ||
"icon": "", | ||
"description": "A block that displays the single plugin card", | ||
"textdomain": "wporg", | ||
"attributes": {}, | ||
"supports": { | ||
"html": false | ||
}, | ||
"usesContext": [ | ||
"postId" | ||
], | ||
"editorScript": "file:./index.js", | ||
"render": "file:./render.php" | ||
} |
32 changes: 32 additions & 0 deletions
32
...ublic_html/wp-content/themes/pub/wporg-plugins-2024/js/build/blocks/plugin-card/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Block Name: Single Plugin | ||
* Description: The content that is displayed on the single plugin page | ||
* | ||
* @package wporg | ||
*/ | ||
|
||
namespace WordPressdotorg\Theme\Plugins_2024\PluginCard; | ||
|
||
add_action( 'init', __NAMESPACE__ . '\init' ); | ||
|
||
/** | ||
* Registers the block using the metadata loaded from the `block.json` file. | ||
* Behind the scenes, it registers also all assets so they can be enqueued | ||
* through the block editor in the corresponding context. | ||
* | ||
* @see https://developer.wordpress.org/reference/functions/register_block_type/ | ||
*/ | ||
function init() { | ||
register_block_type( __DIR__ . '/../../../js/build/blocks/plugin-card' ); | ||
} | ||
|
||
// TODO: Figure out how to add a post_class for wrapping a block... | ||
add_filter( 'render_block_core/post-template', function( $html, $block ) { | ||
// If the post-template has the 'plugin-cards' class, add the 'plugin-card' class to the child blocks | ||
if ( ! empty( $block['attrs']['className'] ) && str_contains( $block['attrs']['className'], 'plugin-cards' ) ) { | ||
$html = str_replace( 'class="wp-block-post ', 'class="wp-block-post plugin-card ', $html ); | ||
} | ||
|
||
return $html; | ||
}, 10, 2 ); |
2 changes: 2 additions & 0 deletions
2
...blic_html/wp-content/themes/pub/wporg-plugins-2024/js/build/blocks/plugin-card/render.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
get_template_part( 'template-parts/plugin' ); |
2 changes: 1 addition & 1 deletion
2
wordpress.org/public_html/wp-content/themes/pub/wporg-plugins-2024/js/build/theme.asset.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'wp-element'), 'version' => '43ab82ac4ef93561f4cc'); | ||
<?php return array('dependencies' => array('react', 'wp-element'), 'version' => '4967f0d80ed01cf03524'); |
Oops, something went wrong.