Skip to content
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

Init new theme #8

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ phpcs.xml.dist
# ...except the actual source of this project.
!/source/wp-content/themes
!/source/wp-content/themes/wporg-developer-2023
!/source/wp-content/themes/wpr-developer-2024
3 changes: 2 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"./source/wp-content/plugins/jetpack"
],
"themes": [
"./source/wp-content/themes/wpr-developer-2024",
"./source/wp-content/themes/wporg-developer-2023",
"./source/wp-content/themes/wporg-parent-2021"
],
Expand All @@ -27,6 +28,6 @@
"wp-content/mu-plugins": "./source/wp-content/mu-plugins",
"wp-content/mu-plugins/0-sandbox.php": "./env/0-sandbox.php",
"wp-content/plugins/phpdoc-parser": "./source/wp-content/plugins/phpdoc-parser",
"wp-content/wp-rocket": "./source/wp-content/wp-rocket"
"wp-content/plugins/wp-rocket": "./source/wp-content/plugins/wp-rocket"
}
}
36 changes: 36 additions & 0 deletions source/wp-content/themes/wpr-developer-2024/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = function( grunt ) {

const sass = require('node-sass');

// Load tasks.
require( 'matchdep' ).filterDev(['grunt-*']).forEach( grunt.loadNpmTasks );

// Project configuration.
grunt.initConfig({
sass: {
all: {
expand: true,
cwd: "scss",
dest: "stylesheets",
ext: '.css',
src: [ '**/*.scss' ],
options: {
implementation: sass,
outputStyle: 'expanded'
}
}
},
watch: {
all: {
files: [ "scss/**/*.scss" ],
tasks: [ "sass:all" ],
options: {
spawn: false
}
}
}
});

grunt.registerTask( 'default', [ 'sass:all' ] );
};

15 changes: 15 additions & 0 deletions source/wp-content/themes/wpr-developer-2024/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# developer.wordpress.org

developer.wordpress.org is the forthcoming resource for developers working with WordPress

There are a number of ways to get involved:

* get set up with the [devhub development environment](https://make.wordpress.org/docs/handbook/projects/devhub) to help with development
* help out with the [inline docs efforts](http://make.wordpress.org/core/tag/inline-docs)
* help out with the [plugin](http://make.wordpress.org/docs/plugin-developer-handbook/) and [theme](http://make.wordpress.org/docs/theme-developer-handbook/) developer handbooks

The regular devhub meeting is on Tuesdays at 15:00 UTC in irc.freenode.net #wordpress-sfd.

Discussion occurs on [make.wordpress.org/docs](http://make.wordpress.org/docs/tag/devhub/)

Issues are on trac on the [developer.wordpress.org component](https://meta.trac.wordpress.org/query?status=!closed&component=developer.wordpress.org).
213 changes: 213 additions & 0 deletions source/wp-content/themes/wpr-developer-2024/embed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<?php
/**
* Modified version of the embed template from wp-includes/embed-template.php
*
* @package wporg-developer
*/

remove_action( 'embed_content_meta', 'print_embed_comments_button' );

if ( ! headers_sent() ) {
header( 'X-WP-embed: true' );
}

/**
* Returns list of parameter => data type.
*
* @param int $post_id
*
* @return array
*/
function get_params( $post_id ) {
$tags = get_post_meta( $post_id, '_wp-parser_tags', true );
$params = array();

if ( $tags ) {
foreach ( $tags as $tag ) {
if ( is_array( $tag ) && 'param' == $tag['name'] ) {
$params[ $tag['variable'] ] = implode( ' | ', $tag['types'] );
}
}
}

return $params;
}

/**
* Returns a function string to display.
*
* @param int $post_id
*
* @return string
*/
function get_signature( $post_id ) {
$title = get_the_title();
$has_args = count( get_params( $post_id ) ) > 0;
$post_type = get_post_type( $post_id );

if ( 'wp-parser-hook' === $post_type ) {
$hook_type = DevHub\get_hook_type_name( $post_id );
$delimiter = false !== strpos( $title, '$' ) ? '"' : "'";

if ( $has_args ) {
return "{$hook_type}( <span class=\"wp-embed-hook\">{$delimiter}{$title}{$delimiter},</span> ... )";
}
return "{$hook_type}( <span class=\"wp-embed-hook\">{$delimiter}{$title}{$delimiter}</span> )";
}

if ( 'wp-parser-class' === $post_type ) {
return 'class ' . $title . ' {}';
}

if ( $has_args ) {
return $title . '( ... )';
}

return $title . '()';
}

$embed_post_id = get_the_ID();
$params = get_params( $embed_post_id );
$embed_title = get_signature( $embed_post_id );
$param_count = count( $params );
$parameter_display_max = 4; // We truncate the display of params

?>
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<head>
<title><?php echo esc_html( wp_get_document_title() ); ?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php
/**
* Print scripts or data in the embed template <head> tag.
*
* @since 4.4.0
*/
do_action( 'embed_head' );
?>
<style>
.wp-embed {
color: #50575e;
}

code {
background: #efefef;
border-radius: 4px;
padding: 2px 6px;
font-weight: 400;
}

p.wp-embed-heading {
font-weight: normal;
font-size: 1.25rem;
font-family:
Hack, "Fira Code", Consolas, Menlo, Monaco, "Andale Mono",
"Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono",
"Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L",
"Courier New", Courier, monospace;
}

.wp-embed-parameters-title {
margin: 16px 0 8px;
font-size: 14px;
font-weight: normal;
}

.wp-embed-parameters ul {
margin: 0 0 0 8px;
padding: 0;
list-style: none;
}

.wp-embed-parameters ul li {
padding: 4px;
}

.wp-embed-parameters code {
margin-inline-end: 8px;
}

.wp-embed-hook {
color: #24831d;
}

.wp-embed-footer a {
color: #135e96;
}
</style>

</head>
<body <?php body_class(); ?>>
<div <?php post_class( 'wp-embed' ); ?>>

<p class="wp-embed-heading">
<a href="<?php the_permalink(); ?>" target="_top">
<?php echo wp_kses_post( $embed_title ); ?>
</a>
</p>

<div class="wp-embed-excerpt">
<?php the_excerpt(); ?>

<?php if ( $params ) : ?>
<div class="wp-embed-parameters">
<h6 class="wp-embed-parameters-title"><?php echo esc_html__( 'Parameters:', 'wporg' ); ?></h6>
<ul>
<?php
for ( $i = 0; $i < min( $param_count, $parameter_display_max ); $i++ ) {
$key = array_keys( $params )[ $i ];
?>
<li>
<code><?php echo esc_html( $key ); ?></code>
<span class="wp-embed-parameters-type"><?php echo esc_html( $params[ $key ] ); ?></span>
</li>
<?php } ?>

<?php
if ( ! empty( $params ) && $param_count > $parameter_display_max ) {
/* translators: %d number of non printed parameter */
echo '<li>' . sprintf( '... %s more', esc_attr( $param_count - $parameter_display_max ) ) . '</li>';
}
?>
</ul>
</div>
<?php endif; ?>

</div>

<?php
/**
* Print additional content after the embed excerpt.
*
* @since 4.4.0
*/
do_action( 'embed_content' );
?>

<div class="wp-embed-footer">
<?php the_embed_site_title(); ?>

<div class="wp-embed-meta">
<?php
/**
* Prints additional meta content in the embed template.
*
* @since 4.4.0
*/
do_action( 'embed_content_meta' );
?>
</div>

<?php
/**
* Print scripts or data before the closing body tag in the embed template.
*
* @since 4.4.0
*/
do_action( 'embed_footer' );
?>
</div>
</div>
</body>
</html>
Loading