This repository has been archived by the owner on May 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example theme / simple theme / adjust tests
- Loading branch information
WP
committed
Nov 13, 2022
1 parent
0c5f287
commit a54994c
Showing
40 changed files
with
696 additions
and
34 deletions.
There are no files selected for viewing
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 | ||
get_header(); | ||
?> | ||
|
||
<section> | ||
<header> | ||
<h1>404</h1> | ||
</header> | ||
<p>Page not found.</p> | ||
</section> | ||
|
||
<?php | ||
get_footer(); |
Binary file added
BIN
+282 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Cousine-Bold.ttf
Binary file not shown.
Binary file added
BIN
+259 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Cousine-BoldItalic.ttf
Binary file not shown.
Binary file added
BIN
+256 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Cousine-Italic.ttf
Binary file not shown.
Binary file added
BIN
+293 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Cousine-Regular.ttf
Binary file not shown.
Binary file added
BIN
+163 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added
BIN
+167 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file added
BIN
+167 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Roboto-Italic.ttf
Binary file not shown.
Binary file added
BIN
+164 KB
src/wp-content/themes/wp-cms-example-theme/assets/fonts/Roboto-Regular.ttf
Binary file not shown.
47 changes: 47 additions & 0 deletions
47
src/wp-content/themes/wp-cms-example-theme/assets/js/global.js
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,47 @@ | ||
const navigation = document.getElementById('navigation'); | ||
const editor = document.getElementById('editor'); | ||
const mainContent = document.getElementById('main-content'); | ||
const handle = document.getElementById('handle'); | ||
const lineNumbers = document.getElementById('line-numbers'); | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
handle.addEventListener('mousedown', setupEditorResizer, false); | ||
window.addEventListener('resize', updateLineNumbers); | ||
updateLineNumbers(); | ||
}); | ||
|
||
let StartX, contentStartWidth; | ||
|
||
function setupEditorResizer(event) { | ||
StartX = event.clientX; | ||
contentStartWidth = parseInt(window.getComputedStyle(navigation).width, 10); | ||
document.documentElement.addEventListener('mousemove', dragEditorResizerCallback, false); | ||
document.documentElement.addEventListener('mouseup', destroyEditorResizerCallback, false); | ||
} | ||
|
||
function dragEditorResizerCallback(event) { | ||
// Don't allow going under 280px or over 45% viewport width | ||
if (event.clientX > 280 && event.clientX < window.innerWidth * 0.45) { | ||
navigation.style.flexBasis = event.clientX + 'px'; | ||
updateLineNumbers(); | ||
} | ||
} | ||
|
||
function destroyEditorResizerCallback() { | ||
document.documentElement.removeEventListener('mousemove', dragEditorResizerCallback, false); | ||
document.documentElement.removeEventListener('mouseup', destroyEditorResizerCallback, false); | ||
} | ||
|
||
function updateLineNumbers() { | ||
// Remove all line numbers | ||
lineNumbers.querySelectorAll('i').forEach(n => n.remove()); | ||
|
||
// Set up the line numbers container height | ||
lineNumbers.style.height = mainContent.scrollHeight + 'px'; | ||
|
||
// Calculate how many line numbers we want and append them to the DOM | ||
const totalNumbers = (mainContent.scrollHeight) / 35; | ||
Array.from({length: totalNumbers}, () => { | ||
lineNumbers.appendChild(document.createElement("i")); | ||
}); | ||
} |
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,12 @@ | ||
</main><!-- /#main-content --> | ||
</div><!-- /#editor --> | ||
</div><!-- /#resizable-area --> | ||
|
||
<footer id="site-footer"> | ||
<span>wpcms.dev</span> | ||
</footer> | ||
|
||
<?php wp_footer(); ?> | ||
|
||
</body> | ||
</html> |
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,24 @@ | ||
<?php | ||
|
||
namespace wpcms\example_theme; | ||
|
||
// Let WP CMS manage the document title | ||
add_theme_support( 'title-tag' ); | ||
|
||
// Enable support for Post Thumbnails on posts and pages | ||
add_theme_support( 'post-thumbnails' ); | ||
|
||
// Include primary navigation menu | ||
function setup_navigation() { | ||
register_nav_menus( array( | ||
'primary-menu' => 'Primary Menu', | ||
) ); | ||
} | ||
add_action( 'init', 'wpcms\example_theme\setup_navigation' ); | ||
|
||
// Enqueue scripts and styles | ||
function enqueue_stuff() { | ||
wp_enqueue_style( 'general-style', get_stylesheet_uri() ); | ||
wp_enqueue_script( 'global-js', get_template_directory_uri() . '/assets/js/global.js', array(), '1.0.0', true ); | ||
} | ||
add_action( 'wp_enqueue_scripts', 'wpcms\example_theme\enqueue_stuff' ); |
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,39 @@ | ||
<!doctype html> | ||
<html <?php language_attributes(); ?>> | ||
<head> | ||
<meta charset="<?php bloginfo( 'charset' ); ?>"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<?php wp_head(); ?> | ||
</head> | ||
<body <?php body_class(); ?>> | ||
|
||
<a class="screen-reader-text" href="#main-content">Skip to content</a> | ||
|
||
<?php | ||
if ( ! is_admin_bar_showing() ) { | ||
?> | ||
<aside id="top-bar"> | ||
<span class="version">WP CMS v<?php bloginfo( 'version' ); ?></span> | ||
</aside> | ||
<?php | ||
} | ||
?> | ||
|
||
<div id="resizable-area"> | ||
<header id="navigation"> | ||
<h1 class="site-title"><a href="<?php echo esc_url( home_url() ); ?>"><?php bloginfo( 'name' ); ?></a></h1> | ||
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> | ||
<hr> | ||
<nav id="main-menu"> | ||
<?php | ||
wp_nav_menu( array( | ||
'theme_location' => 'primary-menu', | ||
'menu_id' => 'primary-menu', | ||
) ); | ||
?> | ||
</nav> | ||
<div id="handle"></div> | ||
</header> | ||
<div id="editor"> | ||
<aside id="line-numbers"></aside> | ||
<main id="main-content"> |
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,16 @@ | ||
<?php | ||
get_header(); | ||
|
||
if ( have_posts() ) { | ||
while ( have_posts() ) { | ||
the_post(); | ||
get_template_part( 'template-parts/listed-post', get_post_type() ); | ||
} | ||
the_posts_pagination( array( | ||
'prev_text' => __( 'Previous page' ), | ||
'next_text' => __( 'Next page' ), | ||
) ); | ||
} | ||
|
||
get_sidebar(); | ||
get_footer(); |
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,10 @@ | ||
<?php | ||
get_header(); | ||
|
||
while ( have_posts() ) { | ||
the_post(); | ||
get_template_part( 'template-parts/post-content' ); | ||
} | ||
|
||
get_sidebar(); | ||
get_footer(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,22 @@ | ||
<?php | ||
/** | ||
* The template for displaying search results | ||
*/ | ||
|
||
get_header(); | ||
|
||
if ( have_posts() ) { ?> | ||
<h1>Results for: <?php echo get_search_query(); ?></h1> | ||
<?php | ||
while ( have_posts() ) { | ||
the_post(); | ||
get_template_part( 'template-parts/listed-post', 'search' ); | ||
} | ||
} else { | ||
?> | ||
<p>Sorry, but nothing matched your search query.</p> | ||
<?php | ||
} | ||
|
||
get_sidebar(); | ||
get_footer(); |
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 @@ | ||
<?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,10 @@ | ||
<?php | ||
get_header(); | ||
|
||
while ( have_posts() ) { | ||
the_post(); | ||
get_template_part( 'template-parts/post-content', get_post_type() ); | ||
} | ||
|
||
get_sidebar(); | ||
get_footer(); |
Oops, something went wrong.