foo
This commit is contained in:
@@ -1,128 +1,99 @@
|
||||
defaults: &defaults
|
||||
working_directory: ~/tmp/windycoys
|
||||
docker:
|
||||
- image: circleci/node:10.15
|
||||
|
||||
semver-tags: &semver-tags
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
develop: &develop
|
||||
filters:
|
||||
branches:
|
||||
only: develop
|
||||
other-branches: &other-branches
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- master
|
||||
- develop
|
||||
|
||||
version: 2
|
||||
version: 2.1
|
||||
orbs:
|
||||
node: circleci/node@5.1
|
||||
aws-s3: circleci/aws-s3@3.1
|
||||
jobs:
|
||||
install:
|
||||
<<: *defaults
|
||||
build_and_test:
|
||||
executor: node/default
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/tmp/windycoys
|
||||
- checkout
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: npm install
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: .
|
||||
test:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/tmp/windycoys
|
||||
- node/install-packages:
|
||||
pkg-manager: npm
|
||||
- run:
|
||||
name: Run tests
|
||||
command: npm test
|
||||
build:
|
||||
<<: *defaults
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/tmp/windycoys
|
||||
command: npm run lint
|
||||
- run:
|
||||
name: Build CSS and JavaScript
|
||||
name: Build app
|
||||
command: npm run build
|
||||
- run:
|
||||
name: Generate timestamp
|
||||
command: bash build/generate_timestamp.sh
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: .
|
||||
deploy-prod:
|
||||
<<: *defaults
|
||||
root: ~/project
|
||||
paths:
|
||||
- .
|
||||
deploy:
|
||||
executor: node/default
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/tmp/windycoys
|
||||
at: ~/project
|
||||
- run:
|
||||
name: Install rsync
|
||||
command: sudo apt install -y rsync
|
||||
name: Known Hosts
|
||||
command: |
|
||||
mkdir ~/.ssh || :
|
||||
echo -e $KNOWN_HOSTS > ~/.ssh/known_hosts
|
||||
- run:
|
||||
name: Deploy theme
|
||||
command: bash build/deploy.sh prod
|
||||
name: Clean
|
||||
command: sh build/clean.sh
|
||||
- run:
|
||||
name: Purge Cloudflare cache
|
||||
command: bash build/purge_cache.sh
|
||||
deploy-develop:
|
||||
<<: *defaults
|
||||
name: Deploy
|
||||
command: sh build/deploy.sh
|
||||
backup_to_s3:
|
||||
docker:
|
||||
- image: 'cimg/python:3.10'
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/tmp/windycoys
|
||||
- checkout
|
||||
- run:
|
||||
name: Install rsync
|
||||
command: sudo apt install -y rsync
|
||||
name: Known Hosts
|
||||
command: |
|
||||
mkdir ~/.ssh || :
|
||||
echo -e $KNOWN_HOSTS > ~/.ssh/known_hosts
|
||||
- run:
|
||||
name: Deploy theme
|
||||
command: bash build/deploy.sh develop
|
||||
name: Prepare filename
|
||||
command: |
|
||||
filename=windycoys-$(date +'%Y-%m-%dT%H-%M-%S').tgz
|
||||
echo "export filename='$filename'" >> $BASH_ENV
|
||||
- run:
|
||||
name: Purge Cloudflare cache
|
||||
command: bash build/purge_cache.sh
|
||||
name: Prepare backups
|
||||
command: |
|
||||
ssh $SSH_USER@$SSH_IP "bash -c '\
|
||||
|
||||
source windycoys/.env
|
||||
rm -rf windycoys/backup
|
||||
mkdir -p windycoys/backup/data
|
||||
scp -r windycoys/wp-content windycoys/backup/data/
|
||||
docker exec -t $DOCKER_DB_NAME /usr/bin/mysqldump \
|
||||
-uroot --password=$DB_ROOT_PASSWORD \
|
||||
$DB_NAME | gzip -9 > windycoys/backup/data/database.sql.gz
|
||||
/usr/bin/tar zcf windycoys/backup/windycoys.tgz windycoys/backup/data'"
|
||||
- run:
|
||||
name: Copy backup
|
||||
command: |
|
||||
scp $SSH_USER@$SSH_IP:~/windycoys/backup/windycoys.tgz ./
|
||||
mv windycoys.tgz $filename
|
||||
- aws-s3/copy:
|
||||
aws-region: AWS_REGION
|
||||
aws-access-key-id: AWS_ACCESS_KEY_ID
|
||||
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
|
||||
from: '$filename'
|
||||
to: 's3://$AWS_S3_BUCKET_NAME'
|
||||
workflows:
|
||||
version: 2
|
||||
test:
|
||||
test_my_app:
|
||||
jobs:
|
||||
- install: *other-branches
|
||||
- test:
|
||||
<<: *other-branches
|
||||
- build_and_test:
|
||||
filters:
|
||||
branches:
|
||||
only: main
|
||||
- deploy:
|
||||
requires:
|
||||
- install
|
||||
develop:
|
||||
- build_and_test
|
||||
filters:
|
||||
branches:
|
||||
only: main
|
||||
backup:
|
||||
triggers:
|
||||
- schedule:
|
||||
cron: "0 2 * * 1"
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- next
|
||||
jobs:
|
||||
- install: *develop
|
||||
- test:
|
||||
<<: *develop
|
||||
requires:
|
||||
- install
|
||||
- build:
|
||||
<<: *develop
|
||||
requires:
|
||||
- test
|
||||
- deploy-develop:
|
||||
<<: *develop
|
||||
requires:
|
||||
- build
|
||||
prod:
|
||||
jobs:
|
||||
- install: *semver-tags
|
||||
- test:
|
||||
<<: *semver-tags
|
||||
requires:
|
||||
- install
|
||||
- build:
|
||||
<<: *semver-tags
|
||||
requires:
|
||||
- test
|
||||
- deploy-prod:
|
||||
<<: *semver-tags
|
||||
requires:
|
||||
- build
|
||||
- backup_to_s3
|
||||
|
||||
17
build/backup.sh
Normal file
17
build/backup.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
source .env
|
||||
|
||||
rm -rf ~/windycoys/backup
|
||||
rm -f ~/windycoys/windycoys-*.tgz
|
||||
mkdir -p ~/windycoys/backup
|
||||
|
||||
scp -r ~/windycoys/wp-content ~/windycoys/backup/
|
||||
docker exec -it $DOCKER_DB_NAME /usr/bin/mysqldump -uroot -p"$DB_ROOT_PASSWORD" $DB_NAME | gzip -9 > ~/windycoys/backup/database.sql.gz
|
||||
ls -l ~/windycoys/backup/
|
||||
|
||||
datetime=$(date +'%Y-%m-%dT%H-%M-%S')
|
||||
file=windycoys-$datetime.tgz
|
||||
/usr/bin/tar zcf ~/windycoys/$file ~/windycoys/backup
|
||||
|
||||
rm -rf ~/windycoys/backup
|
||||
8
build/clean.sh
Normal file
8
build/clean.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Test environment variables are set
|
||||
[ -z "$SSH_IP" ] && { echo >&2 "Error: SSH_IP is missing. Aborting."; exit 1; }
|
||||
[ -z "$SSH_USER" ] && { echo >&2 "Error: SSH_USER is missing. Aborting."; exit 1; }
|
||||
|
||||
# Deploy theme
|
||||
ssh $SSH_USER@$SSH_IP rm -r ~/windycoys/dist/*
|
||||
@@ -1,10 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Ensure target is defined
|
||||
[ -z "$1" ] && { echo >&2 "Error: Build target not defined. Aborting."; exit 1; }
|
||||
|
||||
# Test rsync is installed and ENV variables are set
|
||||
hash rsync 2>/dev/null || { echo >&2 "Error: rsync is not installed. Aborting."; exit 1; }
|
||||
# Test environment variables are set
|
||||
[ -z "$SSH_IP" ] && { echo >&2 "Error: SSH_IP is missing. Aborting."; exit 1; }
|
||||
[ -z "$SSH_USER" ] && { echo >&2 "Error: SSH_USER is missing. Aborting."; exit 1; }
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"build:ts": "cross-env NODE_ENV=production webpack",
|
||||
"lint": "run-p lint:*",
|
||||
"lint:eslint": "eslint src --ext .ts",
|
||||
"postinstall": "run-p browser-sync",
|
||||
"postinstallf": "run-p browser-sync",
|
||||
"serve": "docker-compose -f build/docker-compose.dev.yml up --force-recreate 2>/dev/null",
|
||||
"start": "run-p serve watch",
|
||||
"test": "jest",
|
||||
|
||||
12
src/404.php
12
src/404.php
@@ -1,18 +1,18 @@
|
||||
<?php get_header(); ?>
|
||||
<main class="page">
|
||||
<section class="page__logo">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<section class="page__content">
|
||||
<h1 class="title">404 - Page not found</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
<a class="link" href="<?php echo get_site_url(); ?>/">Go back home</a>
|
||||
</section>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -1,48 +1,61 @@
|
||||
<?php
|
||||
|
||||
class Windycoys_Walker_Comments extends Walker_Comment {
|
||||
function start_lvl(&$output, $depth = 0, $args = Array()) {
|
||||
class Windycoys_Walker_Comments extends Walker_Comment
|
||||
{
|
||||
function start_lvl(&$output, $depth = 0, $args = [])
|
||||
{
|
||||
$output .= '<ol class="comments__list comments__list--sub-list">';
|
||||
}
|
||||
|
||||
function end_lvl(&$output, $depth = 0, $args = Array()) {
|
||||
$output .= '</ol>';
|
||||
function end_lvl(&$output, $depth = 0, $args = [])
|
||||
{
|
||||
$output .= "</ol>";
|
||||
}
|
||||
|
||||
function start_el(&$output, $comment, $depth = 0 , $args = Array(), $id = 0) {
|
||||
function start_el(&$output, $comment, $depth = 0, $args = [], $id = 0)
|
||||
{
|
||||
$id = $comment->comment_ID;
|
||||
$post_id = $comment->comment_post_ID;
|
||||
$reply_link = get_permalink($post_id) . '?replytocom='.$id.'#respond';
|
||||
$reply_link = get_permalink($post_id) . "?replytocom=" . $id . "#respond";
|
||||
$author_email = $comment->comment_author_email;
|
||||
$author = $comment->comment_author;
|
||||
$avatar = get_avatar($comment, 128);
|
||||
$date = get_comment_date(get_option('date_format'), $id).' at '.get_comment_date(get_option('time_format'), $id);
|
||||
$date =
|
||||
get_comment_date(get_option("date_format"), $id) .
|
||||
" at " .
|
||||
get_comment_date(get_option("time_format"), $id);
|
||||
$content = $comment->comment_content;
|
||||
$output .= '<li class="comments__item">';
|
||||
$output .= '<div class="comment">';
|
||||
$output .= '<div class="comment__head">';
|
||||
$output .= sprintf('<div class="comment__avatar has-silhouette">%s</div>', $avatar);
|
||||
$output .= sprintf(
|
||||
'<div class="comment__avatar has-silhouette">%s</div>',
|
||||
$avatar
|
||||
);
|
||||
$output .= '<div class="comment__metadata">';
|
||||
$output .= sprintf('<span class="comment__author">%s</span>', $author);
|
||||
$output .= sprintf('<span class="comment__date">%s</span>', $date);
|
||||
$output .= '</div></div>';
|
||||
$output .= "</div></div>";
|
||||
$output .= sprintf('<div class="comment__body">%s</div>', $content);
|
||||
$output .= '<div class="comment__foot">';
|
||||
$output .= sprintf('<a class="comment__reply" data-comment-author="%s" ' .
|
||||
$output .= sprintf(
|
||||
'<a class="comment__reply" data-comment-author="%s" ' .
|
||||
'data-comment-id="%s" href="%s">',
|
||||
$author,
|
||||
$id,
|
||||
$reply_link
|
||||
);
|
||||
$output .= '<span class="comment__reply-icon">';
|
||||
$output .= '<svg class="icon icon--extra-small"><use href="#icon-reply"></use></svg></span>';
|
||||
$output .=
|
||||
'<svg class="icon icon--extra-small"><use href="#icon-reply"></use></svg></span>';
|
||||
$output .= '<span class="comment__reply-text">Reply</span></a>';
|
||||
$output .= '<div class="comment__inline-reply"></div>';
|
||||
$output .= '</div></div>';
|
||||
$output .= "</div></div>";
|
||||
}
|
||||
|
||||
function end_el(&$output, $comment, $depth = 0, $args = Array()) {
|
||||
$output .= '</li>';
|
||||
function end_el(&$output, $comment, $depth = 0, $args = [])
|
||||
{
|
||||
$output .= "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,35 @@
|
||||
<?php
|
||||
|
||||
class Windycoys_Walker_Navigation extends Walker_Nav_Menu {
|
||||
function start_lvl(&$output, $depth = 0, $args = Array()) {
|
||||
class Windycoys_Walker_Navigation extends Walker_Nav_Menu
|
||||
{
|
||||
function start_lvl(&$output, $depth = 0, $args = [])
|
||||
{
|
||||
$output .= '<ul class="nav__list" role="menu">';
|
||||
}
|
||||
|
||||
function end_lvl(&$output, $depth = 0, $args = Array()) {
|
||||
$output .= '</ul>';
|
||||
function end_lvl(&$output, $depth = 0, $args = [])
|
||||
{
|
||||
$output .= "</ul>";
|
||||
}
|
||||
|
||||
function start_el(&$output, $item, $depth = 0, $args = Array(), $id = 0) {
|
||||
function start_el(&$output, $item, $depth = 0, $args = [], $id = 0)
|
||||
{
|
||||
$title = $item->title;
|
||||
$url = $item->url;
|
||||
if ($title && $url) {
|
||||
$output .= '<li class="nav__list-item" role="none">';
|
||||
$output .= sprintf('<a class="nav__link" href="%s" role="menuitem">', $url);
|
||||
$output .= sprintf(
|
||||
'<a class="nav__link" href="%s" role="menuitem">',
|
||||
$url
|
||||
);
|
||||
$output .= $title;
|
||||
$output .= '</a>';
|
||||
$output .= "</a>";
|
||||
}
|
||||
}
|
||||
|
||||
function end_el(&$output, $item, $depth = 0, $args = Array()) {
|
||||
$output .= '</li>';
|
||||
function end_el(&$output, $item, $depth = 0, $args = [])
|
||||
{
|
||||
$output .= "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +1,83 @@
|
||||
<?php
|
||||
require get_template_directory() . '/classes/walker.comments.php';
|
||||
require get_template_directory() . "/classes/walker.comments.php";
|
||||
|
||||
$form_settings = array(
|
||||
"class_form" => 'comment-respond__form',
|
||||
"class_submit" => 'comment-respond__submit',
|
||||
"comment_field" => '<div class="comment-respond__item comment-respond__item--large"><label class="comment-respond__label" for="comment">Comment</label><textarea class="comment-respond__input" id="comment" name="comment" cols="25" rows="8" aria-required="true"></textarea></div>',
|
||||
"logged_in_as" => '<p class="comment-respond__text">' . sprintf( __( 'Logged in as <a class="link" href="%1$s">%2$s</a>. <a class="link" href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
|
||||
"title_reply_before" => '<h3 id="reply-title" class="comment-respond__title">',
|
||||
$form_settings = [
|
||||
"class_form" => "comment-respond__form",
|
||||
"class_submit" => "comment-respond__submit",
|
||||
"comment_field" =>
|
||||
'<div class="comment-respond__item comment-respond__item--large"><label class="comment-respond__label" for="comment">Comment</label><textarea class="comment-respond__input" id="comment" name="comment" cols="25" rows="8" aria-required="true"></textarea></div>',
|
||||
"logged_in_as" =>
|
||||
'<p class="comment-respond__text">' .
|
||||
sprintf(
|
||||
__(
|
||||
'Logged in as <a class="link" href="%1$s">%2$s</a>. <a class="link" href="%3$s" title="Log out of this account">Log out?</a>'
|
||||
),
|
||||
admin_url("profile.php"),
|
||||
$user_identity,
|
||||
wp_logout_url(apply_filters("the_permalink", get_permalink()))
|
||||
) .
|
||||
"</p>",
|
||||
"title_reply_before" =>
|
||||
'<h3 id="reply-title" class="comment-respond__title">',
|
||||
"title_reply" => '<span class="comment-respond__title-text">Reply</span>',
|
||||
"cancel_reply_before" => '<span class="comment-respond__cancel">',
|
||||
"cancel_reply_after" => '</span>',
|
||||
"comment_notes_before" => '<p class="comment-respond__notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
|
||||
"fields" => array(
|
||||
"author" => '<div class="comment-respond__item"><label class="comment-respond__label" for="author">' . __( 'Name', 'domainreference' ) . ( $req ? '<span class="comment-respond__required">*</span>' : '' ) . '</label>' . '<input class="comment-respond__input" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="60" aria-required="true" /></div>',
|
||||
"email" => '<div class="comment-respond__item"><label class="comment-respond__label" for="email">' . __( 'Email', 'domainreference' ) . ( $req ? '<span class="comment-respond__required">*</span>' : '' ) . '</label>' . '<input class="comment-respond__input" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="60" aria-required="true" /></div>',
|
||||
"url" => '<div class="comment-respond__item"><label class="comment-respond__label" for="url">' . __( 'Website', 'domainreference' ) . '</label>' . '<input class="comment-respond__input" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></div>',
|
||||
"cookies" => '<div class="comment-respond__item comment-respond__item--large"><input class="comment-respond__checkbox" id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"/><label class="comment-respond__checkbox-label" for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></div>',
|
||||
),
|
||||
);
|
||||
"cancel_reply_after" => "</span>",
|
||||
"comment_notes_before" =>
|
||||
'<p class="comment-respond__notes">' .
|
||||
__("Your email address will not be published.") .
|
||||
($req ? $required_text : "") .
|
||||
"</p>",
|
||||
"fields" => [
|
||||
"author" =>
|
||||
'<div class="comment-respond__item"><label class="comment-respond__label" for="author">' .
|
||||
__("Name", "domainreference") .
|
||||
($req ? '<span class="comment-respond__required">*</span>' : "") .
|
||||
"</label>" .
|
||||
'<input class="comment-respond__input" id="author" name="author" type="text" value="' .
|
||||
esc_attr($commenter["comment_author"]) .
|
||||
'" size="60" aria-required="true" /></div>',
|
||||
"email" =>
|
||||
'<div class="comment-respond__item"><label class="comment-respond__label" for="email">' .
|
||||
__("Email", "domainreference") .
|
||||
($req ? '<span class="comment-respond__required">*</span>' : "") .
|
||||
"</label>" .
|
||||
'<input class="comment-respond__input" id="email" name="email" type="text" value="' .
|
||||
esc_attr($commenter["comment_author_email"]) .
|
||||
'" size="60" aria-required="true" /></div>',
|
||||
"url" =>
|
||||
'<div class="comment-respond__item"><label class="comment-respond__label" for="url">' .
|
||||
__("Website", "domainreference") .
|
||||
"</label>" .
|
||||
'<input class="comment-respond__input" id="url" name="url" type="text" value="' .
|
||||
esc_attr($commenter["comment_author_url"]) .
|
||||
'" size="30" /></div>',
|
||||
"cookies" =>
|
||||
'<div class="comment-respond__item comment-respond__item--large"><input class="comment-respond__checkbox" id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"/><label class="comment-respond__checkbox-label" for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></div>',
|
||||
],
|
||||
];
|
||||
?>
|
||||
<div class="comments" id="comments">
|
||||
<div class="comments__head">
|
||||
<h2 class="comments__title">
|
||||
<?php
|
||||
if (comments_open()) :
|
||||
if (have_comments()) :
|
||||
echo 'Join the conversation';
|
||||
<?php if (comments_open()):
|
||||
if (have_comments()):
|
||||
echo "Join the conversation";
|
||||
else:
|
||||
echo 'Leave a comment';
|
||||
echo "Leave a comment";
|
||||
endif;
|
||||
else:
|
||||
echo 'Comments are closed';
|
||||
endif;
|
||||
?>
|
||||
echo "Comments are closed";
|
||||
endif; ?>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="comments__body">
|
||||
<ol class="comments__list">
|
||||
<?php
|
||||
wp_list_comments(array(
|
||||
<?php wp_list_comments([
|
||||
"walker" => new Windycoys_Walker_Comments(),
|
||||
));
|
||||
?>
|
||||
]); ?>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="comments__foot">
|
||||
<?php comment_form($form_settings) ?>
|
||||
<?php comment_form($form_settings); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
$js_url = get_template_directory_uri() . '/bundle.js';
|
||||
$js_url = get_template_directory_uri() . "/bundle.js";
|
||||
$deploy_timestamp = windycoys_get_deploy_timestamp();
|
||||
if ($deploy_timestamp) {
|
||||
$js_url .= '?t=' . $deploy_timestamp;
|
||||
$js_url .= "?t=" . $deploy_timestamp;
|
||||
}
|
||||
?>
|
||||
<div id="fb-root"></div>
|
||||
<script type="text/javascript" src="<?php echo $js_url ?>"></script>
|
||||
<script type="text/javascript" src="<?php echo $js_url; ?>"></script>
|
||||
<script type="text/javascript">
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
|
||||
@@ -1,58 +1,62 @@
|
||||
<?php get_header() ?>
|
||||
<?php get_header(); ?>
|
||||
<main class="page">
|
||||
<section class="page__logo is-fixed">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<section class="page__content page__content--centered-md">
|
||||
<h1 class="title">Latest articles</h1>
|
||||
<div class="page__columns">
|
||||
<?php
|
||||
$posts = get_posts(array(
|
||||
$posts = get_posts([
|
||||
"numberposts" => 4,
|
||||
));
|
||||
]);
|
||||
foreach ($posts as $post) {
|
||||
$date = strtotime($post->post_date);
|
||||
$year = date('Y', $date);
|
||||
$month = date('F', $date);
|
||||
$day = date('jS', $date);
|
||||
$date = get_the_date(get_option('date_format'), $post->ID).' at '.get_the_date(get_option('time_format'), $post->ID);
|
||||
$content = (strlen($post->post_excerpt) === 0) ?
|
||||
strip_tags(substr($post->post_content, 0, 200)).' [...]' :
|
||||
$post->post_excerpt;
|
||||
$year = date("Y", $date);
|
||||
$month = date("F", $date);
|
||||
$day = date("jS", $date);
|
||||
$date =
|
||||
get_the_date(get_option("date_format"), $post->ID) .
|
||||
" at " .
|
||||
get_the_date(get_option("time_format"), $post->ID);
|
||||
$content =
|
||||
strlen($post->post_excerpt) === 0
|
||||
? strip_tags(substr($post->post_content, 0, 200)) . " [...]"
|
||||
: $post->post_excerpt;
|
||||
$words = count(explode(" ", $post->post_content));
|
||||
$excerpt = array(
|
||||
$excerpt = [
|
||||
"title" => $post->post_title,
|
||||
"url" => get_permalink($post->ID),
|
||||
"content" => $content,
|
||||
"author" => get_the_author_meta('nickname', $post->post_author),
|
||||
"author" => get_the_author_meta("nickname", $post->post_author),
|
||||
"comments" => $post->comment_count,
|
||||
"words" => $words,
|
||||
"date" => $date,
|
||||
);
|
||||
];
|
||||
echo '<div class="page__cell">';
|
||||
get_template_part('partials/excerpt');
|
||||
echo '</div>';
|
||||
get_template_part("partials/excerpt");
|
||||
echo "</div>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<h2 class="title">Podcasts</h2>
|
||||
<div class="page__columns">
|
||||
<div class="page__cell">
|
||||
<?php $podcast = windycoys_get_podcast_meta('xin') ?>
|
||||
<?php get_template_part('partials/podcast') ?>
|
||||
<?php $podcast = windycoys_get_podcast_meta("xin"); ?>
|
||||
<?php get_template_part("partials/podcast"); ?>
|
||||
</div>
|
||||
<div class="page__cell">
|
||||
<?php $podcast = windycoys_get_podcast_meta('tfc') ?>
|
||||
<?php get_template_part('partials/podcast') ?>
|
||||
<?php $podcast = windycoys_get_podcast_meta("tfc"); ?>
|
||||
<?php get_template_part("partials/podcast"); ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -1,50 +1,61 @@
|
||||
<?php
|
||||
|
||||
function windycoys_the_tags() {
|
||||
function windycoys_the_tags()
|
||||
{
|
||||
$tags = get_the_tags();
|
||||
if (!$tags) return false;
|
||||
if (!$tags) {
|
||||
return false;
|
||||
}
|
||||
// Suppress NewsNow tag
|
||||
foreach($tags as $key=>$tag) {
|
||||
if($tag->name === "newsnow") {
|
||||
foreach ($tags as $key => $tag) {
|
||||
if ($tag->name === "newsnow") {
|
||||
unset($tags[$key]);
|
||||
}
|
||||
}
|
||||
if ($tags) {
|
||||
foreach($tags as $key=>$tag) {
|
||||
foreach ($tags as $key => $tag) {
|
||||
echo '<a class="metadata__tag-link" href="' .
|
||||
home_url() . '/tag/' . $tag->name . '" rel="tag">' .
|
||||
$tag->name . '</a>';
|
||||
home_url() .
|
||||
"/tag/" .
|
||||
$tag->name .
|
||||
'" rel="tag">' .
|
||||
$tag->name .
|
||||
"</a>";
|
||||
if ($key < count($tags) - 1) {
|
||||
echo ', ';
|
||||
echo ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function windycoys_get_twitter_share_url() {
|
||||
$url = 'https://twitter.com/intent/tweet?text=';
|
||||
function windycoys_get_twitter_share_url()
|
||||
{
|
||||
$url = "https://twitter.com/intent/tweet?text=";
|
||||
$title = get_the_title();
|
||||
$link = get_the_permalink();
|
||||
return $url . urlencode($title . ' : ' . $link);
|
||||
return $url . urlencode($title . " : " . $link);
|
||||
}
|
||||
|
||||
function windycoys_search_posts_per_page($query) {
|
||||
function windycoys_search_posts_per_page($query)
|
||||
{
|
||||
if ($query->is_search) {
|
||||
$query->set( 'posts_per_page', '10' );
|
||||
$query->set("posts_per_page", "10");
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
add_filter('pre_get_posts', 'windycoys_search_posts_per_page');
|
||||
add_filter("pre_get_posts", "windycoys_search_posts_per_page");
|
||||
|
||||
function windycoys_get_deploy_timestamp() {
|
||||
if (file_exists(__DIR__ . '/.timestamp')) {
|
||||
$timestamp = file_get_contents(__DIR__ . '/.timestamp');
|
||||
function windycoys_get_deploy_timestamp()
|
||||
{
|
||||
if (file_exists(__DIR__ . "/.timestamp")) {
|
||||
$timestamp = file_get_contents(__DIR__ . "/.timestamp");
|
||||
return $timestamp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function windycoys_create_podcasts_table() {
|
||||
function windycoys_create_podcasts_table()
|
||||
{
|
||||
global $wpdb;
|
||||
$charset_collate = $wpdb->get_charset_collate();
|
||||
$sql = "CREATE TABLE windycoys_podcasts (
|
||||
@@ -54,143 +65,170 @@ function windycoys_create_podcasts_table() {
|
||||
content longtext DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
) $charset_collate;";
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
require_once ABSPATH . "wp-admin/includes/upgrade.php";
|
||||
dbDelta($sql);
|
||||
$wpdb->insert('windycoys_podcasts', array(
|
||||
'podcast_id' => 'tfc',
|
||||
'last_update' => 0,
|
||||
'content' => '{}'
|
||||
));
|
||||
$wpdb->insert('windycoys_podcasts', array(
|
||||
'podcast_id' => 'xin',
|
||||
'last_update' => 0,
|
||||
'content' => '{}'
|
||||
));
|
||||
$wpdb->insert("windycoys_podcasts", [
|
||||
"podcast_id" => "tfc",
|
||||
"last_update" => 0,
|
||||
"content" => "{}",
|
||||
]);
|
||||
$wpdb->insert("windycoys_podcasts", [
|
||||
"podcast_id" => "xin",
|
||||
"last_update" => 0,
|
||||
"content" => "{}",
|
||||
]);
|
||||
}
|
||||
|
||||
function windycoys_fetch_podcast_meta($id) {
|
||||
function windycoys_fetch_podcast_meta($id)
|
||||
{
|
||||
global $wpdb;
|
||||
$urls = array(
|
||||
"tfc" => 'https://rss.acast.com/thefightingcock',
|
||||
"xin" => 'https://rss.acast.com/theextrainch',
|
||||
);
|
||||
$urls = [
|
||||
"tfc" => "https://rss.acast.com/thefightingcock",
|
||||
"xin" => "https://rss.acast.com/theextrainch",
|
||||
];
|
||||
$feed = file_get_contents($urls[$id]);
|
||||
$feed = str_replace('<media:', '<', $feed);
|
||||
$feed = str_replace('</media:', '</', $feed);
|
||||
$feed = str_replace('<itunes:', '<', $feed);
|
||||
$feed = str_replace('</itunes:', '</', $feed);
|
||||
$feed = str_replace("<media:", "<", $feed);
|
||||
$feed = str_replace("</media:", "</", $feed);
|
||||
$feed = str_replace("<itunes:", "<", $feed);
|
||||
$feed = str_replace("</itunes:", "</", $feed);
|
||||
$now = time();
|
||||
$wpdb->update("windycoys_podcasts",
|
||||
array('last_update' => $now, 'content' => $feed),
|
||||
array('podcast_id'=>$id)
|
||||
$wpdb->update(
|
||||
"windycoys_podcasts",
|
||||
["last_update" => $now, "content" => $feed],
|
||||
["podcast_id" => $id]
|
||||
);
|
||||
return $feed;
|
||||
}
|
||||
|
||||
function windycoys_refresh_podcast_meta($id) {
|
||||
function windycoys_refresh_podcast_meta($id)
|
||||
{
|
||||
global $wpdb;
|
||||
$now = time();
|
||||
$res = $wpdb->get_row('SELECT * FROM windycoys_podcasts WHERE
|
||||
podcast_id = "' . $id .'"');
|
||||
$res = $wpdb->get_row(
|
||||
'SELECT * FROM windycoys_podcasts WHERE
|
||||
podcast_id = "' .
|
||||
$id .
|
||||
'"'
|
||||
);
|
||||
if (!$res) {
|
||||
windycoys_create_podcasts_table();
|
||||
}
|
||||
if ($res->last_update + 300 < $now) {
|
||||
return array(
|
||||
return [
|
||||
"from_cache" => false,
|
||||
"data" => windycoys_fetch_podcast_meta($id),
|
||||
);
|
||||
];
|
||||
}
|
||||
return array(
|
||||
return [
|
||||
"from_cache" => true,
|
||||
"data" => $res->content,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
function windycoys_get_episodes_url($id) {
|
||||
$urls = array(
|
||||
"tfc" => 'https://play.acast.com/s/thefightingcock',
|
||||
"xin" => 'https://play.acast.com/s/theextrainch',
|
||||
);
|
||||
function windycoys_get_episodes_url($id)
|
||||
{
|
||||
$urls = [
|
||||
"tfc" => "https://play.acast.com/s/thefightingcock",
|
||||
"xin" => "https://play.acast.com/s/theextrainch",
|
||||
];
|
||||
return $urls[$id];
|
||||
}
|
||||
|
||||
function windycoys_get_podcast_meta($id) {
|
||||
function windycoys_get_podcast_meta($id)
|
||||
{
|
||||
$res = windycoys_refresh_podcast_meta($id);
|
||||
$rss = simplexml_load_string($res['data']);
|
||||
$rss = simplexml_load_string($res["data"]);
|
||||
$item = $rss->channel->item;
|
||||
$date = strtotime((String) $item->pubDate);
|
||||
return array(
|
||||
$date = strtotime((string) $item->pubDate);
|
||||
return [
|
||||
"id" => $id,
|
||||
"from_cache" => $res['from_cache'],
|
||||
"podcast_title" => (String) $rss->channel->title,
|
||||
"podcast_description" => (String) $rss->channel->description,
|
||||
"from_cache" => $res["from_cache"],
|
||||
"podcast_title" => (string) $rss->channel->title,
|
||||
"podcast_description" => (string) $rss->channel->description,
|
||||
"podcast_episodes" => windycoys_get_episodes_url($id),
|
||||
"artwork_url" => (String) $rss->channel->image->url,
|
||||
"title" => (String) $item->title,
|
||||
"description" => (String) $item->description,
|
||||
"image" => (String) $item->image['href'],
|
||||
"date" => date(get_option('date_format'), $date).' at '.date(get_option('time_format'), $date),
|
||||
"length" => (String) $item->duration,
|
||||
"url" => (String) $item->link,
|
||||
"audio" => (String) $item->enclosure['url'],
|
||||
);
|
||||
"artwork_url" => (string) $rss->channel->image->url,
|
||||
"title" => (string) $item->title,
|
||||
"description" => (string) $item->description,
|
||||
"image" => (string) $item->image["href"],
|
||||
"date" =>
|
||||
date(get_option("date_format"), $date) .
|
||||
" at " .
|
||||
date(get_option("time_format"), $date),
|
||||
"length" => (string) $item->duration,
|
||||
"url" => (string) $item->link,
|
||||
"audio" => (string) $item->enclosure["url"],
|
||||
];
|
||||
}
|
||||
|
||||
function windycoys_get_read_time($words) {
|
||||
function windycoys_get_read_time($words)
|
||||
{
|
||||
$wpm = 250;
|
||||
$mins = ceil($words / $wpm);
|
||||
return $mins;
|
||||
}
|
||||
|
||||
function windycoys_is_ie() {
|
||||
function windycoys_is_ie()
|
||||
{
|
||||
$ua = htmlentities($_SERVER["HTTP_USER_AGENT"], ENT_QUOTES, "UTF-8");
|
||||
if (preg_match("~MSIE|Internet Explorer~i", $ua) || (strpos($ua, "Trident/7.0") !== false && strpos($ua, "rv:11.0") !== false)) {
|
||||
if (
|
||||
preg_match("~MSIE|Internet Explorer~i", $ua) ||
|
||||
(strpos($ua, "Trident/7.0") !== false && strpos($ua, "rv:11.0") !== false)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function windycoys_first_sentence($string) {
|
||||
$sentence = preg_split( '/(\.|!|\?)\s/', $string, 2, PREG_SPLIT_DELIM_CAPTURE );
|
||||
return $sentence['0'] . $sentence['1'];
|
||||
function windycoys_first_sentence($string)
|
||||
{
|
||||
$sentence = preg_split("/(\.|!|\?)\s/", $string, 2, PREG_SPLIT_DELIM_CAPTURE);
|
||||
return $sentence["0"] . $sentence["1"];
|
||||
}
|
||||
|
||||
function windycoys_get_description($post_id) {
|
||||
function windycoys_get_description($post_id)
|
||||
{
|
||||
if (get_post_type() == "post") {
|
||||
$post = get_post($post_id);
|
||||
$content = (strlen($post->post_excerpt) === 0) ?
|
||||
strip_tags(windycoys_first_sentence($post->post_content)) :
|
||||
$post->post_excerpt;
|
||||
$content =
|
||||
strlen($post->post_excerpt) === 0
|
||||
? strip_tags(windycoys_first_sentence($post->post_content))
|
||||
: $post->post_excerpt;
|
||||
return $content;
|
||||
} else {
|
||||
return get_bloginfo('description');
|
||||
return get_bloginfo("description");
|
||||
}
|
||||
}
|
||||
|
||||
function windycoys_jetpack_custom_image($media, $post_id, $args) {
|
||||
function windycoys_jetpack_custom_image($media, $post_id, $args)
|
||||
{
|
||||
if ($media) {
|
||||
return $media;
|
||||
} else {
|
||||
$url = get_template_directory_uri() . '/images/icon.png';
|
||||
$url = get_template_directory_uri() . "/images/icon.png";
|
||||
$permalink = get_permalink($post_id);
|
||||
|
||||
return array(
|
||||
array(
|
||||
"type" => 'image',
|
||||
"from" => 'custom_fallback',
|
||||
return [
|
||||
[
|
||||
"type" => "image",
|
||||
"from" => "custom_fallback",
|
||||
"src" => esc_url($url),
|
||||
"href" => $permalink,
|
||||
)
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
add_filter('jetpack_images_get_images', 'windycoys_jetpack_custom_image', 10, 3);
|
||||
add_filter(
|
||||
"jetpack_images_get_images",
|
||||
"windycoys_jetpack_custom_image",
|
||||
10,
|
||||
3
|
||||
);
|
||||
|
||||
function windycoys_strip_scripts(&$scripts) {
|
||||
if(!is_admin()){
|
||||
$scripts->remove('jquery');
|
||||
function windycoys_strip_scripts(&$scripts)
|
||||
{
|
||||
if (!is_admin()) {
|
||||
$scripts->remove("jquery");
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('wp_default_scripts', 'windycoys_strip_scripts');
|
||||
add_filter("wp_default_scripts", "windycoys_strip_scripts");
|
||||
|
||||
@@ -1,26 +1,33 @@
|
||||
<?php
|
||||
$css_url = get_template_directory_uri() . '/style.css';
|
||||
$css_url = get_template_directory_uri() . "/style.css";
|
||||
$deploy_timestamp = windycoys_get_deploy_timestamp();
|
||||
if ($deploy_timestamp) {
|
||||
$css_url .= '?t=' . $deploy_timestamp;
|
||||
$css_url .= "?t=" . $deploy_timestamp;
|
||||
}
|
||||
$manifest = get_template_directory_uri() . '/manifest.json';
|
||||
$manifest = get_template_directory_uri() . "/manifest.json";
|
||||
?>
|
||||
<!doctype html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="<?php bloginfo('charset'); ?>">
|
||||
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' « '; } ?> <?php bloginfo('name'); ?></title>
|
||||
<meta name="description" content="<?php echo windycoys_get_description(get_the_id()) ?>">
|
||||
<meta charset="<?php bloginfo("charset"); ?>">
|
||||
<title><?php
|
||||
wp_title("");
|
||||
if (wp_title("", false)) {
|
||||
echo " « ";
|
||||
}
|
||||
?> <?php bloginfo("name"); ?></title>
|
||||
<meta name="description" content="<?php echo windycoys_get_description(
|
||||
get_the_id()
|
||||
); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#201f42">
|
||||
<?php wp_head(); ?>
|
||||
<link rel="me" href="https://twitter.com/WindyCOYS">
|
||||
<link rel="icon" type="image/png" href="<?php echo get_template_directory_uri() ?>/images/icon_48.png">
|
||||
<link rel="manifest" href="<?php echo $manifest ?>">
|
||||
<link rel="stylesheet" href="<?php echo $css_url ?>">
|
||||
<link rel="icon" type="image/png" href="<?php echo get_template_directory_uri(); ?>/images/icon_48.png">
|
||||
<link rel="manifest" href="<?php echo $manifest; ?>">
|
||||
<link rel="stylesheet" href="<?php echo $css_url; ?>">
|
||||
<link href="//fonts.googleapis.com/css?family=Open+Sans|Raleway:700" rel="stylesheet">
|
||||
<?php if (windycoys_is_ie()) : ?>
|
||||
<?php if (windycoys_is_ie()): ?>
|
||||
<style type="text/css">.is-fixed .logo,.is-fixed .metadata{position: static;}</style>
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
<?php get_header() ?>
|
||||
<?php get_header(); ?>
|
||||
<main class="page">
|
||||
<section class="page__logo">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<?php $index = 0; while ( have_posts() ) : the_post(); $index++; ?>
|
||||
<section class="page__article<?php echo ($index === 1 ? ' is-first' : '') ?>">
|
||||
<?php
|
||||
$index = 0;
|
||||
while (have_posts()):
|
||||
|
||||
the_post();
|
||||
$index++;
|
||||
?>
|
||||
<section class="page__article<?php echo $index === 1 ? " is-first" : ""; ?>">
|
||||
<article class="article">
|
||||
<div class="article__date">
|
||||
<svg class="icon icon--extra-small">
|
||||
<use href="#icon-calendar"></use>
|
||||
</svg>
|
||||
<span class="article__date-text">
|
||||
<?php the_time(get_option('date_format')) ?>
|
||||
<?php the_time(get_option("date_format")); ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="article__content">
|
||||
@@ -21,24 +27,31 @@
|
||||
</a>
|
||||
</h1>
|
||||
<div class="content">
|
||||
<?php the_content(__('Continue reading <span class="meta-nav">»</span>', 'windycoys')); ?>
|
||||
<?php the_content(
|
||||
__(
|
||||
'Continue reading <span class="meta-nav">»</span>',
|
||||
"windycoys"
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<section class="page__metadata">
|
||||
<?php get_template_part('partials/metadata') ?>
|
||||
<?php get_template_part("partials/metadata"); ?>
|
||||
</section>
|
||||
<?php endwhile; ?>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
<section class="page__pagination">
|
||||
<?php get_template_part('partials/pagination') ?>
|
||||
<?php get_template_part("partials/pagination"); ?>
|
||||
</section>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?php get_header(); the_post(); ?>
|
||||
<?php get_header();
|
||||
the_post();
|
||||
?>
|
||||
<main class="page">
|
||||
<section class="page__logo is-fixed">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<section class="page__content">
|
||||
<h1 class="title">
|
||||
@@ -12,14 +14,14 @@
|
||||
<div class="content">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
<?php get_template_part('partials/archive') ?>
|
||||
<?php get_template_part("partials/archive"); ?>
|
||||
</section>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
26
src/page.php
26
src/page.php
@@ -1,9 +1,11 @@
|
||||
<?php get_header(); ?>
|
||||
<main class="page">
|
||||
<section class="page__logo">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<?php if (have_posts()):
|
||||
while (have_posts()):
|
||||
the_post(); ?>
|
||||
<section class="page__content">
|
||||
<h1 class="title">
|
||||
<?php the_title(); ?>
|
||||
@@ -12,19 +14,23 @@
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endwhile; ?>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
endwhile; ?>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<section class="page__content">
|
||||
<h1 class="title">Sorry, there is no article to display</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
<a class="link" href="<?php echo get_site_url(); ?>/">Go back home</a>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endif; ?>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -1,54 +1,56 @@
|
||||
<?php
|
||||
$posts = get_posts(array(
|
||||
$posts = get_posts([
|
||||
"numberposts" => -1,
|
||||
"order" => 'ASC',
|
||||
));
|
||||
$archive = array();
|
||||
"order" => "ASC",
|
||||
]);
|
||||
$archive = [];
|
||||
|
||||
foreach ($posts as $post) {
|
||||
$date = strtotime($post->post_date);
|
||||
$year = date('Y', $date);
|
||||
$month = date('F', $date);
|
||||
$day = date('jS', $date);
|
||||
$year = date("Y", $date);
|
||||
$month = date("F", $date);
|
||||
$day = date("jS", $date);
|
||||
$url = get_permalink($post->ID);
|
||||
$comments = $post->comment_count === '1' ? '1 comment' : $post->comment_count . ' comments';
|
||||
if ($post->post_status === 'publish') {
|
||||
$archive[$year][$month][] = array(
|
||||
$comments =
|
||||
$post->comment_count === "1"
|
||||
? "1 comment"
|
||||
: $post->comment_count . " comments";
|
||||
if ($post->post_status === "publish") {
|
||||
$archive[$year][$month][] = [
|
||||
"title" => $post->post_title,
|
||||
"slug" => $post->post_name,
|
||||
"author" => $post->post_author,
|
||||
"day" => $day,
|
||||
"url" => $url,
|
||||
"comments" => $comments,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="archive">
|
||||
<ol class="archive__list">
|
||||
<?php foreach ($archive as $year => $yearData) : ?>
|
||||
<?php foreach ($archive as $year => $yearData): ?>
|
||||
<li class="archive__item">
|
||||
<h2 class="archive__heading">
|
||||
<?php echo $year ?>
|
||||
<?php echo $year; ?>
|
||||
</h2>
|
||||
<ol class="archive__list archive__list--sub-list">
|
||||
<?php foreach ($yearData as $month => $monthData) : ?>
|
||||
<?php foreach ($yearData as $month => $monthData): ?>
|
||||
<li class="archive__item">
|
||||
<h3 class="archive__subheading">
|
||||
<?php echo $month ?>
|
||||
<?php echo $month; ?>
|
||||
</h3>
|
||||
<ol class="archive__list archive__list--sub-list">
|
||||
<?php foreach ($monthData as $post) : ?>
|
||||
<?php foreach ($monthData as $post): ?>
|
||||
<li class="archive__item">
|
||||
<span class="archive__date">
|
||||
<?php echo $post['day'] ?>
|
||||
<?php echo $post["day"]; ?>
|
||||
</span>
|
||||
<a class="link" href="<?php echo $post['url'] ?>">
|
||||
<?php echo $post['title'] ?>
|
||||
<a class="link" href="<?php echo $post["url"]; ?>">
|
||||
<?php echo $post["title"]; ?>
|
||||
</a>
|
||||
<span class="archive__comments">
|
||||
(<?php echo $post['comments'] ?>)
|
||||
(<?php echo $post["comments"]; ?>)
|
||||
</span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="social__item">
|
||||
<?php echo do_shortcode('[paypal-donation]'); ?>
|
||||
<?php echo do_shortcode("[paypal-donation]"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
<?php
|
||||
global $excerpt;
|
||||
?>
|
||||
global $excerpt; ?>
|
||||
<div class="excerpt">
|
||||
<div class="excerpt__head">
|
||||
<div class="excerpt__title">
|
||||
<a class="link" href="<?php echo $excerpt['url'] ?>">
|
||||
<?php echo $excerpt['title'] ?>
|
||||
<a class="link" href="<?php echo $excerpt["url"]; ?>">
|
||||
<?php echo $excerpt["title"]; ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="excerpt__body">
|
||||
<?php echo str_replace(
|
||||
'[...]',
|
||||
'<a class="link" href="' . $excerpt['url'] . '" aria-label="Read full article">'
|
||||
. '<svg class="icon icon--extra-extra-small"><use href="#icon-arrow-double-right"></use></a>',
|
||||
$excerpt['content']);
|
||||
?>
|
||||
"[...]",
|
||||
'<a class="link" href="' .
|
||||
$excerpt["url"] .
|
||||
'" aria-label="Read full article">' .
|
||||
'<svg class="icon icon--extra-extra-small"><use href="#icon-arrow-double-right"></use></a>',
|
||||
$excerpt["content"]
|
||||
); ?>
|
||||
</div>
|
||||
<div class="excerpt__foot">
|
||||
<ul class="excerpt__list">
|
||||
@@ -25,16 +26,18 @@ global $excerpt;
|
||||
<use href="#icon-profile"></use>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="excerpt__text"><?php echo $excerpt['author'] ?></span>
|
||||
<span class="excerpt__text"><?php echo $excerpt["author"]; ?></span>
|
||||
</li>
|
||||
<?php if ($excerpt['words']) : ?>
|
||||
<?php if ($excerpt["words"]): ?>
|
||||
<li class="excerpt__list-item">
|
||||
<span class="excerpt__icon">
|
||||
<svg class="icon icon--extra-small" aria-hidden="true">
|
||||
<use href="#icon-clock"></use>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="excerpt__text"><?php echo windycoys_get_read_time($excerpt['words']) ?> minute read</span>
|
||||
<span class="excerpt__text"><?php echo windycoys_get_read_time(
|
||||
$excerpt["words"]
|
||||
); ?> minute read</span>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li class="excerpt__list-item">
|
||||
@@ -43,10 +46,10 @@ global $excerpt;
|
||||
<use href="#icon-calendar"></use>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="excerpt__text"><?php echo $excerpt['date'] ?></span>
|
||||
<span class="excerpt__text"><?php echo $excerpt["date"]; ?></span>
|
||||
</li>
|
||||
<li class="excerpt__list-item">
|
||||
<a class="excerpt__list-link" href="<?php the_permalink() ?>#comments">
|
||||
<a class="excerpt__list-link" href="<?php the_permalink(); ?>#comments">
|
||||
<span class="excerpt__icon">
|
||||
<svg class="icon icon--extra-small" aria-hidden="true">
|
||||
<use href="#icon-comments"></use>
|
||||
@@ -54,8 +57,8 @@ global $excerpt;
|
||||
</span>
|
||||
<span class="excerpt__text">
|
||||
<?php
|
||||
$number = $excerpt['comments'];
|
||||
echo $number === '1' ? '1 comment' : $number . ' comments';
|
||||
$number = $excerpt["comments"];
|
||||
echo $number === "1" ? "1 comment" : $number . " comments";
|
||||
?>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<footer class="footer">
|
||||
<div class="footer__head">
|
||||
<p class="footer__text">© <?php echo date('Y'); ?> <?php bloginfo('name'); ?></p>
|
||||
<p class="footer__text">© <?php echo date("Y"); ?> <?php bloginfo(
|
||||
"name"
|
||||
); ?></p>
|
||||
</div>
|
||||
<div class="footer__body">
|
||||
<a href="https://www.newsnow.co.uk/h/Sport/Football/Premier+League/Tottenham+Hotspur" title="Click here for more Tottenham Hotspur news from NewsNow">
|
||||
<img src="<?php echo get_template_directory_uri() ?>/images/newsnow_sw.gif" alt="As featured on NewsNow: Tottenham Hotspur news">
|
||||
<img src="<?php echo get_template_directory_uri(); ?>/images/newsnow_sw.gif" alt="As featured on NewsNow: Tottenham Hotspur news">
|
||||
</a>
|
||||
</div>
|
||||
<?php get_template_part('icons') ?>
|
||||
<?php get_template_part("icons"); ?>
|
||||
</footer>
|
||||
<?php wp_footer() ?>
|
||||
<?php wp_footer(); ?>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
</svg>
|
||||
</span>
|
||||
<span class="metadata__text">
|
||||
<?php the_time(get_option('date_format')) ?>
|
||||
<?php the_time(get_option("date_format")); ?>
|
||||
</span>
|
||||
</li>
|
||||
<?php if (is_user_logged_in()): ?>
|
||||
<li class="metadata__list-item">
|
||||
<a class="metadata__link" href="<?php echo get_edit_post_link() ?>">
|
||||
<a class="metadata__link" href="<?php echo get_edit_post_link(); ?>">
|
||||
<span class="metadata__icon">
|
||||
<svg class="icon icon--small" aria-hidden="true">
|
||||
<use href="#icon-edit"></use>
|
||||
@@ -25,7 +25,7 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<li class="metadata__list-item">
|
||||
<a class="metadata__link" href="<?php the_permalink() ?>#comments">
|
||||
<a class="metadata__link" href="<?php the_permalink(); ?>#comments">
|
||||
<span class="metadata__icon">
|
||||
<svg class="icon icon--small" aria-hidden="true">
|
||||
<use href="#icon-comments"></use>
|
||||
@@ -43,13 +43,13 @@
|
||||
</svg>
|
||||
</span>
|
||||
<span class="metadata__text">
|
||||
<?php windycoys_the_tags() ?>
|
||||
<?php windycoys_the_tags(); ?>
|
||||
</span>
|
||||
</div>
|
||||
<li class="metadata__list-item">
|
||||
<div
|
||||
class="fb-share-button"
|
||||
data-href="<?php echo get_the_permalink() ?>"
|
||||
data-href="<?php echo get_the_permalink(); ?>"
|
||||
data-layout="box_count"
|
||||
data-size="small"
|
||||
data-mobile-iframe="false"
|
||||
@@ -66,8 +66,8 @@
|
||||
<li class="metadata__list-item">
|
||||
<a
|
||||
class="twitter-share-button"
|
||||
href="<?php echo windycoys_get_twitter_share_url() ?>"
|
||||
data-url="<?php echo get_the_permalink() ?>"
|
||||
href="<?php echo windycoys_get_twitter_share_url(); ?>"
|
||||
data-url="<?php echo get_the_permalink(); ?>"
|
||||
>
|
||||
Tweet
|
||||
</a>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
require get_template_directory() . '/classes/walker.navigation.php';
|
||||
require get_template_directory() . "/classes/walker.navigation.php";
|
||||
|
||||
$menu = wp_nav_menu(array(
|
||||
'echo' => false,
|
||||
'menu' => 'navigation',
|
||||
'container_class' => 'nav__menu',
|
||||
'menu_class' => 'nav__list',
|
||||
'walker' => new Windycoys_Walker_Navigation(),
|
||||
));
|
||||
$menu = wp_nav_menu([
|
||||
"echo" => false,
|
||||
"menu" => "navigation",
|
||||
"container_class" => "nav__menu",
|
||||
"menu_class" => "nav__list",
|
||||
"walker" => new Windycoys_Walker_Navigation(),
|
||||
]);
|
||||
|
||||
$menu = str_replace(
|
||||
'ul id="menu-navigation" class="nav__list"',
|
||||
@@ -21,11 +21,13 @@ $menu = str_replace(
|
||||
<span class="menu__line"></span>
|
||||
<span class="menu__text">Open menu</span>
|
||||
</button>
|
||||
<nav class="nav<?php echo is_user_logged_in() ? ' logged-in' : '' ?>" aria-label="Main Navigation">
|
||||
<nav class="nav<?php echo is_user_logged_in()
|
||||
? " logged-in"
|
||||
: ""; ?>" aria-label="Main Navigation">
|
||||
<div class="nav__content">
|
||||
<div class="nav__head">
|
||||
<h2 class="nav__title">
|
||||
<a class="nav__title-link" href="<?php get_site_url() ?>/" aria-label="Back Home" tabindex="-1">
|
||||
<a class="nav__title-link" href="<?php get_site_url(); ?>/" aria-label="Back Home" tabindex="-1">
|
||||
<span class="nav__title-link-icon">
|
||||
<svg class="icon icon--extra-large">
|
||||
<use href="#icon-windy"></use>
|
||||
@@ -36,7 +38,7 @@ $menu = str_replace(
|
||||
</h2>
|
||||
</div>
|
||||
<div class="nav__body">
|
||||
<?php echo $menu ?>
|
||||
<?php echo $menu; ?>
|
||||
</div>
|
||||
<div class="nav__foot">
|
||||
<div class="nav__social">
|
||||
@@ -52,7 +54,7 @@ $menu = str_replace(
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav__search">
|
||||
<?php get_search_form() ?>
|
||||
<?php get_search_form(); ?>
|
||||
</div>
|
||||
<button class="nav__close">
|
||||
<span class="nav__close-bar"></span>
|
||||
|
||||
@@ -2,52 +2,57 @@
|
||||
global $wp;
|
||||
$url = home_url($wp->request);
|
||||
$base_url = substr($url, 0, strpos($url, "page/"));
|
||||
$current = get_query_var('paged');
|
||||
$current = get_query_var("paged");
|
||||
$total = $wp_query->max_num_pages;
|
||||
$links = paginate_links(array(
|
||||
"type" => 'array',
|
||||
$links = paginate_links([
|
||||
"type" => "array",
|
||||
"prev_next" => false,
|
||||
"current" => $current,
|
||||
"end_size" => 2,
|
||||
));
|
||||
]);
|
||||
|
||||
function get_previous_url($base_url, $page) {
|
||||
$qs = $_SERVER['QUERY_STRING'];
|
||||
$url = $base_url . 'page/' . ($page - 1);
|
||||
function get_previous_url($base_url, $page)
|
||||
{
|
||||
$qs = $_SERVER["QUERY_STRING"];
|
||||
$url = $base_url . "page/" . ($page - 1);
|
||||
if ($qs) {
|
||||
$url .= '/?' . $qs;
|
||||
$url .= "/?" . $qs;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
function get_next_url($base_url, $page) {
|
||||
$qs = $_SERVER['QUERY_STRING'];
|
||||
$url = $base_url . 'page/';
|
||||
function get_next_url($base_url, $page)
|
||||
{
|
||||
$qs = $_SERVER["QUERY_STRING"];
|
||||
$url = $base_url . "page/";
|
||||
if ($page === 0) {
|
||||
$url .= '2';
|
||||
$url .= "2";
|
||||
} else {
|
||||
$url .= ($page + 1);
|
||||
$url .= $page + 1;
|
||||
}
|
||||
if ($qs) {
|
||||
$url .= '/?' . $qs;
|
||||
$url .= "/?" . $qs;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
function format_link($link) {
|
||||
if (strpos($link, 'page-numbers dots')) {
|
||||
function format_link($link)
|
||||
{
|
||||
if (strpos($link, "page-numbers dots")) {
|
||||
return '<span class="pagination__dots"><svg class="icon icon--extra-small"><use href="#icon-ellipsis"></use></svg></span>';
|
||||
}
|
||||
$link = str_replace('page-numbers current', 'pagination__current', $link);
|
||||
$link = str_replace('page-numbers', 'link', $link);
|
||||
$link = str_replace("page-numbers current", "pagination__current", $link);
|
||||
$link = str_replace("page-numbers", "link", $link);
|
||||
return $link;
|
||||
}
|
||||
|
||||
if (count($links) > 1) :
|
||||
?>
|
||||
if (count($links) > 1): ?>
|
||||
<div class="pagination">
|
||||
<?php if ($current > 1) : ?>
|
||||
<?php if ($current > 1): ?>
|
||||
<div class="pagination__previous">
|
||||
<a class="pagination__link" href="<?php echo get_previous_url($base_url, $current) ?>" aria-label="Previous page">
|
||||
<a class="pagination__link" href="<?php echo get_previous_url(
|
||||
$base_url,
|
||||
$current
|
||||
); ?>" aria-label="Previous page">
|
||||
<svg class="icon icon--small">
|
||||
<use href="#icon-chevron-left"></use>
|
||||
</svg>
|
||||
@@ -56,16 +61,19 @@ if (count($links) > 1) :
|
||||
<?php endif; ?>
|
||||
<nav class="pagination__content" role="navigation" aria-label="Pagination navigation">
|
||||
<ul class="pagination__list">
|
||||
<?php foreach($links as $link) { ?>
|
||||
<?php foreach ($links as $link) { ?>
|
||||
<li class="pagination__item">
|
||||
<?php echo format_link($link) ?>
|
||||
<?php echo format_link($link); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php if ($current < $total) : ?>
|
||||
<?php if ($current < $total): ?>
|
||||
<div class="pagination__next">
|
||||
<a class="pagination__link" href="<?php echo get_next_url($base_url, $current) ?>" aria-label="Next page">
|
||||
<a class="pagination__link" href="<?php echo get_next_url(
|
||||
$base_url,
|
||||
$current
|
||||
); ?>" aria-label="Next page">
|
||||
<svg class="icon icon--small">
|
||||
<use href="#icon-chevron-right"></use>
|
||||
</svg>
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
<?php
|
||||
global $podcast;
|
||||
$artwork = get_template_directory_uri().'/images/'.$podcast['id'].'.png';
|
||||
$artwork = get_template_directory_uri() . "/images/" . $podcast["id"] . ".png";
|
||||
?>
|
||||
<div class="excerpt">
|
||||
<div class="excerpt__head">
|
||||
<img
|
||||
class="excerpt__image"
|
||||
title="<?php echo $podcast['podcast_title'] ?>"
|
||||
src="<?php echo $artwork ?>">
|
||||
title="<?php echo $podcast["podcast_title"]; ?>"
|
||||
src="<?php echo $artwork; ?>">
|
||||
<h3 class="excerpt__title">
|
||||
<a class="link" href="<?php echo $podcast['url'] ?>">
|
||||
<?php echo $podcast['title'] ?>
|
||||
<a class="link" href="<?php echo $podcast["url"]; ?>">
|
||||
<?php echo $podcast["title"]; ?>
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="excerpt__body">
|
||||
<?php echo $podcast['description'] ?>
|
||||
<?php echo $podcast["description"]; ?>
|
||||
</div>
|
||||
<div class="excerpt__foot">
|
||||
<audio class="excerpt__audio" src="<?php echo $podcast['audio'] ?>" controls="true">
|
||||
<audio class="excerpt__audio" src="<?php echo $podcast[
|
||||
"audio"
|
||||
]; ?>" controls="true">
|
||||
Your browser does not support the <code>audio</code> element.
|
||||
</audio>
|
||||
<ul class="excerpt__links">
|
||||
<li class="excerpt__link">
|
||||
<a
|
||||
class="link"
|
||||
href="<?php echo $podcast['audio'] ?>"
|
||||
href="<?php echo $podcast["audio"]; ?>"
|
||||
title="Download the MP3">
|
||||
Download MP3
|
||||
</a>
|
||||
</li>
|
||||
<li class="excerpt__link">
|
||||
<a class="link" href="<?php echo $podcast['podcast_episodes'] ?>">
|
||||
<a class="link" href="<?php echo $podcast["podcast_episodes"]; ?>">
|
||||
More episodes
|
||||
</a>
|
||||
</li>
|
||||
@@ -43,7 +45,7 @@ $artwork = get_template_directory_uri().'/images/'.$podcast['id'].'.png';
|
||||
<use href="#icon-calendar"></use>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="excerpt__text"><?php echo $podcast['date'] ?></span>
|
||||
<span class="excerpt__text"><?php echo $podcast["date"]; ?></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,52 +1,62 @@
|
||||
<?php
|
||||
global $wp_query;
|
||||
get_header();
|
||||
$query = $_GET['s'];
|
||||
$query = $_GET["s"];
|
||||
$results = $wp_query->found_posts;
|
||||
?>
|
||||
<main class="page">
|
||||
<section class="page__logo is-fixed">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<section class="page__content">
|
||||
<?php if ($results === 0) : ?>
|
||||
<?php if ($results === 0): ?>
|
||||
<h1 class="title">Sorry, no results found.</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
<?php else : ?>
|
||||
<a class="link" href="<?php echo get_site_url(); ?>/">Go back home</a>
|
||||
<?php else: ?>
|
||||
<h1 class="title">
|
||||
<?php
|
||||
echo $results.' result'.($results !== '1' ? 's' : '').' matching "' . $query . '" found.';
|
||||
?>
|
||||
<?php echo $results .
|
||||
" result" .
|
||||
($results !== "1" ? "s" : "") .
|
||||
' matching "' .
|
||||
$query .
|
||||
'" found.'; ?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
<ol>
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<?php if (have_posts()):
|
||||
while (have_posts()):
|
||||
the_post(); ?>
|
||||
<li>
|
||||
<?php
|
||||
$excerpt = array(
|
||||
$excerpt = [
|
||||
"title" => get_the_title(),
|
||||
"url" => get_the_permalink(),
|
||||
"content" => get_the_excerpt(),
|
||||
"author" => get_the_author_meta('nickname'),
|
||||
"author" => get_the_author_meta("nickname"),
|
||||
"comments" => get_comments_number(),
|
||||
"date" => get_the_date(get_option('date_format'), $id) . ' at ' . get_the_date(get_option('time_format'), $id),
|
||||
"date" =>
|
||||
get_the_date(get_option("date_format"), $id) .
|
||||
" at " .
|
||||
get_the_date(get_option("time_format"), $id),
|
||||
"words" => count(explode(" ", $post->post_content)),
|
||||
);
|
||||
get_template_part('partials/excerpt')
|
||||
];
|
||||
get_template_part("partials/excerpt");
|
||||
?>
|
||||
</li>
|
||||
<?php endwhile; endif; ?>
|
||||
<?php
|
||||
endwhile;
|
||||
endif; ?>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="page__pagination">
|
||||
<?php get_template_part('partials/pagination') ?>
|
||||
<?php get_template_part("partials/pagination"); ?>
|
||||
</section>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<form id="searchform" role="search" method="get" action="<?php echo get_site_url()?>">
|
||||
<form id="searchform" role="search" method="get" action="<?php echo get_site_url(); ?>">
|
||||
<div class="search">
|
||||
<label class="search__label" for="searchinput">
|
||||
Search
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?php get_header(); ?>
|
||||
<main class="page">
|
||||
<section class="page__logo is-fixed">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<?php if (have_posts()):
|
||||
while (have_posts()):
|
||||
the_post(); ?>
|
||||
<section class="page__article is-first">
|
||||
<article class="article">
|
||||
<div class="article__date">
|
||||
@@ -13,7 +15,7 @@
|
||||
</svg>
|
||||
</span>
|
||||
<span class="article__date-text">
|
||||
<?php the_time(get_option('date_format')) ?>
|
||||
<?php the_time(get_option("date_format")); ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="article__content">
|
||||
@@ -21,30 +23,39 @@
|
||||
<?php the_title(); ?>
|
||||
</h1>
|
||||
<div class="content">
|
||||
<?php the_content(__('Continue reading <span class="meta-nav">»</span>', 'windycoys')); ?>
|
||||
<?php the_content(
|
||||
__(
|
||||
'Continue reading <span class="meta-nav">»</span>',
|
||||
"windycoys"
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<section class="page__metadata is-fixed">
|
||||
<?php get_template_part('partials/metadata') ?>
|
||||
<?php get_template_part("partials/metadata"); ?>
|
||||
</section>
|
||||
<section class="page__comments">
|
||||
<?php comments_template() ?>
|
||||
<?php comments_template(); ?>
|
||||
</section>
|
||||
<?php endwhile; ?>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
endwhile; ?>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<section class="page__content">
|
||||
<h1 class="title">Sorry, there is no article to display</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
<a class="link" href="<?php echo get_site_url(); ?>/">Go back home</a>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endif; ?>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
45
src/tag.php
45
src/tag.php
@@ -1,7 +1,7 @@
|
||||
<?php get_header() ?>
|
||||
<?php get_header(); ?>
|
||||
<main class="page">
|
||||
<section class="page__logo is-fixed">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
<?php get_template_part("partials/logo"); ?>
|
||||
</section>
|
||||
<section class="page__content">
|
||||
<h1 class="title">
|
||||
@@ -11,43 +11,52 @@
|
||||
</svg>
|
||||
</span>
|
||||
<span class="title__text">
|
||||
<?php echo single_tag_title() ?>
|
||||
<?php echo single_tag_title(); ?>
|
||||
</span>
|
||||
</h1>
|
||||
<ol>
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<?php if (have_posts()):
|
||||
while (have_posts()):
|
||||
the_post(); ?>
|
||||
<li>
|
||||
<?php
|
||||
$excerpt = array(
|
||||
$excerpt = [
|
||||
"title" => get_the_title(),
|
||||
"url" => get_the_permalink(),
|
||||
"content" => get_the_excerpt(),
|
||||
"author" => get_the_author_meta('nickname'),
|
||||
"author" => get_the_author_meta("nickname"),
|
||||
"comments" => get_comments_number(),
|
||||
"date" => get_the_date(get_option('date_format'), $id) . ' at ' . get_the_date(get_option('time_format'), $id),
|
||||
"date" =>
|
||||
get_the_date(get_option("date_format"), $id) .
|
||||
" at " .
|
||||
get_the_date(get_option("time_format"), $id),
|
||||
"words" => count(explode(" ", $post->post_content)),
|
||||
);
|
||||
get_template_part('partials/excerpt');
|
||||
];
|
||||
get_template_part("partials/excerpt");
|
||||
?>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
<?php
|
||||
endwhile; ?>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="page__pagination">
|
||||
<?php get_template_part('partials/pagination') ?>
|
||||
<?php get_template_part("partials/pagination"); ?>
|
||||
</section>
|
||||
<?php else: ?>
|
||||
<?php
|
||||
else:
|
||||
?>
|
||||
<section class="page__content">
|
||||
<h1 class="title">Sorry, no results found.</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
<a class="link" href="<?php echo get_site_url(); ?>/">Go back home</a>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endif; ?>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
<?php get_template_part("partials/banner"); ?>
|
||||
</section>
|
||||
<section class="page__footer">
|
||||
<?php get_template_part('partials/footer') ?>
|
||||
<?php get_template_part("partials/footer"); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_template_part('partials/navigation') ?>
|
||||
<?php get_footer() ?>
|
||||
<?php get_template_part("partials/navigation"); ?>
|
||||
<?php get_footer(); ?>
|
||||
|
||||
Reference in New Issue
Block a user