Committing Photos theme

This commit is contained in:
Chris Runnells 2018-09-24 16:26:10 -10:00
parent 5f56076846
commit 1ec346a4e7
40 changed files with 6773 additions and 0 deletions

60
photos/404.php Normal file
View file

@ -0,0 +1,60 @@
<?php
/**
* The template for displaying 404 pages (not found)
*
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
*
* @package photos
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<section class="error-404 not-found">
<header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Oops! That page can&rsquo;t be found.', 'photos' ); ?></h1>
</header><!-- .page-header -->
<div class="page-content">
<p><?php esc_html_e( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'photos' ); ?></p>
<?php
get_search_form();
the_widget( 'WP_Widget_Recent_Posts' );
?>
<div class="widget widget_categories">
<h2 class="widget-title"><?php esc_html_e( 'Most Used Categories', 'photos' ); ?></h2>
<ul>
<?php
wp_list_categories( array(
'orderby' => 'count',
'order' => 'DESC',
'show_count' => 1,
'title_li' => '',
'number' => 10,
) );
?>
</ul>
</div><!-- .widget -->
<?php
/* translators: %1$s: smiley */
$photos_archive_content = '<p>' . sprintf( esc_html__( 'Try looking in the monthly archives. %1$s', 'photos' ), convert_smilies( ':)' ) ) . '</p>';
the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$photos_archive_content" );
the_widget( 'WP_Widget_Tag_Cloud' );
?>
</div><!-- .page-content -->
</section><!-- .error-404 -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

339
photos/LICENSE Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

48
photos/archive.php Normal file
View file

@ -0,0 +1,48 @@
<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="archive-description">', '</div>' );
?>
</header><!-- .page-header -->
<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'grid' );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();

237
photos/blocks.css Normal file
View file

@ -0,0 +1,237 @@
/*--------------------------------------------------------------
## Gutenberg Styles
--------------------------------------------------------------*/
/* Alignments */
.alignfull {
text-align: center;
max-width: 100%;
}
.alignwide {
/* max-width: 75%; */
max-width: 1020px;
margin-left: auto;
margin-right: auto;
}
.alignleft figcaption {}
.alignright figcaption {}
.wp-block-image.alignleft {}
.wp-block-image.alignright {}
.wp-block-image.aligncenter {}
.wp-block-gallery.alignleft,
.wp-block-gallery.alignright {}
/* Text sizing */
.is-small-text {}
.is-regular-text {}
.is-large-text {}
.is-larger-text {}
/* Dropcaps */
p.has-drop-cap:first-letter {
font-family: -apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif;
font-size: 64px;
font-size: 6.4rem;
}
/* Images */
.wp-block-image {}
.wp-block-image figcaption {}
/* Galleries */
.wp-block-gallery {
margin-bottom: 3rem;
}
.columns-1 {}
.columns-2 {}
.columns-3 {}
.columns-4 {}
.columns-5 {}
/* Captions */
.wp-block-image figcaption,
.wp-block-audio figcaption,
.wp-block-video figcaption {
color: #606060;
}
/* Blockquotes*/
.wp-block-quote {
border-left: 3px solid #d63031;
padding-left: 2.7rem;
}
.wp-block-quote.is-large {
border-left-width: 6px;
margin-left: auto;
margin-right: auto;
margin-bottom: 3rem;
padding-left: 3.4rem;
}
.wp-block-quote p:last-of-type {
margin-bottom: 0;
}
.wp-block-quote cite {
color: #606060;
font-size: 16px;
font-weight: 300;
}
.blocks-quote-style-1 {}
.blocks-quote-style-2 {}
/* Cover Images */
.wp-block-cover-image {}
.wp-block-cover-image.alignfull {}
.wp-block-cover-image.has-background-dim:before {}
.has-parallax {}
/* Video */
.wp-block-video {}
/* Audio */
.wp-block-audio {}
.wp-block-audio.alignleft,
.wp-block-audio.alignright {
width: 32rem;
}
.wp-block-video video,
.wp-block-audio audio {
height: auto;
width: 100%;
}
/* Pullquotes */
.wp-block-pullquote {
border-bottom: 3px solid #d63031;
border-left: none;
border-top: 3px solid #d63031;
padding: 1.5em;
}
.wp-block-pullquote > p {}
.wp-block-pullquote > cite {}
.wp-block-pullquote.alignleft > p,
.wp-block-pullquote.alignright > p {}
.entry-content .wp-block-pullquote.alignleft {
text-align: left;
}
.entry-content .wp-block-pullquote.alignright {
text-align: right;
}
.wp-block-pullquote.alignleft,
.wp-block-pullquote.alignright {
max-width: 320px;
padding-bottom: 2rem;
padding-top: 1rem;
}
.wp-block-pullquote.alignwide {
padding: 1.5em calc( 37.5% - 510px );
}
.wp-block-pullquote.alignfull {
padding: 1.5em calc( 50% - 510px );
}
/* Categories */
.wp-block-categories-list {}
/* Tables */
.wp-block-table {
display: table;
}
.wp-block-table.alignleft,
.wp-block-table.alignright {
max-width: 50%;
}
/* Preformatted */
.wp-block-preformatted {}
/* Code */
.wp-block-code {}
/* Verse */
.wp-block-verse {}
.wp-block-verse.aligncenter {
text-align: center;
}
.wp-block-verse.alignleft {
text-align: left;
}
.wp-block-verse.alignright {
text-align: right;
}
/* Separator */
.wp-block-separator {
background-color: transparent;
border-bottom: 1px solid #dcdcdc;
margin-bottom: 1.5em;
}
.wp-block-separator.alignwide {
width: 75vw;
}
.wp-block-separator.alignfull {
width: 100vw;
}
/* Buttons */
.wp-block-button .wp-block-button__link {
border-radius: 4px;
padding: 0.5em 0.75em;
line-height: 1.5;
margin-bottom: 1.5em;
text-align: center;
transition: background 150ms ease-in-out,
color 150ms ease-in-out;
}
.wp-block-button__link {
background: #f0f0f0;
color: #d63031;
}
.wp-block-button__link:hover {
color: #fff;
background-color: #d63031;
}
.wp-block-button .wp-block-button__link {}
.wp-block-button a {}
.wp-block-button a:hover,
.wp-block-button a:focus,
.wp-block-button a:active {}
/* Text Columns */
.wp-block-text-columns {}
.wp-block-column {}
/* Latest Posts */
.wp-block-latest-posts {}
.wp-block-latest-posts__post-date {}

77
photos/comments.php Normal file
View file

@ -0,0 +1,77 @@
<?php
/**
* The template for displaying comments
*
* This is the template that displays the area of the page that contains both the current comments
* and the comment form.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
?>
<div id="comments" class="comments-area">
<?php
// You can start editing here -- including this comment!
if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
$photos_comment_count = get_comments_number();
if ( '1' === $photos_comment_count ) {
printf(
/* translators: 1: title. */
esc_html__( 'One reply to &ldquo;%1$s&rdquo;', 'photos' ),
'<span>' . get_the_title() . '</span>'
);
} else {
printf( // WPCS: XSS OK.
/* translators: 1: comment count number, 2: title. */
esc_html( _nx( '%1$s reply to &ldquo;%2$s&rdquo;', '%1$s replies to &ldquo;%2$s&rdquo;', $photos_comment_count, 'comments title', 'photos' ) ),
number_format_i18n( $photos_comment_count ),
'<span>' . get_the_title() . '</span>'
);
}
?>
</h2><!-- .comments-title -->
<ol class="comment-list">
<?php
wp_list_comments( array(
'avatar_size' => 46,
'short_ping' => true,
'style' => 'ol',
) );
?>
</ol><!-- .comment-list -->
<?php
the_comments_pagination( array(
'prev_text' => photos_get_svg( array( 'icon' => 'previous' ) ) . '<span class="screen-reader-text">' . esc_html__( 'Previous', 'photos' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . esc_html__( 'Next', 'photos' ) . '</span>' . photos_get_svg( array( 'icon' => 'next' ) ),
) );
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() ) :
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'photos' ); ?></p>
<?php
endif;
endif; // Check for have_comments().
comment_form();
?>
</div><!-- #comments -->

34
photos/footer.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/**
* The template for displaying the footer
*
* Contains the closing of the #content div and all content after.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package photos
*/
?>
</div><!-- #content -->
<footer id="colophon" class="site-footer">
<div class="container">
<?php photos_social_menu(); ?>
<div class="site-info">
<a href="<?php echo esc_url( __( 'https://wordpress.com/', 'photos' ) ); ?>">
<?php
/* translators: 1: Theme name, 2: Theme author. */
printf( esc_html__( 'Theme: %1$s by %2$s.', 'photos' ), 'Photos', '<a href="http://wordpress.com/themes/" rel="designer">Automattic</a>' );
?>
</a>
</div><!-- .site-info -->
</div><!-- .container -->
</footer><!-- #colophon -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>

239
photos/functions.php Normal file
View file

@ -0,0 +1,239 @@
<?php
/**
* Photos functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package photos
*/
if ( ! function_exists( 'photos_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function photos_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Photos, use a find and replace
* to change 'photos' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'photos', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 320, 320, true );
// Home page thumbnails
// Double-sized for retina
add_image_size( 'photos-grid-thumb', 640, 640, true );
add_image_size( 'photos-featured', 2040, 9999, false );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'menu-1', esc_html__( 'Primary', 'photos' ) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'photos_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 360,
'width' => 720,
'flex-width' => true,
'flex-height' => true,
'header-text' => array(
'site-title',
'site-description',
),
) );
// Custom header support
add_theme_support( 'custom-header', apply_filters( 'photos_custom_header_args', array(
'default-image' => '',
'default-text-color' => '111111',
'width' => 1920,
'height' => 400,
'flex-height' => true,
'flex-width' => true,
) ) );
/* Gutenberg! */
add_theme_support( 'align-wide' );
add_theme_support( 'editor-color-palette', array(
array(
'name' => esc_html__( 'red', 'photos' ),
'slug' => 'red',
'color' => '#d63031',
),
array(
'name' => esc_html__( 'charcoal', 'photos' ),
'slug' => 'charcoal',
'color' => '#111',
),
array(
'name' => esc_html__( 'very light gray', 'photos' ),
'slug' => 'very-light-gray',
'color' => '#f0f0f0',
),
array(
'name' => esc_html__( 'very dark gray', 'photos' ),
'slug' => 'very-dark-gray',
'color' => '#404040',
),
array(
'name' => esc_html__( 'medium gray', 'photos' ),
'slug' => 'medium-gray',
'color' => '#606060',
)
) );
}
endif;
add_action( 'after_setup_theme', 'photos_setup' );
/**
* Set posts per page on theme switch
*/
function photos_setup_options() {
// Set the number of posts to display per page
update_option( 'posts_per_page', 12 );
}
add_action( 'after_switch_theme', 'photos_setup_options' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function photos_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'photos_content_width', 640 );
}
add_action( 'after_setup_theme', 'photos_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function photos_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Footer', 'photos' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'These widgets will be displayed at the bottom of each page.', 'photos' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'photos_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function photos_scripts() {
// Main stylesheet
wp_enqueue_style( 'photos-style', get_stylesheet_uri() );
// Gutenberg styles
wp_enqueue_style( 'photos-blocks', get_template_directory_uri() . '/blocks.css' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'photos-global', get_theme_file_uri( '/js/global.js' ), array( 'jquery' ), '20180724', true );
wp_enqueue_script( 'photos-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
$photos_l10n = array();
if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'photos-navigation', get_theme_file_uri( '/js/navigation.js' ), array( 'jquery' ), '1.0', true );
$photos_l10n['expand'] = esc_attr__( 'Expand child menu', 'photos' );
$photos_l10n['collapse'] = esc_attr__( 'Collapse child menu', 'photos' );
$photos_l10n['icon'] = photos_get_svg( array( 'icon' => 'expand', 'fallback' => true ) );
}
wp_localize_script( 'photos-navigation', 'photosScreenReaderText', $photos_l10n );
}
add_action( 'wp_enqueue_scripts', 'photos_scripts' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Logo Resizer: Bringing logo resizing to the Customizer.
*/
require get_template_directory() . '/inc/logo-resizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* SVG icons functions and filters.
*/
require get_template_directory() . '/inc/icon-functions.php';

79
photos/header.php Normal file
View file

@ -0,0 +1,79 @@
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package photos
*/
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'photos' ); ?></a>
<header id="masthead" class="site-header">
<div class="container">
<div class="site-branding">
<?php if ( has_custom_logo() ) : ?>
<div class="site-logo"><?php the_custom_logo(); ?></div>
<?php endif; ?>
<?php
if ( is_front_page() && is_home() ) :
?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php
else :
?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php
endif;
$photos_description = get_bloginfo( 'description', 'display' );
if ( $photos_description || is_customize_preview() ) :
?>
<p class="site-description"><?php echo $photos_description; /* WPCS: xss ok. */ ?></p>
<?php endif; ?>
</div><!-- .site-branding -->
<nav id="site-navigation" class="main-navigation">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
<?php
echo photos_get_svg( array( 'icon' => 'menu', 'title' => esc_html__( 'Open Menu', 'photos' ) ) ); // WPCS: XSS OK.
echo photos_get_svg( array( 'icon' => 'close-alt', 'title' => esc_html__( 'Close Menu', 'photos' ) ) ); // WPCS: XSS OK.
?>
<span>
<?php
esc_html_e( 'Menu', 'photos' );
?>
</span>
</button>
<?php
wp_nav_menu( array(
'theme_location' => 'menu-1',
'menu_id' => 'primary-menu',
'depth' => 4,
) );
?>
</nav><!-- #site-navigation -->
</div><!-- .container -->
</header><!-- #masthead -->
<div id="content" class="site-content">
<?php if ( get_header_image() ) : ?>
<div class="header-image">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php the_header_image_tag(); ?></a>
</div><!-- .header-image -->
<?php endif; ?>

View file

@ -0,0 +1,72 @@
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
<symbol viewBox="0 0 16 16" id="icon-close-alt">
<title>close-alt</title> <polygon points="14.7,2.7 13.3,1.3 8,6.6 2.7,1.3 1.3,2.7 6.6,8 1.3,13.3 2.7,14.7 8,9.4 13.3,14.7 14.7,13.3 9.4,8
"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-close">
<title>close</title> <polygon points="12.7,4.7 11.3,3.3 8,6.6 4.7,3.3 3.3,4.7 6.6,8 3.3,11.3 4.7,12.7 8,9.4 11.3,12.7 12.7,11.3 9.4,8
"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-collapse">
<title>collapse</title> <polygon points="8,4.6 1.3,11.3 2.7,12.7 8,7.4 13.3,12.7 14.7,11.3 "/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-comment">
<title>comment</title> <g>
<path d="M12,4H4C2.9,4,2,4.9,2,6v8l2.4-2.4C4.8,11.2,5.3,11,5.8,11H12c1.1,0,2-0.9,2-2V6C14,4.9,13.1,4,12,4z"/> </g>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-ellipsis">
<title>ellipsis</title>
<path d="M2,6.2C1,6.2,0.2,7,0.2,8S1,9.8,2,9.8S3.8,9,3.8,8S3,6.2,2,6.2z M14,6.2c-1,0-1.8,0.8-1.8,1.8S13,9.8,14,9.8S15.8,9,15.8,8
S15,6.2,14,6.2z M8,6.2C7,6.2,6.2,7,6.2,8S7,9.8,8,9.8S9.8,9,9.8,8S9,6.2,8,6.2z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-expand">
<title>expand</title> <polygon points="8,12.7 1.3,6 2.7,4.6 8,9.9 13.3,4.6 14.7,6 "/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-gallery">
<title>gallery</title>
<path d="M12,10V4c0-1.1-0.9-2-2-2H4C2.9,2,2,2.9,2,4v6c0,1.1,0.9,2,2,2h6C11.1,12,12,11.1,12,10z M5.5,7l1.1,1.6l1.5-2.4L10,10H4
L5.5,7z M13,5v8H7H5c0,1.1,0.9,2,2,2h6c1.1,0,2-0.9,2-2V7C15,5.9,14.1,5,13,5z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-heart">
<title>heart</title>
<path d="M8,13L2.9,8.2C1.8,7.1,1.7,5.2,2.7,4c1-1.2,2.8-1.3,4-0.2L8,5l1.3-1.2c1.2-1.1,3-1,4,0.2c1.1,1.2,1,3.1-0.2,4.2L8,13z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-lock">
<title>lock</title>
<path d="M12,8V6c0-2.2-1.8-4-4-4S4,3.8,4,6v2C3.4,8,3,8.4,3,9v4c0,0.6,0.4,1,1,1h8c0.6,0,1-0.4,1-1V9C13,8.4,12.6,8,12,8z M6,8V6
c0-1.1,0.9-2,2-2s2,0.9,2,2v2H6z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-menu">
<title>menu</title>
<path d="M0,14h16v-2H0V14z M0,2v2h16V2H0z M0,9h16V7H0V9z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-next">
<title>next</title> <polygon points="3,7 9.6,7 7.3,4.7 8.7,3.3 13.4,8 8.7,12.7 7.3,11.3 9.6,9 3,9 "/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-pinned">
<title>pinned</title>
<path d="M12,8c0-0.5-0.5-1-1-1h-0.6l-0.3-3C10.6,3.9,11,3.5,11,3c0-0.5-0.5-1-1-1H6C5.5,2,5,2.5,5,3c0,0.5,0.4,0.9,0.9,1L5.6,7H5
C4.5,7,4,7.5,4,8v1h3v6l2-1V9h3V8z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-previous">
<title>previous</title> <polygon points="13,7 6.4,7 8.7,4.7 7.3,3.3 2.6,8 7.3,12.7 8.7,11.3 6.4,9 13,9 "/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-reply">
<title>reply</title>
<path d="M10,6H8V3L3,8l5,5v-3h2c1,0,2,0.4,2.8,1.2l1.2,1.2V10C14,7.8,12.2,6,10,6z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-search">
<title>search</title>
<path d="M14.7,13.3L11,9.6c0.6-0.9,1-2,1-3.1C12,3.5,9.5,1,6.5,1S1,3.5,1,6.5S3.5,12,6.5,12c1.2,0,2.2-0.4,3.1-1l3.7,3.7L14.7,13.3z
M2.5,6.5c0-2.2,1.8-4,4-4s4,1.8,4,4s-1.8,4-4,4S2.5,8.7,2.5,6.5z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-share">
<title>share</title>
<path d="M7,4.4V10h2V4.4l1.1,1.1l1.4-1.4L8,0.6L4.5,4.1l1.4,1.4L7,4.4z M12,6h-2v1.5h2c0.3,0,0.5,0.2,0.5,0.5v4
c0,0.3-0.2,0.5-0.5,0.5H4c-0.3,0-0.5-0.2-0.5-0.5V8c0-0.3,0.2-0.5,0.5-0.5h2V6H4C2.9,6,2,6.9,2,8v4c0,1.1,0.9,2,2,2h8
c1.1,0,2-0.9,2-2V8C14,6.9,13.1,6,12,6z"/>
</symbol>
<symbol viewBox="0 0 16 16" id="icon-star">
<title>star</title> <polygon points="8,1.3 10,5.9 15,6.4 11.3,9.8 12.3,14.7 8,12.2 3.7,14.7 4.7,9.8 1,6.4 6,5.9 "/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

55
photos/inc/customizer.php Normal file
View file

@ -0,0 +1,55 @@
<?php
/**
* photos Theme Customizer
*
* @package photos
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function photos_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a',
'render_callback' => 'photos_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => 'photos_customize_partial_blogdescription',
) );
}
}
add_action( 'customize_register', 'photos_customize_register' );
/**
* Render the site title for the selective refresh partial.
*
* @return void
*/
function photos_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
*
* @return void
*/
function photos_customize_partial_blogdescription() {
bloginfo( 'description' );
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function photos_customize_preview_js() {
wp_enqueue_script( 'photos-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
}
add_action( 'customize_preview_init', 'photos_customize_preview_js' );

View file

@ -0,0 +1,121 @@
{
"settings": {
"options": {
"show_on_front": "posts",
"posts_per_page": "12",
"featured-content": false
},
"theme_mods": {
"0": false,
"nav_menu_locations": {
"primary": "primary",
"social": "social-media"
},
"custom_css_post_id": -1
},
"headstart": {
"mapped_id_options": [],
"mapped_id_theme_mods": [],
"keep_submenu_items": true
}
},
"content": [
{
"post_title": "About",
"post_content": "This is an example of an about page. Unlike posts, pages are better suited for more timeless content that you want to be easily accessible, like your About or Contact information. Click the Edit link to make changes to this page or <a href=\"https:\/\/wordpress.com\/page\">add another page<\/a>.",
"post_status": "publish",
"menu_order": 2,
"comment_status": "closed",
"ping_status": "closed",
"post_type": "page",
"hs_custom_meta": "_hs_about_page",
"hs_sharing": 1,
"hs_like_status": 1,
"attachment_url": "https:\/\/headstartdata.files.wordpress.com\/2016\/06\/stairs-lights-abstract-bubbles1.jpg",
"hs_old_id": 100
},
{
"post_title": "Contact",
"post_content": "This is a contact page with some basic contact information and a contact form. [contact-form][contact-field label=\"Name\" type=\"name\" required=\"1\"\/][contact-field label=\"Email\" type=\"email\" required=\"1\"\/][contact-field label=\"Website\" type=\"url\"\/][contact-field label=\"Comment\" type=\"textarea\" required=\"1\"\/][\/contact-form]",
"post_status": "publish",
"menu_order": 3,
"comment_status": "closed",
"ping_status": "closed",
"post_type": "page",
"hs_custom_meta": "_hs_contact_page",
"hs_sharing": 1,
"hs_like_status": 1,
"attachment_url": "https:\/\/headstartdata.files.wordpress.com\/2016\/06\/person-smartphone-office-table.jpeg",
"hs_old_id": 101
},
{
"post_title": "First blog post",
"post_content": "This is your very first post. Click the Edit link to modify or delete it, or <a href=\"https:\/\/wordpress.com\/post\">start a new post<\/a>. If you like, use this post to tell readers why you started this blog and what you plan to do with it.",
"post_excerpt": "This is the excerpt for your very first post.",
"post_status": "publish",
"comment_status": "open",
"ping_status": "open",
"post_type": "post",
"hs_custom_meta": "_hs_first_post",
"hs_sharing": 1,
"hs_like_status": 1,
"attachment_url": "https:\/\/headstartdata.files.wordpress.com\/2016\/06\/pexels-photo-30732.jpg",
"hs_old_id": 102
}
],
"menus": {
"social-media": {
"name": "Social Media",
"items": [
{
"menu-item-title": "Facebook",
"menu-item-db-id": 175,
"menu-item-object-id": "175",
"menu-item-object": "custom",
"menu-item-type": "custom",
"menu-item-status": "publish",
"menu-item-position": 0,
"menu-item-parent-id": "0",
"menu-item-description": "",
"menu-item-url": "http:\/\/www.facebook.com"
},
{
"menu-item-title": "LinkedIn",
"menu-item-db-id": 176,
"menu-item-object-id": "176",
"menu-item-object": "custom",
"menu-item-type": "custom",
"menu-item-status": "publish",
"menu-item-position": 1,
"menu-item-parent-id": "0",
"menu-item-description": "",
"menu-item-url": "http:\/\/www.linkedin.com"
},
{
"menu-item-title": "Twitter",
"menu-item-db-id": 177,
"menu-item-object-id": "177",
"menu-item-object": "custom",
"menu-item-type": "custom",
"menu-item-status": "publish",
"menu-item-position": 2,
"menu-item-parent-id": "0",
"menu-item-description": "",
"menu-item-url": "http:\/\/www.twitter.com"
},
{
"menu-item-title": "Instagram",
"menu-item-db-id": 178,
"menu-item-object-id": "178",
"menu-item-object": "custom",
"menu-item-type": "custom",
"menu-item-status": "publish",
"menu-item-position": 3,
"menu-item-parent-id": "0",
"menu-item-description": "",
"menu-item-url": "http:\/\/www.instagram.com"
}
]
}
}
}

View file

@ -0,0 +1,161 @@
<?php
/**
* SVG icons related functions and filters
*/
/**
* Add SVG definitions to the footer.
*/
function photos_include_svg_icons() {
// Define SVG sprite file.
$svg_icons = get_parent_theme_file_path( '/icons/svg-icons.svg' );
// If it exists, include it.
if ( file_exists( $svg_icons ) ) {
require_once( $svg_icons );
}
}
add_action( 'wp_footer', 'photos_include_svg_icons', 9999 );
/**
* Return SVG markup.
*
* @param array $args {
* Parameters needed to display an SVG.
*
* @type string $icon Required SVG icon filename.
* @type string $title Optional SVG title.
* @type string $desc Optional SVG description.
* }
* @return string SVG markup.
*/
function photos_get_svg( $args = array() ) {
// Make sure $args are an array.
if ( empty( $args ) ) {
return __( 'Please define default parameters in the form of an array.', 'photos' );
}
// Define an icon.
if ( false === array_key_exists( 'icon', $args ) ) {
return __( 'Please define an SVG icon filename.', 'photos' );
}
// Set defaults.
$defaults = array(
'icon' => '',
'title' => '',
'desc' => '',
'fallback' => false,
);
// Parse args.
$args = wp_parse_args( $args, $defaults );
// Set aria hidden.
$aria_hidden = ' aria-hidden="true"';
// Set ARIA.
$aria_labelledby = '';
/*
* Photos doesn't use the SVG title or description attributes; non-decorative icons are described with .screen-reader-text.
*
* However, child themes can use the title and description to add information to non-decorative SVG icons to improve accessibility.
*
* Example 1 with title: <?php echo photos_get_svg( array( 'icon' => 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ) ) ); ?>
*
* Example 2 with title and description: <?php echo photos_get_svg( array( 'icon' => 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ), 'desc' => __( 'This is the description', 'textdomain' ) ) ); ?>
*
* See https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/.
*/
if ( $args['title'] ) {
$aria_hidden = '';
$unique_id = uniqid();
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"';
if ( $args['desc'] ) {
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"';
}
}
// Begin SVG markup.
$svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . $aria_labelledby . ' role="img">';
// Display the title.
if ( $args['title'] ) {
$svg .= '<title id="title-' . $unique_id . '">' . esc_html( $args['title'] ) . '</title>';
// Display the desc only if the title is already set.
if ( $args['desc'] ) {
$svg .= '<desc id="desc-' . $unique_id . '">' . esc_html( $args['desc'] ) . '</desc>';
}
}
/*
* Display the icon.
*
* The whitespace around `<use>` is intentional - it is a work around to a keyboard navigation bug in Safari 10.
*
* See https://core.trac.wordpress.org/ticket/38387.
*/
$svg .= ' <use href="#icon-' . esc_html( $args['icon'] ) . '" xlink:href="#icon-' . esc_html( $args['icon'] ) . '"></use> ';
// Add some markup to use as a fallback for browsers that do not support SVGs.
if ( $args['fallback'] ) {
$svg .= '<span class="svg-fallback icon-' . esc_attr( $args['icon'] ) . '"></span>';
}
$svg .= '</svg>';
return $svg;
}
/**
* Add dropdown icon if menu item has children.
*
* @param string $title The menu item's title.
* @param object $item The current menu item.
* @param array $args An array of wp_nav_menu() arguments.
* @param int $depth Depth of menu item. Used for padding.
* @return string $title The menu item's title with dropdown icon.
*/
function photos_dropdown_icon_to_menu_link( $title, $item, $args, $depth ) {
if ( 'menu-1' === $args->theme_location ) {
foreach ( $item->classes as $value ) {
if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) {
$title = $title . photos_get_svg( array( 'icon' => 'expand' ) );
}
}
}
return $title;
}
add_filter( 'nav_menu_item_title', 'photos_dropdown_icon_to_menu_link', 10, 4 );
/**
* Add an icon above the post thumbnail image (when appropriate)
*/
function photos_post_icon() {
$icon = '';
if ( is_sticky() ) {
$icon = 'pinned';
$title = esc_html__( 'Featured', 'photos' );
} elseif ( post_password_required() ) {
$icon = 'lock';
$title = esc_html__( 'Password Protected', 'photos' );
}
if ( empty( $icon ) ) return;
$args = array();
$args['icon'] = $icon;
$args['title'] = $title;
return photos_get_svg( $args );
}

View file

@ -0,0 +1,647 @@
<?php
add_filter( 'typekit_add_font_category_rules', function( $category_rules ) {
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'h1',
array(
array( 'property' => 'font-size', 'value' => '2em' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'b,
strong',
array(
array( 'property' => 'font-weight', 'value' => 'bolder' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'small',
array(
array( 'property' => 'font-size', 'value' => '80%' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'sub,
sup',
array(
array( 'property' => 'font-size', 'value' => '75%' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'button,
input,
optgroup,
select,
textarea',
array(
array( 'property' => 'font-family', 'value' => 'inherit' ),
array( 'property' => 'font-size', 'value' => '100%' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'::-webkit-file-upload-button',
array(
array( 'property' => 'font', 'value' => 'inherit' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'html',
array(
array( 'property' => 'font-size', 'value' => '62.5%' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'body,
button,
input,
optgroup,
select,
textarea',
array(
array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
array( 'property' => 'font-size', 'value' => '16px' ),
array( 'property' => 'font-size', 'value' => '1.6rem' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'h1,
h2,
h3,
h4,
h5,
h6',
array(
array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'cite,
dfn,
em,
i',
array(
array( 'property' => 'font-style', 'value' => 'italic' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'blockquote',
array(
array( 'property' => 'font-style', 'value' => 'italic' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'blockquote cite',
array(
array( 'property' => 'font-style', 'value' => 'normal' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'big',
array(
array( 'property' => 'font-size', 'value' => '125%' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'dt',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'caption,
th',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'button,
input[type="button"],
input[type="reset"],
input[type="submit"]',
array(
array( 'property' => 'font-size', 'value' => '15px' ),
array( 'property' => 'font-size', 'value' => '1.5rem' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.required',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.nav-links .nav-meta',
array(
array( 'property' => 'font-size', 'value' => '14px' ),
array( 'property' => 'font-size', 'value' => '1.4rem' ),
array( 'property' => 'font-weight', 'value' => '100' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.nav-links a',
array(
array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
array( 'property' => 'font-size', 'value' => '18px' ),
array( 'property' => 'font-size', 'value' => '1.8rem' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.nav-links .current',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.screen-reader-text:focus',
array(
array( 'property' => 'font-size', 'value' => '16px' ),
array( 'property' => 'font-size', 'value' => '1.6rem' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.widget-title',
array(
array( 'property' => 'font-size', 'value' => '16px' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.widget_calendar a',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.widget_goodreads h2[class^="gr_custom_header_"]',
array(
array( 'property' => 'font-size', 'value' => '2rem' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.widget_blog_subscription input[type="submit"]',
array(
array( 'property' => 'font-size', 'value' => '1.6rem' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-title,
.page-title',
array(
array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
array( 'property' => 'font-size', 'value' => '28px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h1,
.page-content h1',
array(
array( 'property' => 'font-size', 'value' => '34px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h2,
.page-content h2',
array(
array( 'property' => 'font-size', 'value' => '28px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h3,
.page-content h3',
array(
array( 'property' => 'font-size', 'value' => '24px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h4,
.page-content h4',
array(
array( 'property' => 'font-size', 'value' => '20px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h5,
.page-content h5',
array(
array( 'property' => 'font-size', 'value' => '16px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h6,
.page-content h6',
array(
array( 'property' => 'font-size', 'value' => '14px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.entry-footer',
array(
array( 'property' => 'font-size', 'value' => '14px' ),
array( 'property' => 'font-size', 'value' => '1.4rem' ),
array( 'property' => 'font-weight', 'value' => '100' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.entry-footer span a',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.page-links',
array(
array( 'property' => 'font-size', 'value' => '14px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.page-links .page-number',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.comments-title',
array(
array( 'property' => 'font-size', 'value' => '2rem' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-meta',
array(
array( 'property' => 'font-size', 'value' => '1.4rem' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-metadata',
array(
array( 'property' => 'font-weight', 'value' => '100' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-body .comment-edit-link',
array(
array( 'property' => 'font-size', 'value' => '1.7rem' ),
array( 'property' => 'font-weight', 'value' => 'normal' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-reply-link',
array(
array( 'property' => 'font-size', 'value' => '14px' ),
array( 'property' => 'font-size', 'value' => '1.4rem' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-form .submit',
array(
array( 'property' => 'font-size', 'value' => '17px' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.pingback .comment-body .url',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'#infinite-handle span button,
#infinite-handle span button:focus,
#infinite-handle span button:hover',
array(
array( 'property' => 'font-size', 'value' => '16px' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.wp-caption-text',
array(
array( 'property' => 'font-size', 'value' => '0.8em' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.gallery-caption',
array(
array( 'property' => 'font-size', 'value' => '0.8em' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.site-title',
array(
array( 'property' => 'font-family', 'value' => '-apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif' ),
array( 'property' => 'font-size', 'value' => '20px' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.site-info',
array(
array( 'property' => 'font-weight', 'value' => '100' ),
array( 'property' => 'font-size', 'value' => '14px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.site-footer .jetpack-social-navigation a',
array(
array( 'property' => 'font-size', 'value' => '24px' ),
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.main-navigation .menu-toggle span',
array(
array( 'property' => 'font-size', 'value' => '14px' ),
array( 'property' => 'font-size', 'value' => '1.4rem' ),
array( 'property' => 'font-weight', 'value' => '600' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.site-title',
array(
array( 'property' => 'font-size', 'value' => '24px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.site-description',
array(
array( 'property' => 'font-size', 'value' => '17px' ),
array( 'property' => 'font-weight', 'value' => '100' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.main-navigation a',
array(
array( 'property' => 'font-weight', 'value' => 'bold' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-title,
.page-title',
array(
array( 'property' => 'font-size', 'value' => '42px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.entry-content,
.entry-summary,
.page-content',
array(
array( 'property' => 'font-size', 'value' => '20px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h1,
.page-content h1',
array(
array( 'property' => 'font-size', 'value' => '42px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h2,
.page-content h2',
array(
array( 'property' => 'font-size', 'value' => '35px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h3,
.page-content h3',
array(
array( 'property' => 'font-size', 'value' => '29px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h4,
.page-content h4',
array(
array( 'property' => 'font-size', 'value' => '24px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h5,
.page-content h5',
array(
array( 'property' => 'font-size', 'value' => '20px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.entry-content h6,
.page-content h6',
array(
array( 'property' => 'font-size', 'value' => '17px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.entry-footer,
.nav-links .nav-meta,
.page-links',
array(
array( 'property' => 'font-size', 'value' => '17px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.nav-links a',
array(
array( 'property' => 'font-size', 'value' => '24px' ),
array( 'property' => 'font-size', 'value' => '2.4rem' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.nav-links .arrow a,
.nav-links .page-numbers',
array(
array( 'property' => 'font-size', 'value' => '20px' ),
array( 'property' => 'font-size', 'value' => '2rem' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.search-form .search-field',
array(
array( 'property' => 'font-size', 'value' => '20px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.comment-reply-title,
.comments-title,
.no-comments',
array(
array( 'property' => 'font-size', 'value' => '2.4rem' ),
array( 'property' => 'font-weight', 'value' => 'bold' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-body',
array(
array( 'property' => 'font-size', 'value' => '2.0rem' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-meta',
array(
array( 'property' => 'font-size', 'value' => '1.7rem' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.comment-reply-link',
array(
array( 'property' => 'font-size', 'value' => '1.7rem' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'headings',
'.widget,
.widget .widget-title',
array(
array( 'property' => 'font-size', 'value' => '20px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
TypekitTheme::add_font_category_rule( $category_rules, 'body-text',
'.site-footer .site-info',
array(
array( 'property' => 'font-size', 'value' => '17px' ),
),
array(
'screen and ( min-width: 658px )',
)
);
return $category_rules;
} );

122
photos/inc/jetpack.php Normal file
View file

@ -0,0 +1,122 @@
<?php
/**
* Jetpack Compatibility File
*
* @link https://jetpack.com/
*
* @package photos
*/
/**
* Jetpack setup function.
*
* See: https://jetpack.com/support/infinite-scroll/
* See: https://jetpack.com/support/responsive-videos/
* See: https://jetpack.com/support/content-options/
*/
function photos_jetpack_setup() {
// Add theme support for Infinite Scroll.
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'footer' => 'page',
'footer_widgets' => array(
'sidebar-1',
'sidebar-2',
'sidebar-3' ),
'posts_per_page' => 12,
'render' => 'photos_infinite_scroll_render',
'type' => 'scroll',
'wrapper' => false,
) );
// Add theme support for Responsive Videos.
add_theme_support( 'jetpack-responsive-videos' );
// Add theme support for Content Options.
add_theme_support( 'jetpack-content-options', array(
'post-details' => array(
'stylesheet' => 'photos-style',
'date' => '.posted-on',
'categories' => '.cat-links',
'tags' => '.tags-links',
'author' => '.byline',
),
'featured-images' => array(
'archive' => true,
'post' => true,
'post-default' => false,
'page' => true,
'page-default' => false,
'fallback' => true,
),
) );
// Social Menu
add_theme_support( 'jetpack-social-menu', 'svg' );
}
add_action( 'after_setup_theme', 'photos_jetpack_setup' );
/**
* Custom render function for Infinite Scroll.
*/
function photos_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', 'grid' );
}
}
/**
* Social menu
*/
function photos_social_menu() {
if ( function_exists( 'jetpack_social_menu' ) ) {
jetpack_social_menu();
}
}
/**
* Custom function to check for a post thumbnail;
* If Jetpack is not available, fall back to has_post_thumbnail()
*/
function photos_has_post_thumbnail( $post = null ) {
if ( function_exists( 'jetpack_has_featured_image' ) ) {
return jetpack_has_featured_image( $post );
} else {
return has_post_thumbnail( $post );
}
}
/**
*
*/
function photos_relatedposts_filter_thumbnail_size() {
$size = array(
'width' => 320,
'height' => 320
);
return $size;
}
add_filter( 'jetpack_relatedposts_filter_thumbnail_size', 'photos_relatedposts_filter_thumbnail_size' );
/**
* Removing related posts from default spot below the post content
*/
function photos_remove_related_posts() {
if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
remove_filter( 'the_content', $callback, 40 );
}
}
// add_filter( 'wp', 'photos_remove_related_posts', 20 );
/**
* This function is used to add related posts where we want them
*/
function photos_related_posts() {
if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
echo do_shortcode( '[jetpack-related-posts]' );
}
}

128
photos/inc/logo-resizer.php Normal file
View file

@ -0,0 +1,128 @@
<?php
/**
* Add Logo Size option in the customizer.
*/
function photos_logo_resizer_customize_register( $wp_customize ) {
// Logo Resizer additions
$wp_customize->add_setting( 'logo_size', array(
'default' => 50,
'type' => 'theme_mod',
'theme_supports' => 'custom-logo',
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
'sanitize_js_callback' => 'absint',
) );
$wp_customize->add_control( 'logo_size', array(
'label' => esc_html__( 'Logo Size', 'photos' ),
'section' => 'title_tagline',
'priority' => 9,
'type' => 'range',
'settings' => 'logo_size',
'input_attrs' => array(
'step' => 5,
'min' => 0,
'max' => 100,
'aria-valuemin' => 0,
'aria-valuemax' => 100,
'aria-valuenow' => 50,
'aria-orientation' => 'horizontal',
),
) );
}
add_action( 'customize_register', 'photos_logo_resizer_customize_register' );
/**
* Add support for logo resizing by filtering `get_custom_logo`.
*/
function photos_customize_logo_resize( $html ) {
$size = get_theme_mod( 'logo_size' );
$custom_logo_id = get_theme_mod( 'custom_logo' );
// set the short side minimum
$min = 48;
// don't use empty() because we can still use a 0
if ( is_numeric( $size ) && is_numeric( $custom_logo_id ) ) {
// we're looking for $img['width'] and $img['height'] of original image
$logo = wp_get_attachment_metadata( $custom_logo_id );
if ( ! $logo ) return $html;
// get the logo support size
$sizes = get_theme_support( 'custom-logo' );
// Check for max height and width, default to image sizes if none set in theme
$max['height'] = isset( $sizes[0]['height'] ) ? $sizes[0]['height'] : $logo['height'];
$max['width'] = isset( $sizes[0]['width'] ) ? $sizes[0]['width'] : $logo['width'];
// landscape or square
if ( $logo['width'] >= $logo['height'] ) {
$output = photos_logo_resize_min_max( $logo['height'], $logo['width'], $max['height'], $max['width'], $size, $min );
$img = array(
'height' => $output['short'],
'width' => $output['long']
);
// portrait
} else if ( $logo['width'] < $logo['height'] ) {
$output = photos_logo_resize_min_max( $logo['width'], $logo['height'], $max['width'], $max['height'], $size, $min );
$img = array(
'height' => $output['long'],
'width' => $output['short']
);
}
// add the CSS
$css = '
<style>
.custom-logo {
height: ' . $img['height'] . 'px;
max-height: ' . $max['height'] . 'px;
max-width: ' . $max['width'] . 'px;
width: ' . $img['width'] . 'px;
}
</style>';
$html = $css . $html;
}
return $html;
}
add_filter( 'get_custom_logo', 'photos_customize_logo_resize' );
/* Helper function to determine the max size of the logo */
function photos_logo_resize_min_max( $short, $long, $short_max, $long_max, $percent, $min ){
$ratio = ( $long / $short );
$max['long'] = ( $long_max >= $long ) ? $long : $long_max;
$max['short'] = ( $short_max >= ( $max['long'] / $ratio ) ) ? floor( $max['long'] / $ratio ) : $short_max;
$ppp = ( $max['short'] - $min ) / 100;
$size['short'] = round( $min + ( $percent * $ppp ) );
$size['long'] = round( $size['short'] / ( $short / $long ) );
return $size;
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function photos_logo_resizer_customize_preview_js() {
wp_enqueue_script( 'photo-blog-logo-resizer-customizer', get_template_directory_uri() . '/js/logo/customize-preview.js', array( 'jquery', 'customize-preview' ), '20180724', true );
}
add_action( 'customize_preview_init', 'photos_logo_resizer_customize_preview_js' );
/**
* JS handlers for Customizer Controls
*/
function photos_logo_resizer_customize_controls_js() {
wp_enqueue_script( 'photo-blog-logo-resizer-customizer-controls', get_template_directory_uri() . '/js/logo/customize-controls.js', array( 'jquery', 'customize-controls' ), '20180724', true );
}
add_action( 'customize_controls_enqueue_scripts', 'photos_logo_resizer_customize_controls_js' );
/**
* Adds CSS to the Customizer controls.
*/
function photos_logo_resizer_customize_css() {
wp_add_inline_style( 'customize-controls', '#customize-control-logo_size input[type="range"] { width: 100%; }' );
}
add_action( 'customize_controls_enqueue_scripts', 'photos_logo_resizer_customize_css' );

View file

@ -0,0 +1,42 @@
<?php
/**
* Functions which enhance the theme by hooking into WordPress
*
* @package photos
*/
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function photos_body_classes( $classes ) {
// Adds a class of hfeed to non-singular pages.
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
return $classes;
}
add_filter( 'body_class', 'photos_body_classes' );
/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function photos_pingback_header() {
if ( is_singular() && pings_open() ) {
echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
}
}
add_action( 'wp_head', 'photos_pingback_header' );
/**
* Filtering the comment reply link arguments so we can add an svg icon
*/
function photos_comment_reply_link_args( $args, $comment, $post ) {
$args['reply_text'] = photos_get_svg( array( 'icon' => 'reply' ) ) . ' ' . $args['reply_text'];
return $args;
}
add_filter( 'comment_reply_link_args', 'photos_comment_reply_link_args', 10, 3 );

View file

@ -0,0 +1,203 @@
<?php
/**
* Custom template tags for this theme
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package photos
*/
if ( ! function_exists( 'photos_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time.
*/
function photos_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
echo '<span class="posted-on"><span class="screen-reader-text">' . esc_html_x( 'Posted on', 'post date', 'photos' ) . '</span> <a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a></span>'; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'photos_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function photos_posted_by() {
$byline = sprintf(
/* translators: %s: post author. */
esc_html_x( 'By %s', 'post author', 'photos' ),
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
);
echo '<span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'photos_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function photos_entry_footer() {
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'photos' ) );
if ( $categories_list ) {
/* translators: 1: list of categories. */
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'photos' ) . '</span>', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'photos' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'photos' ) . '</span>', $tags_list ); // WPCS: XSS OK.
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '<span class="comments-link">';
comments_popup_link(
sprintf(
wp_kses(
/* translators: %s: post title */
__( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'photos' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
)
);
echo '</span>';
}
}
endif;
if ( ! function_exists( 'photos_editor_link' ) ) :
/**
* This just outputs the edit link, just removed from photos_entry_footer()
* which is where it lives in Underscores.
*/
function photos_editor_link() {
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'photos' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
}
endif;
if ( ! function_exists( 'photos_post_thumbnail' ) ) :
/**
* Displays an post thumbnail (if one is set), otherwise displays a blank red square.
*
* Wraps the post thumbnail in an anchor element on index views, or a div element when on single views.
*/
function photos_post_thumbnail() {
$post_id = get_the_id();
$image = '';
if ( photos_has_post_thumbnail( $post_id ) || is_single() ) {
// thumbnail default is 640x640
$image = get_the_post_thumbnail( $post_id, 'photos-grid-thumb' );
}
$class = ( empty( $image ) ) ? "post-no-thumbnail" : "post-thumbnail";
$icon = photos_post_icon();
if ( is_singular() ) :
$image = get_the_post_thumbnail( $post_id, 'photos-featured' );
if ( ! empty( $image ) ) : ?>
<div class="<?php esc_html_e( $class ); ?>">
<?php echo $image; // WPCS: XSS OK. ?>
</div><!-- .post-thumbnail -->
<?php endif;
elseif ( post_password_required() || is_attachment() ) : ?>
<a class="<?php esc_html_e( $class ); ?>" href="<?php the_permalink(); ?>">
<?php echo $icon . $image; // WPCS: XSS OK. ?>
<span class="screen-reader-text"><?php the_title(); ?></span>
</a>
<?php
else : ?>
<a class="<?php esc_html_e( $class ); ?>" href="<?php the_permalink(); ?>">
<?php echo $icon . $image; // WPCS: XSS OK. ?>
<span class="screen-reader-text"><?php the_title(); ?></span>
</a>
<?php
endif;
}
endif;
if ( ! function_exists( 'photos_post_navigation' ) ) :
/**
* Displays an the post navigation with an SVG arrow and post title + thumbnail (if one is set)
*/
function photos_post_navigation() {
$navigation = '';
$previous = '';
$next = '';
if ( get_previous_post() ) {
$prev_post = get_previous_post();
// $prev_thumbnail = get_the_post_thumbnail( $prev_post->ID );
$prev_thumbnail = '';
$prev_arrow = '<div class="previous arrow">' . get_previous_post_link( '%link', photos_get_svg( array( 'icon' => 'previous', 'title' => __( 'Previous Post', 'photos' ) ) ) ) . '</div>';
$previous = '<div class="nav-previous">' . $prev_arrow . $prev_thumbnail . '<span class="nav-meta">' . esc_html__( 'Previous Post', 'photos' ) . '</span>' . get_previous_post_link( '%link', '%title' ) . '</div>';
}
if ( get_next_post( ) ) {
$next_post = get_next_post();
// $next_thumbnail = ( ! empty( $next_post ) ) ? get_the_post_thumbnail( $next_post->ID ) : '';
$next_thumbnail = '';
$next_arrow = '<div class="next arrow">' . get_next_post_link( '%link', photos_get_svg( array( 'icon' => 'next', 'title' => __( 'Next Post', 'photos' ) ) ) ) . '</div>';
$next = '<div class="nav-next">' . $next_arrow . $next_thumbnail . '<span class="nav-meta">' . esc_html__( 'Next Post', 'photos' ) . '</span>' . get_next_post_link( '%link', '%title' ) . '</div>';
}
// Only add markup if there's somewhere to navigate to.
if ( $previous || $next ) {
$navigation = '
<nav class="navigation post-navigation" role="navigation">
<h2 class="screen-reader-text">' . esc_html__( 'Post navigation', 'photos' ) . '</h2>
<div class="nav-links">' . $previous . $next . '</div>
</nav>';
}
echo $navigation; // WPCS: XSS OK.
}
endif;

219
photos/inc/wpcom-colors.php Normal file
View file

@ -0,0 +1,219 @@
<?php
/* Custom Colors: Photos */
//#fff White content background color
add_color_rule( 'bg', '#fff', array(
//No contrast
array( 'body', 'background-color' ), //body background
array( '.infinite-container', 'background-color' ), //infinite footer background
) );
//Red main accent, used for links, headings, and buttons
add_color_rule( 'link', '#d63031', array(
//No contrast
array( 'mark,
ins,
.nav-links .arrow a:hover,
.widget_blog_subscription input[type="submit"]:active,
.widget_blog_subscription input[type="submit"]:focus,
.widget_blog_subscription input[type="submit"]:hover,
.milestone-widget .milestone-header,
.site-main .post-no-thumbnail,
div#jp-relatedposts div.jp-relatedposts-post-nothumbs a.jp-relatedposts-post-a,
.comment-reply-link:focus,
.comment-reply-link:hover,
.comment-form .submit:focus,
.comment-form .submit:hover,
.bypostauthor > .comment-body .fn,
#infinite-handle span button:focus,
#infinite-handle span button:hover', 'background-color' ),
array( 'blockquote', 'border-color' ),
//Needs contrast against bg (content background color)
array( 'a,
a:visited,
.required,
.nav-links a:hover,
.nav-links a:active,
.screen-reader-text:focus,
.widget_blog_subscription input[type="submit"],
.comment-reply-link,
.comment-form .submit,
.main-navigation .menu-toggle span', 'color', 'bg'),
//Needs contrast against #fff (white header background color)
array( '.main-navigation a,
.main-navigation .menu-toggle span', 'color', '#fff'),
//Needs contrast against #f0f0f0 (grey content background color)
array( '#infinite-handle span button', 'color', '#f0f0f0' ),
//Needs contrast against #fff (white header background color)
array( '.main-navigation .icon,
.main-navigation .menu-toggle .icon', 'fill', '#fff' ),
//Needs contrast against bg (content background color)
array( '.site-main .post-no-thumbnail:focus,
.site-main .post-no-thumbnail:hover', 'background-color', '-1' ),
//Needs contrast against #f0f0f0 (grey content background color)
array( '.main-navigation .menu-toggle:hover .icon, .nav-links .icon, .comment-reply-link .icon', 'fill', '#f0f0f0' ),
),
__( 'Links and Buttons' ) );
add_color_rule( 'extra', '#ffffff', array(
//Contrast against red background (txt)
array( '.nav-links a:hover .icon', 'fill', 'link' ),
) );
add_color_rule( 'fg1', '#606060', array(
//Contrast against #fff (white content background color)
array( 'button:active,
button:focus,
input[type="button"]:active,
input[type="button"]:focus,
input[type="reset"]:active,
input[type="reset"]:focus,
input[type="submit"]:active,
input[type="submit"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="range"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="time"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="color"]:focus,
textarea:focus', 'border-color' ),
//Needs contrast against bg
array( '.nav-links .nav-meta,
.entry-footer,
.entry-footer span a,
.page-links,
.comment-meta,
.comment-meta a,
.comment-body .comment-edit-link,
.wp-caption-text,
.gallery-caption', 'color', 'bg' ),
//Needs contrast against #fff (white header background color)
array( '.site-footer .container,
.site-footer a,
.site-description', 'color', '#fff' ),
//Needs contrast against #f0f0f0 (grey background color)
array( '.search-form .search-submit .icon', 'fill', '#f0f0f0' ),
) );
add_color_rule( 'fg2', '#dcdcdc', array(
//Contrast against bg (content background color)
array( 'table,
th,
td,
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="range"],
input[type="date"],
input[type="month"],
input[type="week"],
input[type="time"],
input[type="datetime"],
input[type="datetime-local"],
input[type="color"],
textarea,
select,
.main-navigation .menu-toggle,
.nav-links .current,
.page-links,
.entry-footer,
.comments-area,
.nav-links,
.widget-area,
.search-form .search-field', 'border-color', 'bg', 5 ),
//Contrast against bg (content background color)
array( '.widget ul, .widget li', 'border-color', 'bg', 1 ),
) );
add_color_rule( 'txt', '#111', array(
//Contrast against bg (content background color)
array( 'h1,
h2,
h3,
h4,
h5,
h6,
body,
.entry-title,
.page-title,
.nav-links a,
a:hover,
a:focus,
a:active,
.main-navigation .current_page_item > a,
.main-navigation .current-menu-item > a,
.main-navigation .current-menu-parent > a', 'color', 'bg' ),
//Contrast against #fff (white background color)
array( '.site-title a,
.main-navigation a:hover,
.main-navigation a:focus,
.main-navigation a:active,
button,
input,
select,
optgroup,
textarea,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="range"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="time"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="color"]:focus,
textarea:focus', 'color', '#fff' ),
array( '.main-navigation .current_page_item > a .icon,
.main-navigation .current-menu-item > a .icon,
.main-navigation .current-menu-parent > a .icon', 'fill', 'bg' ),
array( 'blockquote *', 'color', '#f0f0f0' ),
),
__( 'Headings' ) );

55
photos/index.php Normal file
View file

@ -0,0 +1,55 @@
<?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://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-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/content', 'grid' );
endwhile;
the_posts_navigation( array(
'prev_text' => photos_get_svg( array( 'icon' => 'previous', 'title' => esc_html__( 'Older Posts', 'photos' ) ) ),
'next_text' => photos_get_svg( array( 'icon' => 'next', 'title' => esc_html__( 'Newer Posts', 'photos' ) ) ),
) );
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();

42
photos/js/customizer.js Normal file
View file

@ -0,0 +1,42 @@
/**
* File customizer.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
( function( $ ) {
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );
// Header text color.
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'position': 'relative'
} );
$( '.site-title a, .site-description' ).css( {
'color': to
} );
}
} );
} );
} )( jQuery );

31
photos/js/global.js Normal file
View file

@ -0,0 +1,31 @@
( function( $ ) {
var body, header, content, hero, adminBar, adminHeight = 0, headerHeight = 0, extraSpacing = 0, resizeTimer;
function contentPadding() {
if ( window.innerWidth >= 768 ) {
content.css( 'padding-top', header.outerHeight() );
} else {
content.css( 'padding-top', '' );
}
}
$( document ).ready( function() {
body = $( document.body );
header = $( '#masthead' );
content = $( '#content' );
adminBar = $( '#wpadminbar' );
$( window )
.on( 'load', function() {
contentPadding();
} )
.on( 'resize', function() {
clearTimeout( resizeTimer );
resizeTimer = setTimeout( function() {
contentPadding();
}, 500 );
} );
} );
} )( jQuery );

View file

@ -0,0 +1,34 @@
/**
* File customize-controls.js.
*
* Brings logo resizing technology to the Customizer.
*
* Contains handlers to change Customizer controls.
*/
( function( $ ) {
'use strict';
var api = wp.customize;
api.bind( 'ready', function() {
$( window ).load( function() {
if ( false == api.control( 'custom_logo' ).setting() ) {
$( '#customize-control-logo_size' ).hide();
}
} );
} );
// Check logo changes
api( 'custom_logo', function( value ) {
value.bind ( function ( to ) {
if ( '' === to ) {
api.control( 'logo_size' ).deactivate();
} else {
$( '#customize-control-logo_size' ).show();
api.control( 'logo_size' ).activate();
api.control( 'logo_size' ).setting( 50 );
api.control( 'logo_size' ).setting.preview();
}
} );
} );
} )( jQuery );

View file

@ -0,0 +1,155 @@
/**
* File customize-preview.js.
*
* Brings logo resizing technology to the Customizer.
*
* Contains handlers to make Customizer preview changes asynchronously.
*/
( function( $ ) {
var api = wp.customize;
var Logo = new photoBlogLogo();
var initial = null;
var resizeTimer;
api( 'custom_logo', function( value ) {
handleLogoDetection( value() );
value.bind( handleLogoDetection );
} );
api( 'logo_size', function( value ) {
Logo.resize( value() );
value.bind( Logo.resize );
} );
api( 'ready', function() {
initial = api( 'custom_logo' )._value;
} );
function handleLogoDetection( to, initial ) {
if ( '' === to ) {
Logo.remove();
} else if ( undefined === initial ) {
Logo.add();
} else {
Logo.change();
}
initial = to;
}
function photoBlogLogo() {
var intId = 0;
var hasLogo = null;
var min = 48;
var self = {
resize: function( to ) {
if ( hasLogo ) {
var img = new Image();
var logo = $( '.custom-logo' );
var size = {
width: parseInt( logo.attr( 'width' ), 10 ),
height: parseInt( logo.attr( 'height' ), 10 ),
}
var cssMax = {
width: parseInt( logo.css( 'max-width' ), 10 ),
height: parseInt( logo.css( 'max-height' ), 10 ),
}
var max = new Object();
max.width = $.isNumeric( cssMax.width ) ? cssMax.width : size.width;
max.height = $.isNumeric( cssMax.height ) ? cssMax.height : size.height;
img.onload = function() {
var output = new Object();
if ( size.width >= size.height ) {
// landscape or square, calculate height as short side
output = logo_min_max( size.height, size.width, max.height, max.width, to, min );
size = {
height: output.a,
width: output.b,
}
} else if ( size.width < size.height ){
// portrait, calculate height as long side
output = logo_min_max( size.width, size.height, max.width, max.height, to, min );
size = {
height: output.b,
width: output.a,
}
}
logo.css( {
width: size.width,
height: size.height,
} );
}
img.src = logo.attr( 'src' );
clearTimeout( resizeTimer );
resizeTimer = setTimeout( function() {
$( document.body ).resize();
}, 500 );
}
},
add: function() {
intID = setInterval( function() {
var logo = $( '.custom-logo[src]' );
if ( logo.length ) {
clearInterval( intID );
hasLogo = true;
}
}, 500 );
},
change: function() {
var oldlogo = $( '.custom-logo' ).attr( 'src' );
intID = setInterval( function() {
var logo = $( '.custom-logo' ).attr( 'src' );
if ( logo != oldlogo ) {
clearInterval( intID );
hasLogo = true;
self.resize( 50 );
}
}, 100 );
},
remove: function() {
hasLogo = null;
}
}
return self;
}
// a is short side, b is long side
// x is short css max, y is long css max
// p is percent, m is minimum short side
function logo_min_max( a, b, amax, bmax, p, m ){
var ppp,
ratio,
max = new Object(),
size = new Object();
ratio = ( b / a );
max.b = ( bmax >= b ) ? b : bmax;
max.a = ( amax >= ( max.b / ratio ) ) ? Math.floor( max.b / ratio ) : amax;
// number of pixels per percentage point
ppp = ( max.a - m ) / 100;
// at 0%, the minimum is set, scale up from there
size.a = Math.floor( m + ( p * ppp ) );
// long side is calculated from the image ratio
size.b = Math.floor( size.a * ratio );
return size;
}
} )( jQuery );

152
photos/js/navigation.js Normal file
View file

@ -0,0 +1,152 @@
/* global photosScreenReaderText */
( function( $ ) {
var body, header, menuToggle, siteNavContain, siteNavigation, siteBranding, resizeTimer;
header = $( '#masthead' );
menuToggle = header.find( '.menu-toggle' );
siteNavigation = header.find( '.main-navigation' );
siteBranding = header.find( '.site-branding' );
// Enable menuToggle.
( function() {
// Return early if menuToggle is missing.
if ( ! menuToggle.length ) {
return;
}
// Add an initial value for the attribute.
menuToggle.attr( 'aria-expanded', 'false' );
menuToggle.on( 'click', function() {
$( this ).toggleClass( 'toggled-on' );
header.toggleClass( 'overlay' );
siteNavigation.toggleClass( 'toggled-on' );
$( this ).attr( 'aria-expanded', siteNavigation.hasClass( 'toggled-on' ) );
} );
} )();
// Checks if the action bar is visible at the bottom of the screen
checkactionbar = function() {
if ( 'none' == menuToggle.css( 'display' ) ) return;
if ( $( '#actionbar' ).length ){
if ( ! $( '#actionbar' ).hasClass( 'actnbr-hidden' ) ) {
menuToggle.addClass( 'actnbr-visible' );
} else {
menuToggle.removeClass( 'actnbr-visible' );
}
}
};
setInterval( checkactionbar, 200 );
// Fix sub-menus for touch devices and better focus for hidden submenu items for accessibility.
( function() {
if ( ! siteNavigation.length || ! siteNavigation.children().length ) {
return;
}
// Toggle `focus` class to allow submenu access on tablets.
function toggleFocusClassTouchScreen() {
if ( 'none' === $( '.menu-toggle' ).css( 'display' ) ) {
$( document.body ).on( 'touchstart', function( e ) {
if ( ! $( e.target ).closest( '.main-navigation li' ).length ) {
$( '.main-navigation li' ).removeClass( 'focus' );
}
} );
siteNavigation.find( '.menu-item-has-children > a, .page_item_has_children > a, .menu-item.site-header-cart > a' )
.on( 'touchstart', function( e ) {
var el = $( this ).parent( 'li' );
if ( ! el.hasClass( 'focus' ) ) {
e.preventDefault();
el.toggleClass( 'focus' );
el.siblings( '.focus' ).removeClass( 'focus' );
}
} );
} else {
siteNavigation.find( '.menu-item-has-children > a, .page_item_has_children > a, .menu-item.site-header-cart > a' ).unbind( 'touchstart' );
}
}
if ( 'ontouchstart' in window ) {
$( window ).on( 'resize', toggleFocusClassTouchScreen );
toggleFocusClassTouchScreen();
}
siteNavigation.find( 'a' ).on( 'focus blur', function() {
$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
} );
} )();
// Initiate navigation.
function initMainNavigation( container ) {
// Add dropdown toggle that displays child menu items.
var dropdownToggle = $( '<button />', { 'class': 'dropdown-toggle', 'aria-expanded': false })
.append( photosScreenReaderText.icon )
.append( $( '<span />', { 'class': 'screen-reader-text', text: photosScreenReaderText.expand } ) );
container.find( '.menu-item-has-children > a, .page_item_has_children > a' ).after( dropdownToggle );
// Set the active submenu dropdown toggle button initial state.
container.find( '.current-menu-ancestor > button' )
.addClass( 'toggled-on' )
.attr( 'aria-expanded', 'true' )
.find( '.screen-reader-text' )
.text( photosScreenReaderText.collapse );
// Set the active submenu initial state.
container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );
container.find( '.dropdown-toggle' ).click( function( e ) {
var _this = $( this ),
screenReaderSpan = _this.find( '.screen-reader-text' );
e.preventDefault();
_this.toggleClass( 'toggled-on' );
_this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' );
_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
screenReaderSpan.text( screenReaderSpan.text() === photosScreenReaderText.expand ? photosScreenReaderText.collapse : photosScreenReaderText.expand );
} );
}
// Change dropdown direction depending on the width.
function dropdownDirection() {
var innerHeader = siteNavigation.outerWidth() + siteBranding.outerWidth();
if ( innerHeader <= header.width() ) {
body.addClass( 'menu-direction-left' );
} else {
body.removeClass( 'menu-direction-left' );
}
}
$( document ).ready( function() {
body = $( document.body );
$( window )
.on( 'load', function() {
initMainNavigation( $( '.main-navigation' ) );
dropdownDirection();
} )
.on( 'resize', function() {
clearTimeout( resizeTimer );
resizeTimer = setTimeout( function() {
dropdownDirection();
}, 500 );
} );
} );
$( document ).on( 'customize-preview-menu-refreshed', function( e, params ) {
if ( 'menu-1' === params.wpNavMenuArgs.theme_location ) {
$( document.body ).resize();
}
} );
} )( jQuery );

View file

@ -0,0 +1,31 @@
/**
* File skip-link-focus-fix.js.
*
* Helps with accessibility for keyboard only users.
*
* Learn more: https://git.io/vWdr2
*/
( function() {
var isIe = /(trident|msie)/i.test( navigator.userAgent );
if ( isIe && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() {
var id = location.hash.substring( 1 ),
element;
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
return;
}
element = document.getElementById( id );
if ( element ) {
if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
element.tabIndex = -1;
}
element.focus();
}
}, false );
}
} )();

View file

@ -0,0 +1,7 @@
Place your theme language files in this directory.
Please visit the following links to learn more about translating WordPress themes:
https://make.wordpress.org/polyglots/teams/
https://developer.wordpress.org/themes/functionality/localization/
https://developer.wordpress.org/reference/functions/load_theme_textdomain/

40
photos/page.php Normal file
View file

@ -0,0 +1,40 @@
<?php
/**
* The template for displaying all pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site may use a
* different template.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();

48
photos/readme.txt Normal file
View file

@ -0,0 +1,48 @@
=== Photos ===
Contributors: automattic
Requires at least: 4.6
Tested up to: 4.9.8
Stable tag: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: custom-background, custom-header, custom-logo, custom-menu, featured-images, footer-widgets, grid-layout, sticky-post, threaded-comments, translation-ready, blog, photography
== Description ==
Photos is a single-column blogging theme that showcases your photos in a grid format.
== Installation ==
1. In your admin panel, go to Appearance > Themes and click the Add New button.
2. Click Upload Theme and Choose File, then select the theme's .zip file. Click Install Now.
3. Click Activate to use your new theme right away.
== Credits ==
* Based on Underscores http://underscores.me/, (C) 2012-2018 Automattic, Inc., [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html)
* normalize.css http://necolas.github.io/normalize.css/, (C) 2012-2018 Nicolas Gallagher and Jonathan Neal, [MIT](http://opensource.org/licenses/MIT)
* Images by Pexels, [CC0](https://www.pexels.com/creative-commons-images/)
** https://www.pexels.com/photo/bay-beach-blue-cliff-373409/
** https://www.pexels.com/photo/bay-beach-daylight-high-angle-shot-274060/
** https://www.pexels.com/photo/panoramic-view-of-sea-against-blue-sky-248771/
** https://www.pexels.com/photo/rear-view-of-man-on-mountain-road-against-sky-258045/
** https://www.pexels.com/photo/architecture-booth-buildings-bus-374815/
** https://www.pexels.com/photo/hallway-between-tree-at-daytime-163585/
** https://www.pexels.com/photo/agriculture-beautiful-countryside-cropland-461818/
** https://www.pexels.com/photo/agriculture-asia-cat-china-235648/
** https://www.pexels.com/photo/adventure-beautiful-boardwalk-bridge-235734/
** https://www.pexels.com/photo/clouds-flight-flying-plane-6881/
** https://www.pexels.com/photo/cafe-camera-classic-close-up-413960/
** https://www.pexels.com/photo/pink-teal-yellow-multi-color-please-leave-nothing-but-your-feet-road-signage-164287/
== Changelog ==
= 1.0 - Sep 13 2018 =
* Initial release
== Credits ==
* Based on Underscores https://underscores.me/, (C) 2012-2017 Automattic, Inc., [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html)
* normalize.css https://necolas.github.io/normalize.css/, (C) 2012-2016 Nicolas Gallagher and Jonathan Neal, [MIT](https://opensource.org/licenses/MIT)

305
photos/rtl.css Normal file
View file

@ -0,0 +1,305 @@
/*
Theme Name: photos
*/
body {
direction: rtl;
unicode-bidi: embed;
}
blockquote {
border-left: none;
border-right: 4px solid #d63031;
}
ul, ol {
padding-left: 0;
padding-right: 1em;
}
li > ul,
li > ol {
margin-left: 0;
margin-right: 1.5em;
}
/*--------------------------------------------------------------
## Menus
--------------------------------------------------------------*/
.main-navigation {
left: 0;
right: auto;
}
.main-navigation ul {
padding-right: 0;
}
.main-navigation .menu-item-has-children a {
margin-left: 36px;
margin-right: 0;
}
.main-navigation .dropdown-toggle {
float: left;
}
.main-navigation .menu-toggle {
left: 12px;
right: auto;
}
.main-navigation .sub-menu.toggled-on {
margin-left: 0;
margin-right: 1em;
}
.site-header.overlay:after {
left: auto;
right: 0;
}
.comment-navigation .nav-previous,
.posts-navigation .nav-previous,
.post-navigation .nav-previous {
float: right;
text-align: right;
}
.comment-navigation .nav-next,
.posts-navigation .nav-next,
.post-navigation .nav-next {
float: left;
text-align: left;
}
.screen-reader-text:focus {
left: auto;
right: 5px;
}
/*--------------------------------------------------------------
# Alignments
--------------------------------------------------------------*/
.alignleft {
float: right;
margin-right: 0;
margin-left: 1.5em;
}
.page-content > .alignleft,
.entry-content > .alignleft,
.entry-summary > .alignleft {
margin-left: 1.5em;
margin-right: 0;
}
.alignright {
float: left;
margin-left: 0;
margin-right: 1.5em;
}
.page-content > .alignright,
.entry-content > .alignright,
.entry-summary > .alignright {
margin-left: 0;
margin-right: 1.5em;
}
.widget ul {
padding-right: 0;
}
.widget_goodreads a > img {
float: right;
margin: 0 0 1em 1em;
}
.widget_authors ul ul {
margin-right: 0;
}
.site-main article .container .icon {
left: 10px;
right: auto;
}
.search-form .search-submit {
left: 0;
right: auto;
}
.comment-list {
margin-right: 0;
padding-right: 0;
}
.comment-author .avatar {
float: right;
margin: 0 0 0 10px;
}
.comment-body .edit-link {
margin-left: auto;
margin-right: 0.5em;
}
.comment-reply-link {
padding: 0.3rem 0.6rem 0.5rem 1rem;
}
.comment-form input[type=checkbox] {
margin-left: 0.375em;
margin-right: 0;
}
#infinite-handle span {
border: none;
}
#infinite-handle span::before {
display: none;
}
/*--------------------------------------------------------------
# Media Queries
--------------------------------------------------------------*/
/* Wide mobile screens ( > 640px ) */
@media screen and ( min-width: 658px ) {
.site-logo,
.site-title {
text-align: right;
}
.main-navigation .menu-toggle span {
padding-left: 0;
padding-right: 0.25em;
}
}
/* Tablet styles ( > 768px ) */
@media screen and ( min-width: 768px ) {
.alignleft {
margin-right: 0;
}
.alignright {
margin-left: 0;
}
.comment-list ol.children {
margin-right: 2.5em;
}
}
/* Small desktop screens ( > 1080px ) */
@media screen and ( min-width: 1080px ) {
.site-branding {
margin-left: auto;
margin-right: 0;
padding-left: 2em;
padding-right: 0;
}
.site-title {
padding: 0 0 0 0.25em;
}
.main-navigation .menu-item-has-children a {
margin-left: 0;
}
.main-navigation .menu {
padding-right: 0;
}
.main-navigation .menu > li,
.main-navigation .menu > ul li {
margin: 0 0 0 1.8rem;
}
.main-navigation .menu > li:last-child,
.main-navigation .menu > ul li:last-child {
margin-left: 0;
}
.main-navigation a .icon {
margin: 0 2px -3px 0;
}
.main-navigation ul ul {
left: auto;
right: -9999em;
text-align: right;
}
.main-navigation ul li.focus > ul,
.main-navigation ul li:hover > ul,
.main-navigation ul li:hover > ul.toggled-on {
right: auto;
}
.main-navigation ul ul ul {
left: auto;
right: 0;
padding-right: 0.625em;
text-align: right;
}
.page-content > .alignleft,
.entry-content > .alignleft,
.entry-summary > .alignleft {
margin-left: auto;
margin-right: calc( 50vw - 517px );
}
.page-content > .alignright,
.entry-content > .alignright,
.entry-summary > .alignright {
margin-left: calc( 50vw - 517px );
margin-right: auto;
}
.alignleft {
margin-left: auto;
margin-right: -190px;
}
.alignright {
margin-left: -190px;
margin-right: auto;
}
.site-footer .container {
text-align: right;
}
.site-footer .site-info {
text-align: left;
}
}
/* Larger desktop screens */
@media screen and ( min-width: 75em ) {
.post-navigation .previous {
left: auto;
right: calc( 50vw - 595px );
}
.post-navigation .next {
left: calc( 50vw - 595px );
right: auto;
}
.post-navigation .nav-links .arrow {
transform: rotate(180deg);
}
}

BIN
photos/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

58
photos/search.php Normal file
View file

@ -0,0 +1,58 @@
<?php
/**
* The template for displaying search results pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package photos
*/
get_header();
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title">
<?php
/* translators: %s: search query. */
printf( esc_html__( 'Search Results for: %s', 'photos' ), '<span>' . get_search_query() . '</span>' );
?>
</h1>
</header><!-- .page-header -->
<?php
/* Start the Loop */
while ( have_posts() ) :
the_post();
/**
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'template-parts/content', 'grid' );
endwhile;
the_posts_navigation( array(
'prev_text' => photos_get_svg( array( 'icon' => 'previous', 'title' => esc_html__( 'Older Posts', 'photos' ) ) ),
'next_text' => photos_get_svg( array( 'icon' => 'next', 'title' => esc_html__( 'Newer Posts', 'photos' ) ) ),
) );
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_sidebar();
get_footer();

16
photos/searchform.php Normal file
View file

@ -0,0 +1,16 @@
<?php
/**
* Template for displaying search forms in Photos
*/
?>
<?php $unique_id = esc_attr( uniqid( 'search-form-' ) ); ?>
<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label for="<?php echo $unique_id; // WPCS: XSS OK. ?>">
<span class="screen-reader-text"><?php echo esc_html_x( 'Search for:', 'label', 'photos' ); ?></span>
</label>
<input type="search" id="<?php echo $unique_id; // WPCS: XSS OK. ?>" class="search-field" placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'photos' ); ?>" value="<?php esc_attr_e( get_search_query() ); ?>" name="s" />
<button type="submit" class="search-submit"><?php echo photos_get_svg( array( 'icon' => 'search' ) ); // WPCS: XSS OK. ?><span class="screen-reader-text"><?php echo esc_html_x( 'Search', 'submit button', 'photos' ); ?></span></button>
</form>

25
photos/sidebar.php Normal file
View file

@ -0,0 +1,25 @@
<?php
/**
* The sidebar containing the main widget area
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package photos
*/
if (
! is_active_sidebar( 'sidebar-1' ) &&
! is_active_sidebar( 'sidebar-2' ) &&
! is_active_sidebar( 'sidebar-3' )
) {
return;
}
?>
<aside id="secondary" class="widget-area">
<div class="container">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
<?php dynamic_sidebar( 'sidebar-2' ); ?>
<?php dynamic_sidebar( 'sidebar-3' ); ?>
</div>
</aside><!-- #secondary -->

39
photos/single.php Normal file
View file

@ -0,0 +1,39 @@
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package photos
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', get_post_type() );
photos_related_posts();
photos_post_navigation();
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();

2641
photos/style.css Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
<?php
/**
* Template part for displaying grid posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="container">
<?php photos_post_thumbnail(); ?>
</div>
</article><!-- #post-<?php the_ID(); ?> -->

View file

@ -0,0 +1,51 @@
<?php
/**
* Template part for displaying a message that posts cannot be found
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
?>
<section class="no-results not-found">
<header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'photos' ); ?></h1>
</header><!-- .page-header -->
<div class="page-content">
<?php
if ( is_home() && current_user_can( 'publish_posts' ) ) :
printf(
'<p>' . wp_kses(
/* translators: 1: link to WP admin new post page. */
__( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'photos' ),
array(
'a' => array(
'href' => array(),
),
)
) . '</p>',
esc_url( admin_url( 'post-new.php' ) )
);
elseif ( is_search() ) :
?>
<p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'photos' ); ?></p>
<?php
get_search_form();
else :
?>
<p><?php esc_html_e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'photos' ); ?></p>
<?php
get_search_form();
endif;
?>
</div><!-- .page-content -->
</section><!-- .no-results -->

View file

@ -0,0 +1,54 @@
<?php
/**
* Template part for displaying page content in page.php
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php photos_post_thumbnail(); ?>
<div class="entry-content">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'photos' ),
'after' => '</div>',
'link_before' => '<span class="page-number">',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'photos' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
?>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-<?php the_ID(); ?> -->

View file

@ -0,0 +1,35 @@
<?php
/**
* Template part for displaying results in search pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<?php
photos_posted_on();
photos_posted_by();
?>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<?php photos_post_thumbnail(); ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<footer class="entry-footer">
<?php photos_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> -->

View file

@ -0,0 +1,55 @@
<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package photos
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php
if ( is_singular() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
endif;
?>
</header><!-- .entry-header -->
<?php photos_post_thumbnail(); ?>
<div class="entry-content">
<?php
the_content( sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'photos' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
) );
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'photos' ),
'after' => '</div>',
'link_before' => '<span class="page-number">',
'link_after' => '</span>',
) );
?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<?php photos_posted_on(); ?>
<?php photos_entry_footer(); ?>
<?php photos_posted_by(); ?>
<?php photos_editor_link(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> -->