initial upload
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying 404 pages (not found)
|
||||
*
|
||||
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<main id="primary" class="site-main">
|
||||
<div class="container">
|
||||
<section class="error-404 not-found">
|
||||
<h1 class="page-title"><?php esc_html_e( 'Oops! That page can’t be found.', 'zeitfresser' ); ?></h1>
|
||||
|
||||
<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?', 'zeitfresser' ); ?></p>
|
||||
|
||||
<?php
|
||||
get_search_form();
|
||||
?>
|
||||
|
||||
</div><!-- .page-content -->
|
||||
</section><!-- .error-404 -->
|
||||
</div>
|
||||
</main><!-- #main -->
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
@@ -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 daisy blog.
|
||||
|
||||
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 daisy bloging:
|
||||
|
||||
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 daisy bloging 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 daisy bloging 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.
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying archive pages
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="main-wrapper">
|
||||
<main id="primary" 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 -->
|
||||
|
||||
<div class="custom-grid-view">
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
|
||||
/*
|
||||
* Include the Post-Type-specific template for the content.
|
||||
* If you want to override this in a child theme, then include a file
|
||||
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
|
||||
*/
|
||||
get_template_part( 'template-parts/content', get_post_type() );
|
||||
|
||||
endwhile;
|
||||
?>
|
||||
</div>
|
||||
<?php zeitfresser_numeric_pagination();
|
||||
|
||||
else :
|
||||
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
endif;
|
||||
?>
|
||||
</main><!-- #main -->
|
||||
|
||||
<div class="sidebar"><?php get_sidebar();?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
@@ -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 zeitfresser
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
$daisy_blog_comment_count = get_comments_number();
|
||||
if ( '1' === $daisy_blog_comment_count ) {
|
||||
printf(
|
||||
/* translators: 1: title. */
|
||||
esc_html__( 'One thought on “%1$s”', 'zeitfresser' ),
|
||||
'<span>' . wp_kses_post( get_the_title() ) . '</span>'
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
/* translators: 1: comment count number, 2: title. */
|
||||
esc_html( _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', $daisy_blog_comment_count, 'comments title', 'zeitfresser' ) ),
|
||||
number_format_i18n( $daisy_blog_comment_count ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'<span>' . wp_kses_post( get_the_title() ) . '</span>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</h2><!-- .comments-title -->
|
||||
|
||||
<?php the_comments_navigation(); ?>
|
||||
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments(
|
||||
array(
|
||||
'style' => 'ol',
|
||||
'short_ping' => true,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</ol><!-- .comment-list -->
|
||||
|
||||
<?php
|
||||
the_comments_navigation();
|
||||
|
||||
// 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.', 'zeitfresser' ); ?></p>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
endif; // Check for have_comments().
|
||||
|
||||
comment_form();
|
||||
?>
|
||||
|
||||
</div><!-- #comments -->
|
||||
@@ -0,0 +1,7 @@
|
||||
/* Align lists in the Classic Editor */
|
||||
ul, ol {
|
||||
margin-left: 0 !important;
|
||||
padding-left: 1.0em !important;
|
||||
list-style-position: inside !important;
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the footer.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
$copyright = get_theme_mod( 'footer_copyright_text', zeitfresser_get_default_footer_copyright() );
|
||||
?>
|
||||
|
||||
<footer id="colophon" class="site-footer">
|
||||
<div class="container">
|
||||
<?php get_template_part( 'template-parts/social', 'links' ); ?>
|
||||
|
||||
<div class="site-info">
|
||||
<div class="copyright"><?php echo wp_kses_post( $copyright ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<a class="scroll-to-top" href="javascript:void(0)">
|
||||
<svg id="Layer_1" version="1.1" viewBox="0 0 64 64" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||
<g><g id="Icon-Chevron-Left" transform="translate(237.000000, 335.000000)"><polyline class="st0" id="Fill-35" points="-191.3,-296.9 -193.3,-294.9 -205,-306.6 -216.7,-294.9 -218.7,-296.9 -205,-310.6 -191.3,-296.9"/></g></g>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
+492
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
/**
|
||||
* Zeitfresser theme functions and definitions.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! defined( 'ZEITFRESSER_VERSION' ) ) {
|
||||
define( 'ZEITFRESSER_VERSION', '2.2.0' );
|
||||
}
|
||||
|
||||
if ( ! defined( 'DAISY_BLOG_VERSION' ) ) {
|
||||
define( 'DAISY_BLOG_VERSION', ZEITFRESSER_VERSION );
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/zeitfresser-helpers.php';
|
||||
require get_template_directory() . '/inc/legacy-aliases.php';
|
||||
require get_template_directory() . '/inc/performance-tools.php';
|
||||
|
||||
/**
|
||||
* Theme setup.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_setup() {
|
||||
load_theme_textdomain( 'zeitfresser', get_template_directory() . '/languages' );
|
||||
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support(
|
||||
'html5',
|
||||
array(
|
||||
'search-form',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
'style',
|
||||
'script',
|
||||
)
|
||||
);
|
||||
add_theme_support(
|
||||
'custom-background',
|
||||
apply_filters(
|
||||
'zeitfresser_custom_background_args',
|
||||
array(
|
||||
'default-image' => '',
|
||||
'default-color' => zeitfresser_get_default_background_color(),
|
||||
)
|
||||
)
|
||||
);
|
||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||
add_theme_support(
|
||||
'custom-logo',
|
||||
array(
|
||||
'height' => 250,
|
||||
'width' => 250,
|
||||
'flex-width' => true,
|
||||
'flex-height' => true,
|
||||
)
|
||||
);
|
||||
add_theme_support( 'align-wide' );
|
||||
add_theme_support( 'wp-block-styles' );
|
||||
add_theme_support( 'responsive-embeds' );
|
||||
|
||||
register_nav_menus(
|
||||
array(
|
||||
'menu-1' => esc_html__( 'Primary', 'zeitfresser' ),
|
||||
)
|
||||
);
|
||||
|
||||
add_editor_style( 'editor-style.css' );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_setup' );
|
||||
|
||||
/**
|
||||
* Set the content width in pixels.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_content_width() {
|
||||
$GLOBALS['content_width'] = apply_filters( 'zeitfresser_content_width', 640 );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_content_width', 0 );
|
||||
|
||||
/**
|
||||
* Register widget area.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_widgets_init() {
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => esc_html__( 'Sidebar', 'zeitfresser' ),
|
||||
'id' => 'sidebar-1',
|
||||
'description' => esc_html__( 'Add widgets here.', 'zeitfresser' ),
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'widgets_init', 'zeitfresser_widgets_init' );
|
||||
|
||||
/**
|
||||
* Return file version using filemtime in production-safe form.
|
||||
*
|
||||
* @param string $relative_path Relative file path inside the theme.
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_asset_version( $relative_path ) {
|
||||
$path = get_template_directory() . $relative_path;
|
||||
return file_exists( $path ) ? (string) filemtime( $path ) : ZEITFRESSER_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_scripts() {
|
||||
wp_enqueue_style(
|
||||
'zeitfresser',
|
||||
get_template_directory_uri() . '/style.css',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/style.css' )
|
||||
);
|
||||
wp_style_add_data( 'zeitfresser', 'rtl', 'replace' );
|
||||
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-navigation',
|
||||
get_template_directory_uri() . '/js/navigation.js',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/js/navigation.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_home() || is_front_page() || is_archive() || is_search() ) {
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-masonry',
|
||||
get_template_directory_uri() . '/js/masonry.pkgd.min.js',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/js/masonry.pkgd.min.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-scripts',
|
||||
get_template_directory_uri() . '/js/scripts.js',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/js/scripts.js' ),
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_scripts' );
|
||||
|
||||
/**
|
||||
* Theme package marker kept for compatibility with the original premium controls.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_free_pro() {
|
||||
return 'pro';
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/custom-header.php';
|
||||
require get_template_directory() . '/inc/template-tags.php';
|
||||
require get_template_directory() . '/inc/template-functions.php';
|
||||
require get_template_directory() . '/inc/customizer.php';
|
||||
|
||||
if ( defined( 'JETPACK__VERSION' ) ) {
|
||||
require get_template_directory() . '/inc/jetpack.php';
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/blocks/blocks.php';
|
||||
require get_template_directory() . '/inc/graphthemes-widgets/graphthemes-widgets.php';
|
||||
require get_template_directory() . '/inc/pagination.php';
|
||||
|
||||
|
||||
/**
|
||||
* Remove duplicate local Google font generation to avoid unnecessary footer CSS.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_disable_duplicate_local_fonts() {
|
||||
remove_action( 'wp_loaded', 'zeitfresser_google_font_local' );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_disable_duplicate_local_fonts', 20 );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add safe front-end performance optimizations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_performance_setup() {
|
||||
// Disable the legacy embeds script on the front end. Native iframes still work.
|
||||
if ( ! is_admin() ) {
|
||||
wp_deregister_script( 'wp-embed' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_performance_setup', 100 );
|
||||
|
||||
/**
|
||||
* Remove unnecessary head output for a leaner front end.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_cleanup_wp_head() {
|
||||
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
|
||||
remove_action( 'wp_print_styles', 'print_emoji_styles' );
|
||||
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
|
||||
remove_action( 'admin_print_styles', 'print_emoji_styles' );
|
||||
remove_action( 'wp_head', 'rsd_link' );
|
||||
remove_action( 'wp_head', 'wlwmanifest_link' );
|
||||
remove_action( 'wp_head', 'wp_generator' );
|
||||
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
|
||||
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
|
||||
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
|
||||
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
|
||||
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 );
|
||||
}
|
||||
add_action( 'init', 'zeitfresser_cleanup_wp_head' );
|
||||
|
||||
/**
|
||||
* Remove front-end dashicons for visitors.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_maybe_dequeue_dashicons() {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
wp_deregister_style( 'dashicons' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_maybe_dequeue_dashicons', 100 );
|
||||
|
||||
/**
|
||||
* Add resource hints for externally loaded fonts only when needed.
|
||||
*
|
||||
* @param array $urls URLs to print for resource hints.
|
||||
* @param string $relation_type Hint relation type.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_resource_hints( $urls, $relation_type ) {
|
||||
$uses_external_fonts = false;
|
||||
|
||||
if ( function_exists( 'zeitfresser_fonts_url' ) ) {
|
||||
$uses_external_fonts = ! empty( zeitfresser_fonts_url( zeitfresser_used_google_fonts() ) ) && empty( zeitfresser_get_local_webfonts_css() );
|
||||
}
|
||||
|
||||
if ( $uses_external_fonts && 'preconnect' === $relation_type ) {
|
||||
$urls[] = 'https://fonts.googleapis.com';
|
||||
$urls[] = array(
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
'crossorigin' => 'anonymous',
|
||||
);
|
||||
}
|
||||
|
||||
return $urls;
|
||||
}
|
||||
add_filter( 'wp_resource_hints', 'zeitfresser_resource_hints', 10, 2 );
|
||||
|
||||
/**
|
||||
* Preload locally hosted webfont files once they are available.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_preload_local_webfonts() {
|
||||
if ( is_admin() || ! function_exists( 'zeitfresser_get_local_webfonts_css' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$urls = zeitfresser_get_local_webfont_urls( zeitfresser_get_local_webfonts_css() );
|
||||
|
||||
if ( empty( $urls ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$urls = array_slice( $urls, 0, 4 );
|
||||
|
||||
foreach ( $urls as $url ) {
|
||||
$type = ( '.woff2' === substr( $url, -6 ) ) ? 'font/woff2' : 'font/woff';
|
||||
printf( "<link rel='preload' href='%s' as='font' type='%s' crossorigin>
|
||||
", esc_url( $url ), esc_attr( $type ) );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_head', 'zeitfresser_preload_local_webfonts', 2 );
|
||||
|
||||
/**
|
||||
* Improve image decoding defaults without changing visual output.
|
||||
*
|
||||
* @param array $attr Image markup attributes.
|
||||
* @param WP_Post $attachment Attachment post object.
|
||||
* @param string|array $size Requested image size.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_optimize_image_attributes( $attr, $attachment, $size ) {
|
||||
if ( empty( $attr['decoding'] ) ) {
|
||||
$attr['decoding'] = 'async';
|
||||
}
|
||||
|
||||
if ( empty( $attr['loading'] ) && ! is_admin() ) {
|
||||
$attr['loading'] = 'lazy';
|
||||
}
|
||||
|
||||
return $attr;
|
||||
}
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_optimize_image_attributes', 10, 3 );
|
||||
|
||||
/**
|
||||
* Lower the threshold for WordPress scaled originals.
|
||||
*
|
||||
* This prevents very large uploads from shipping oversized source images.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function zeitfresser_big_image_size_threshold() {
|
||||
return 1800;
|
||||
}
|
||||
add_filter( 'big_image_size_threshold', 'zeitfresser_big_image_size_threshold' );
|
||||
|
||||
/**
|
||||
* Skip generating oversized core intermediate sizes we do not use.
|
||||
*
|
||||
* @param array $sizes Registered intermediate sizes.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_filter_intermediate_image_sizes( $sizes ) {
|
||||
unset( $sizes['1536x1536'], $sizes['2048x2048'] );
|
||||
|
||||
return $sizes;
|
||||
}
|
||||
add_filter( 'intermediate_image_sizes_advanced', 'zeitfresser_filter_intermediate_image_sizes' );
|
||||
|
||||
/**
|
||||
* Convert generated JPEG and PNG sub-sizes to WebP when supported by the server.
|
||||
*
|
||||
* @param array $formats Output format map.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_image_output_format( $formats ) {
|
||||
if ( function_exists( 'wp_image_editor_supports' ) && wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
|
||||
$formats['image/jpeg'] = 'image/webp';
|
||||
$formats['image/png'] = 'image/webp';
|
||||
}
|
||||
|
||||
return $formats;
|
||||
}
|
||||
add_filter( 'image_editor_output_format', 'zeitfresser_image_output_format' );
|
||||
|
||||
/**
|
||||
* Keep generated image quality balanced for file size and visual fidelity.
|
||||
*
|
||||
* @param int $quality Proposed image quality.
|
||||
* @param string $mime_type Image mime type.
|
||||
* @return int
|
||||
*/
|
||||
function zeitfresser_image_quality( $quality, $mime_type = 'image/jpeg' ) {
|
||||
if ( 'image/png' === $mime_type ) {
|
||||
return $quality;
|
||||
}
|
||||
|
||||
return 82;
|
||||
}
|
||||
add_filter( 'wp_editor_set_quality', 'zeitfresser_image_quality', 10, 2 );
|
||||
|
||||
/**
|
||||
* Improve attachment image attributes for layout stability and fetch priority.
|
||||
*
|
||||
* @param array $attr Image markup attributes.
|
||||
* @param WP_Post $attachment Attachment post object.
|
||||
* @param string|array $size Requested image size.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_improve_attachment_dimensions( $attr, $attachment, $size ) {
|
||||
if ( empty( $attr['width'] ) || empty( $attr['height'] ) ) {
|
||||
$metadata = wp_get_attachment_metadata( $attachment->ID );
|
||||
|
||||
if ( is_array( $metadata ) && ! empty( $metadata['width'] ) && ! empty( $metadata['height'] ) ) {
|
||||
if ( empty( $attr['width'] ) ) {
|
||||
$attr['width'] = (int) $metadata['width'];
|
||||
}
|
||||
|
||||
if ( empty( $attr['height'] ) ) {
|
||||
$attr['height'] = (int) $metadata['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $attr['fetchpriority'] ) && ! is_admin() && ! is_feed() ) {
|
||||
static $did_set_high_priority = false;
|
||||
|
||||
if ( ! $did_set_high_priority && ( is_home() || is_front_page() || is_archive() || is_search() || is_singular() ) ) {
|
||||
$attr['fetchpriority'] = 'high';
|
||||
$did_set_high_priority = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $attr;
|
||||
}
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_improve_attachment_dimensions', 11, 3 );
|
||||
|
||||
|
||||
/**
|
||||
* Preload the most likely LCP image for archive and singular views.
|
||||
*
|
||||
* @param array $resources Existing preload resources.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_preload_resources( $resources ) {
|
||||
if ( is_admin() || is_feed() || is_embed() ) {
|
||||
return $resources;
|
||||
}
|
||||
|
||||
$image_url = '';
|
||||
$image_type = '';
|
||||
|
||||
if ( is_singular() ) {
|
||||
$object_id = get_queried_object_id();
|
||||
|
||||
if ( $object_id && has_post_thumbnail( $object_id ) ) {
|
||||
$image_url = get_the_post_thumbnail_url( $object_id, 'large' );
|
||||
}
|
||||
} elseif ( is_home() || is_front_page() || is_archive() || is_search() ) {
|
||||
global $wp_query;
|
||||
|
||||
if ( isset( $wp_query->posts[0]->ID ) && has_post_thumbnail( $wp_query->posts[0]->ID ) ) {
|
||||
$image_url = get_the_post_thumbnail_url( $wp_query->posts[0]->ID, 'thumbnail' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $image_url ) ) {
|
||||
return $resources;
|
||||
}
|
||||
|
||||
$extension = strtolower( pathinfo( wp_parse_url( $image_url, PHP_URL_PATH ), PATHINFO_EXTENSION ) );
|
||||
|
||||
if ( 'jpg' === $extension || 'jpeg' === $extension ) {
|
||||
$image_type = 'image/jpeg';
|
||||
} elseif ( 'png' === $extension ) {
|
||||
$image_type = 'image/png';
|
||||
} elseif ( 'webp' === $extension ) {
|
||||
$image_type = 'image/webp';
|
||||
}
|
||||
|
||||
$resources[] = array_filter(
|
||||
array(
|
||||
'href' => esc_url( $image_url ),
|
||||
'as' => 'image',
|
||||
'type' => $image_type,
|
||||
'fetchpriority' => 'high',
|
||||
)
|
||||
);
|
||||
|
||||
return $resources;
|
||||
}
|
||||
add_filter( 'wp_preload_resources', 'zeitfresser_preload_resources' );
|
||||
|
||||
/**
|
||||
* Improve script loading strategy for non-critical assets.
|
||||
*
|
||||
* @param array $tag Script tag markup.
|
||||
* @param string $handle Script handle.
|
||||
* @param string $src Script source URL.
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_defer_non_critical_scripts( $tag, $handle, $src ) {
|
||||
$deferred_handles = array(
|
||||
'zeitfresser-navigation',
|
||||
'zeitfresser-masonry',
|
||||
'zeitfresser-scripts',
|
||||
);
|
||||
|
||||
if ( in_array( $handle, $deferred_handles, true ) && false === strpos( $tag, ' defer' ) ) {
|
||||
return str_replace( ' src=', ' defer src=', $tag );
|
||||
}
|
||||
|
||||
return $tag;
|
||||
}
|
||||
add_filter( 'script_loader_tag', 'zeitfresser_defer_non_critical_scripts', 10, 3 );
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<?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 zeitfresser
|
||||
*/
|
||||
|
||||
?>
|
||||
<!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="https://gmpg.org/xfn/11">
|
||||
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?>>
|
||||
<?php wp_body_open(); ?>
|
||||
<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'zeitfresser' ); ?></a>
|
||||
|
||||
|
||||
<header id="masthead" class="site-header">
|
||||
|
||||
<div class="header-wrapper">
|
||||
<div class="container">
|
||||
<div class="site-header-wrapper">
|
||||
<div class="site-branding">
|
||||
|
||||
<?php the_custom_logo(); ?>
|
||||
|
||||
<div class="site-identity">
|
||||
|
||||
<?php if( get_theme_mod( 'show_hide_site_title', zeitfresser_get_default_site_title_show_hide() ) ) { ?>
|
||||
<div class="site-title">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"
|
||||
class="logo"><?php bloginfo( 'name' ); ?></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php $daisy_blog_description = get_bloginfo( 'description' ); ?>
|
||||
<?php if( get_theme_mod( 'show_hide_site_tagline', zeitfresser_get_default_site_tagline_show_hide() ) ) { ?>
|
||||
<div class="site-description"><?php echo $daisy_blog_description; ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div><!-- .site-branding -->
|
||||
|
||||
<div class="nav-social-links">
|
||||
<nav id="site-navigation" class="main-navigation">
|
||||
<button id="nav-icon3" class="menu-toggle" aria-controls="primary-menu"
|
||||
aria-expanded="false">
|
||||
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</button>
|
||||
<?php
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => 'menu-1',
|
||||
'menu_id' => 'primary-menu',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</nav><!-- #site-navigation -->
|
||||
|
||||
<?php get_template_part( 'template-parts/social', 'links' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header><!-- #masthead -->
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg viewBox="0 0 24 24" fill="#000" xmlns="http://www.w3.org/2000/svg"><title/><g data-name="Layer 2" id="Layer_2"><path d="M18,10a8,8,0,1,0-3.1,6.31l6.4,6.4,1.41-1.41-6.4-6.4A8,8,0,0,0,18,10Zm-8,6a6,6,0,1,1,6-6A6,6,0,0,1,10,16Z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 264 B |
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg viewBox="0 0 24 24" fill="#fff" xmlns="http://www.w3.org/2000/svg"><title/><g data-name="Layer 2" id="Layer_2"><path d="M18,10a8,8,0,1,0-3.1,6.31l6.4,6.4,1.41-1.41-6.4-6.4A8,8,0,0,0,18,10Zm-8,6a6,6,0,1,1,6-6A6,6,0,0,1,10,16Z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 264 B |
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Register customizer blocks used by the Zeitfresser theme.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ZEITFRESSER_BLOCKS_DIR_PATH' ) ) {
|
||||
define( 'ZEITFRESSER_BLOCKS_DIR_PATH', dirname( __FILE__ ) );
|
||||
}
|
||||
|
||||
if ( ! defined( 'DAISY_BLOG_BLOCKS_DIR_PATH' ) ) {
|
||||
define( 'DAISY_BLOG_BLOCKS_DIR_PATH', ZEITFRESSER_BLOCKS_DIR_PATH );
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/includes/sanitize.php';
|
||||
require dirname( __FILE__ ) . '/includes/register-controls.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/site-identity/site-identity.php';
|
||||
require dirname( __FILE__ ) . '/colors/colors.php';
|
||||
require dirname( __FILE__ ) . '/font-family/font-family.php';
|
||||
require dirname( __FILE__ ) . '/font-customization/font-customization.php';
|
||||
require dirname( __FILE__ ) . '/general/general.php';
|
||||
require dirname( __FILE__ ) . '/post-detail/post-detail.php';
|
||||
require dirname( __FILE__ ) . '/footer-copyright/footer-copyright.php';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_sticky_menu_background_color' );
|
||||
function zeitfresser_sticky_menu_background_color() {
|
||||
|
||||
$bg_color = get_theme_mod( 'background_color', get_theme_support( 'custom-background', 'default-color' ) );
|
||||
|
||||
$dynamic_css = "body,.site-header{background:#$bg_color;}";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_dark_color' );
|
||||
|
||||
function zeitfresser_dark_color( $wp_customize ) {
|
||||
$wp_customize->add_setting( 'dark_color', array(
|
||||
'default' => zeitfresser_get_default_dark_color(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'dark_color', array(
|
||||
'label' => esc_html__( 'Misc Colors', 'zeitfresser' ),
|
||||
'section' => 'colors',
|
||||
'settings' => 'dark_color',
|
||||
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_dark_color_enqueue_scripts' );
|
||||
function zeitfresser_dark_color_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-dark-customizer', get_template_directory_uri() . '/inc/blocks/colors/color-dark/customizer-color-dark.js', array('jquery'), '', true );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('dark_color',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--dark-color', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_grey_color' );
|
||||
|
||||
function zeitfresser_grey_color( $wp_customize ) {
|
||||
$wp_customize->add_setting( 'grey_color', array(
|
||||
'default' => zeitfresser_get_default_grey_color(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'grey_color', array(
|
||||
'label' => esc_html__( 'Soft Text Color', 'zeitfresser' ),
|
||||
'section' => 'colors',
|
||||
'settings' => 'grey_color',
|
||||
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_grey_color_enqueue_scripts' );
|
||||
function zeitfresser_grey_color_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-grey-customizer', get_template_directory_uri() . '/inc/blocks/colors/color-grey/customizer-color-grey.js', array('jquery'), '', true );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('grey_color',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--grey-color', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_light_color' );
|
||||
|
||||
function zeitfresser_light_color( $wp_customize ) {
|
||||
$wp_customize->add_setting( 'light_color', array(
|
||||
'default' => zeitfresser_get_default_light_color(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'light_color', array(
|
||||
'label' => esc_html__( 'Header Color', 'zeitfresser' ),
|
||||
'section' => 'colors',
|
||||
'settings' => 'light_color',
|
||||
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_light_color_enqueue_scripts' );
|
||||
function zeitfresser_light_color_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-light-customizer', get_template_directory_uri() . '/inc/blocks/colors/color-light/customizer-color-light.js', array('jquery'), '', true );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('light_color',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--light-color', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_primary_color' );
|
||||
function zeitfresser_primary_color( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'primary_color', array(
|
||||
'default' => zeitfresser_get_default_primary_color(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array(
|
||||
'label' => esc_html__( 'Menu / Title / Button Color', 'zeitfresser' ),
|
||||
'section' => 'colors',
|
||||
'settings' => 'primary_color',
|
||||
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_primary_color_enqueue_scripts' );
|
||||
function zeitfresser_primary_color_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-primary-color-customizer', get_template_directory_uri() . '/inc/blocks/colors/color-primary/customizer-color-primary.js', array('jquery'), '', true );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('primary_color',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--primary-color', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_secondary_color' );
|
||||
|
||||
function zeitfresser_secondary_color( $wp_customize ) {
|
||||
$wp_customize->add_setting( 'secondary_color', array(
|
||||
'default' => zeitfresser_get_default_secondary_color(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'sanitize_hex_color'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'secondary_color', array(
|
||||
'label' => esc_html__( 'Highlight Color', 'zeitfresser' ),
|
||||
'section' => 'colors',
|
||||
'settings' => 'secondary_color',
|
||||
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_secondary_color_enqueue_scripts' );
|
||||
function zeitfresser_secondary_color_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-secondary-customizer', get_template_directory_uri() . '/inc/blocks/colors/color-secondary/customizer-color-secondary.js', array('jquery'), '', true );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('secondary_color',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--secondary-color', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_site_title_color' );
|
||||
function zeitfresser_site_title_color( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'site_title_color_option', array(
|
||||
'default' => zeitfresser_get_default_site_title_color(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'sanitize_hex_color',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'site_title_color_option', array(
|
||||
'label' => esc_html__( 'Site Identity Color', 'zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'settings' => 'site_title_color_option',
|
||||
) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_site_title_color_enqueue_scripts' );
|
||||
function zeitfresser_site_title_color_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-site-title-color-customizer', get_template_directory_uri() . '/inc/blocks/colors/color-site-title/customizer-color-site-title.js', array(), '', true );
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize( 'site_title_color_option', function( value ) {
|
||||
value.bind( function( to ) {
|
||||
$( '.site-title a' ).css( 'color', to );
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
|
||||
add_action( 'after_setup_theme', function () {
|
||||
add_theme_support( 'custom-header', array( 'header-text' => false ) );
|
||||
} );
|
||||
|
||||
add_action('customize_register', 'zeitfresser_color_section');
|
||||
function zeitfresser_color_section($wp_customize)
|
||||
{
|
||||
$wp_customize->get_section('colors')->title = esc_html__( "Color Options", 'zeitfresser' );
|
||||
$wp_customize->get_section('colors')->priority = 21;
|
||||
}
|
||||
|
||||
/* Add Default Colors for Customizer Settings */
|
||||
require dirname( __FILE__ ) . '/default-colors.php';
|
||||
|
||||
if( db_fs()->is__premium_only() ) {
|
||||
|
||||
require dirname( __FILE__ ) . '/color-site-title/color-site-title.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/color-primary/color-primary.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/color-secondary/color-secondary.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/color-light/color-light.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/color-grey/color-grey.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/color-dark/color-dark.php';
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/color-background/color-background.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/dynamic-colors.php';
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* Default Site Title Color */
|
||||
function zeitfresser_get_default_site_title_color() {
|
||||
return "#f7f7fa";
|
||||
}
|
||||
|
||||
/* Default Primary Color */
|
||||
function zeitfresser_get_default_primary_color() {
|
||||
return "#f7f7fa";
|
||||
}
|
||||
|
||||
/* Default Secondary Color */
|
||||
function zeitfresser_get_default_secondary_color() {
|
||||
return "#f7f7fa";
|
||||
}
|
||||
|
||||
/* Default Light Color */
|
||||
function zeitfresser_get_default_light_color() {
|
||||
return "#1e1f29";
|
||||
}
|
||||
|
||||
/* Default Grey Color */
|
||||
function zeitfresser_get_default_grey_color() {
|
||||
return "#f7f7fa";
|
||||
}
|
||||
|
||||
/* Default Dark Color */
|
||||
function zeitfresser_get_default_dark_color() {
|
||||
return "#f7f7fa";
|
||||
}
|
||||
|
||||
/* Default Background Color */
|
||||
function zeitfresser_get_default_background_color() {
|
||||
return "1e1f29";
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_site_title_color_dynamic_css' );
|
||||
function zeitfresser_site_title_color_dynamic_css() {
|
||||
|
||||
$site_title_color = esc_attr( get_theme_mod( 'site_title_color_option', zeitfresser_get_default_site_title_color() ) );
|
||||
|
||||
$dynamic_css = ":root { --site-title-color: $site_title_color; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_secondary_color_dynamic_css' );
|
||||
function zeitfresser_secondary_color_dynamic_css() {
|
||||
|
||||
$secondary_color = esc_attr( get_theme_mod( 'secondary_color', zeitfresser_get_default_secondary_color() ) );
|
||||
|
||||
$dynamic_css = ":root { --secondary-color: $secondary_color; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_primary_color_dynamic_css' );
|
||||
function zeitfresser_primary_color_dynamic_css() {
|
||||
|
||||
$primary_color = esc_attr( get_theme_mod( 'primary_color', zeitfresser_get_default_primary_color() ) );
|
||||
|
||||
$dynamic_css = ":root { --primary-color: $primary_color; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_light_color_dynamic_css' );
|
||||
function zeitfresser_light_color_dynamic_css() {
|
||||
|
||||
$light_color = esc_attr( get_theme_mod( 'light_color', zeitfresser_get_default_light_color() ) );
|
||||
|
||||
$dynamic_css = ":root { --light-color: $light_color; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_grey_color_dynamic_css' );
|
||||
function zeitfresser_grey_color_dynamic_css() {
|
||||
|
||||
$grey_color = esc_attr( get_theme_mod( 'grey_color', zeitfresser_get_default_grey_color() ) );
|
||||
|
||||
$dynamic_css = ":root { --grey-color: $grey_color; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_dark_color_dynamic_css' );
|
||||
function zeitfresser_dark_color_dynamic_css() {
|
||||
|
||||
$dark_color = esc_attr( get_theme_mod( 'dark_color', zeitfresser_get_default_dark_color() ) );
|
||||
|
||||
$dynamic_css = ":root { --dark-color: $dark_color; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* Default Font Size */
|
||||
function zeitfresser_get_default_font_size() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
function zeitfresser_get_default_logo_size() {
|
||||
return 60;
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_get_default_site_identity_font_size() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_get_default_font_weight() {
|
||||
return "400";
|
||||
}
|
||||
|
||||
function zeitfresser_get_default_line_height() {
|
||||
return "1.6";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_font_customization_section' );
|
||||
function zeitfresser_register_font_customization_section( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'daisy_blog_font_customization_section', array(
|
||||
'title' => esc_html__( 'Font Options', 'zeitfresser' ),
|
||||
'priority' => 20
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Add Default Font Customization for Customizer Settings */
|
||||
require dirname( __FILE__ ) . '/default-font-customization.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/logo-size/logo-size.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/site-identity-font-size/site-identity-font-size.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/font-size/font-size.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/font-weight/font-weight.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/line-height/line-height.php';
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('font_size',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
$( 'body,html' ).css( 'font-size', to+'px' );
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_font_size' );
|
||||
function zeitfresser_font_size( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'font_size', array(
|
||||
'default' => zeitfresser_get_default_font_size(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'absint'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'font_size', array(
|
||||
'type' => 'number',
|
||||
'settings' => 'font_size',
|
||||
'label' => esc_html__( 'Body Font Size', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_font_customization_section',
|
||||
'input_attrs' => array(
|
||||
'min' => 1,
|
||||
'max' => 30
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_font_size_enqueue_scripts' );
|
||||
function zeitfresser_font_size_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-font-size-customizer', get_template_directory_uri() . '/inc/blocks/font-customization/font-size/customizer-font-size.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_font_size_dynamic_css' );
|
||||
function zeitfresser_font_size_dynamic_css() {
|
||||
|
||||
$font_size = esc_attr( get_theme_mod( 'font_size', zeitfresser_get_default_font_size() ) );
|
||||
$font_size .= 'px';
|
||||
|
||||
$dynamic_css = "html,body{font-size:{$font_size};}";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('font_weight',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--font-weight', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_font_weight' );
|
||||
function zeitfresser_font_weight( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'font_weight', array(
|
||||
'default' => zeitfresser_get_default_font_weight(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'absint'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'font_weight', array(
|
||||
'type' => 'number',
|
||||
'settings' => 'font_weight',
|
||||
'label' => esc_html__( 'Body Font Weight', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_font_customization_section',
|
||||
'input_attrs' => array(
|
||||
'min' => 100,
|
||||
'max' => 900,
|
||||
'step' => 100
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_font_weight_enqueue_scripts' );
|
||||
function zeitfresser_font_weight_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-font-weight-customizer', get_template_directory_uri() . '/inc/blocks/font-customization/font-weight/customizer-font-weight.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_font_weight_dynamic_css' );
|
||||
function zeitfresser_font_weight_dynamic_css() {
|
||||
|
||||
$font_weight = esc_attr( get_theme_mod( 'font_weight', zeitfresser_get_default_font_weight() ) );
|
||||
|
||||
$dynamic_css = ":root { --font-weight: $font_weight; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('line_height',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--line-height', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_line_height' );
|
||||
function zeitfresser_line_height( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'line_height', array(
|
||||
'default' => zeitfresser_get_default_line_height(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_float'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'line_height', array(
|
||||
'type' => 'number',
|
||||
'settings' => 'line_height',
|
||||
'label' => esc_html__( 'Line Height', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_font_customization_section',
|
||||
'input_attrs' => array(
|
||||
'min' => 1,
|
||||
'max' => 5,
|
||||
'step' => 0.1
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_line_height_enqueue_scripts' );
|
||||
function zeitfresser_line_height_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-line-height-customizer', get_template_directory_uri() . '/inc/blocks/font-customization/line-height/customizer-line-height.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_line_height_dynamic_css' );
|
||||
function zeitfresser_line_height_dynamic_css() {
|
||||
|
||||
$line_height = esc_attr( get_theme_mod( 'line_height', zeitfresser_get_default_line_height() ) );
|
||||
|
||||
$dynamic_css = ":root { --line-height: $line_height; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('logo_size',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--logo-size', to+'px');
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_logo_size' );
|
||||
function zeitfresser_logo_size( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'logo_size', array(
|
||||
'default' => zeitfresser_get_default_logo_size(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'absint'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'logo_size', array(
|
||||
'type' => 'number',
|
||||
'settings' => 'logo_size',
|
||||
'priority' => 8,
|
||||
'label' => esc_html__( 'Logo Size', 'zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'input_attrs' => array(
|
||||
'min' => 10,
|
||||
'max' => 100
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_logo_size_enqueue_scripts' );
|
||||
function zeitfresser_logo_size_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-logo-size-customizer', get_template_directory_uri() . '/inc/blocks/font-customization/logo-size/customizer-logo-size.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_logo_size_dynamic_css' );
|
||||
function zeitfresser_logo_size_dynamic_css() {
|
||||
|
||||
$logo_size = esc_attr( get_theme_mod( 'logo_size', zeitfresser_get_default_logo_size() ) );
|
||||
$logo_size .= 'px';
|
||||
|
||||
$dynamic_css = ":root { --logo-size: $logo_size; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('site_identity_font_size',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--site-identity-font-size', to+'px');
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_site_identity_font_size' );
|
||||
function zeitfresser_site_identity_font_size( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'site_identity_font_size', array(
|
||||
'default' => zeitfresser_get_default_site_identity_font_size(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'absint'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'site_identity_font_size', array(
|
||||
'type' => 'number',
|
||||
'settings' => 'site_identity_font_size',
|
||||
'label' => esc_html__( 'Site Identity Size', 'zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'input_attrs' => array(
|
||||
'min' => 10,
|
||||
'max' => 40
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_site_identity_font_size_enqueue_scripts' );
|
||||
function zeitfresser_site_identity_font_size_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-site-identity-font-size-customizer', get_template_directory_uri() . '/inc/blocks/font-customization/site-identity-font-size/customizer-site-identity-font-size.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_site_identity_font_size_dynamic_css' );
|
||||
function zeitfresser_site_identity_font_size_dynamic_css() {
|
||||
|
||||
$site_identity_font_size = esc_attr( get_theme_mod( 'site_identity_font_size', zeitfresser_get_default_site_identity_font_size() ) );
|
||||
$site_identity_font_size .= 'px';
|
||||
|
||||
$dynamic_css = ":root { --site-identity-font-size: $site_identity_font_size; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/* Default Font Family */
|
||||
function zeitfresser_get_default_site_identity_font_family() {
|
||||
return esc_html__( "Oswald", 'zeitfresser' );
|
||||
}
|
||||
|
||||
function zeitfresser_get_default_main_font_family() {
|
||||
return esc_html__( "Oswald", 'zeitfresser' );
|
||||
}
|
||||
|
||||
function zeitfresser_get_default_secondary_font_family() {
|
||||
return esc_html__( "Roboto", 'zeitfresser' );
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/* Add Google Fonts */
|
||||
require dirname( __FILE__ ) . '/google-fonts.php';
|
||||
|
||||
/* Add Default Font Family for Customizer Settings */
|
||||
require dirname( __FILE__ ) . '/default-font-family.php';
|
||||
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/inc/helper-functions.php' );
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/inc/class-webfonts-local.php' );
|
||||
include_once wp_normalize_path( dirname( __FILE__ ) . '/inc/class-fonts-google-local.php' );
|
||||
|
||||
|
||||
|
||||
require dirname( __FILE__ ) . '/site-identity/site-identity-font-family.php';
|
||||
require dirname( __FILE__ ) . '/main/main-font-family.php';
|
||||
require dirname( __FILE__ ) . '/secondary/secondary-font-family.php';
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_google_fonts_scripts', 5 );
|
||||
function zeitfresser_google_fonts_scripts() {
|
||||
$local_css = zeitfresser_get_local_webfonts_css();
|
||||
|
||||
wp_register_style( 'zeitfresser-webfonts', false, array(), ZEITFRESSER_VERSION );
|
||||
wp_enqueue_style( 'zeitfresser-webfonts' );
|
||||
|
||||
if ( ! empty( $local_css ) ) {
|
||||
wp_add_inline_style( 'zeitfresser-webfonts', $local_css );
|
||||
return;
|
||||
}
|
||||
|
||||
$args = zeitfresser_used_google_fonts();
|
||||
$fonts_url = zeitfresser_fonts_url( $args );
|
||||
|
||||
if ( empty( $fonts_url ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'google-fonts', $fonts_url, array(), null );
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,457 @@
|
||||
<?php
|
||||
/**
|
||||
* Handles downloading a font from the google-fonts API locally.
|
||||
* Solves privacy concerns with Google's CDN
|
||||
* and their sometimes less-than-transparent policies.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
// Do not allow directly accessing this file.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit( 'Direct script access denied.' );
|
||||
}
|
||||
|
||||
final class Daisy_Blog_Google_Local {
|
||||
|
||||
/**
|
||||
* The name of the font-family
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $family;
|
||||
|
||||
/**
|
||||
* The system path where font-files are stored.
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $folder_path;
|
||||
|
||||
/**
|
||||
* The URL where files for this font can be found.
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $folder_url;
|
||||
|
||||
/**
|
||||
* An array of instances for this object.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private static $instances = array();
|
||||
|
||||
/**
|
||||
* Create an instance of this object for a specific font-family.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $family The font-family name.
|
||||
* @return Daisy_Blog_Google_Local
|
||||
*/
|
||||
public static function init( $family ) {
|
||||
$key = sanitize_key( $family );
|
||||
if ( ! isset( self::$instances[ $key ] ) ) {
|
||||
self::$instances[ $key ] = new self( $family );
|
||||
}
|
||||
return self::$instances[ $key ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access private
|
||||
* @param string $family The font-family name.
|
||||
*/
|
||||
private function __construct( $family ) {
|
||||
$this->family = $family;
|
||||
$key = sanitize_key( $this->family );
|
||||
$this->folder_path = $this->get_root_path() . "/$key";
|
||||
$this->folder_url = $this->get_root_url() . "/$key";
|
||||
$this->files = $this->get_font_family();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the @font-face CSS.
|
||||
*
|
||||
* @access public
|
||||
* @param array $variants The variants we want to get.
|
||||
* @return string
|
||||
*/
|
||||
public function get_css( $variants = array() ) {
|
||||
if ( ! $this->files ) {
|
||||
return;
|
||||
}
|
||||
$key = md5( wp_json_encode( $this->files ) );
|
||||
$cached = get_transient( $key );
|
||||
if ( $cached ) {
|
||||
return $cached;
|
||||
}
|
||||
$css = '';
|
||||
|
||||
// If $variants is empty then use all variants available.
|
||||
if ( empty( $variants ) ) {
|
||||
$variants = array_keys( $this->files );
|
||||
}
|
||||
|
||||
// Download files.
|
||||
$this->download_font_family( $variants );
|
||||
|
||||
// Create the @font-face CSS.
|
||||
foreach ( $variants as $variant ) {
|
||||
$css .= $this->get_variant_fontface_css( $variant );
|
||||
}
|
||||
set_transient( $key, $css, WEEK_IN_SECONDS );
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download font-family files.
|
||||
*
|
||||
* @access public
|
||||
* @param array $variants An array of variants to download. Leave empty to download all.
|
||||
* @return void
|
||||
*/
|
||||
public function download_font_family( $variants = array() ) {
|
||||
if ( empty( $variants ) ) {
|
||||
$variants = array_keys( $this->files );
|
||||
}
|
||||
foreach ( $this->files as $variant => $file ) {
|
||||
if ( in_array( $variant, $variants ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
|
||||
$this->download_font_file( $file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a font-file and saves it locally.
|
||||
*
|
||||
* @access private
|
||||
* @param string $url The URL of the file we want to get.
|
||||
* @return bool
|
||||
*/
|
||||
private function download_font_file( $url ) {
|
||||
$path = $this->folder_path . '/' . $this->get_filename_from_url( $url );
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $this->folder_path ) ) {
|
||||
wp_mkdir_p( $this->folder_path );
|
||||
}
|
||||
// If the file exists no reason to do anything.
|
||||
if ( file_exists( $path ) ) {
|
||||
return true;
|
||||
}else{
|
||||
$contents = $this->get_remote_url_contents( $url );
|
||||
// Write file.
|
||||
$filesystem = $this->get_filesystem();
|
||||
return $filesystem->put_contents( $path, $contents, FS_CHMOD_FILE );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the remote URL contents.
|
||||
*
|
||||
* @access private
|
||||
* @param string $url The URL we want to get.
|
||||
* @return string The contents of the remote URL.
|
||||
*/
|
||||
public function get_remote_url_contents( $url ) {
|
||||
$response = wp_remote_get( $url );
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return array();
|
||||
}
|
||||
$html = wp_remote_retrieve_body( $response );
|
||||
if ( is_wp_error( $html ) ) {
|
||||
return;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filename by breaking-down the URL parts.
|
||||
*
|
||||
* @access private
|
||||
* @param string $url The URL.
|
||||
* @return string The filename.
|
||||
*/
|
||||
private function get_filename_from_url( $url ) {
|
||||
$url_parts = explode( '/', $url );
|
||||
$parts_count = count( $url_parts );
|
||||
if ( 1 < $parts_count ) {
|
||||
return $url_parts[ count( $url_parts ) - 1 ];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the @font-face CSS for a specific variant.
|
||||
*
|
||||
* @access public
|
||||
* @param string $variant The variant.
|
||||
* @return string
|
||||
*/
|
||||
public function get_variant_fontface_css( $variant ) {
|
||||
$font_face = "@font-face{font-family:'{$this->family}';";
|
||||
|
||||
// Get the font-style.
|
||||
$font_style = ( false !== strpos( $variant, 'italic' ) ) ? 'italic' : 'normal';
|
||||
$font_face .= "font-style:{$font_style};";
|
||||
|
||||
// Get the font-weight.
|
||||
$font_weight = '400';
|
||||
$font_weight = str_replace( 'italic', '', $variant );
|
||||
$font_weight = ( ! $font_weight || 'regular' === $font_weight ) ? '400' : $font_weight;
|
||||
$font_face .= "font-weight:{$font_weight};";
|
||||
|
||||
// Get the font-names.
|
||||
$font_name_0 = $this->get_local_font_name( $variant, false );
|
||||
$font_name_1 = $this->get_local_font_name( $variant, true );
|
||||
$font_face .= "src:local('{$font_name_0}'),";
|
||||
if ( $font_name_0 !== $font_name_1 ) {
|
||||
$font_face .= "local('{$font_name_1}'),";
|
||||
}
|
||||
|
||||
// Get the font-url.
|
||||
$font_url = $this->get_variant_local_url( $variant );
|
||||
$paths = $this->get_font_files_paths();
|
||||
if ( ! file_exists( $paths[ $variant ] ) ) {
|
||||
$font_url = $this->files[ $variant ];
|
||||
}
|
||||
|
||||
// Get the font-format.
|
||||
$font_format = ( strpos( $font_url, '.woff2' ) ) ? 'woff2' : 'truetype';
|
||||
$font_format = ( strpos( $font_url, '.woff' ) && ! strpos( $font_url, '.woff2' ) ) ? 'woff' : $font_format;
|
||||
$font_face .= "url({$font_url}) format('{$font_format}');}";
|
||||
|
||||
return $font_face;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the font-family.
|
||||
* This is used by @font-face in case the user already has the font downloaded locally.
|
||||
*
|
||||
* @access public
|
||||
* @param string $variant The variant.
|
||||
* @param bool $compact Whether we want the compact formatting or not.
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_font_name( $variant, $compact = false ) {
|
||||
$variant_names = array(
|
||||
'100' => 'Thin',
|
||||
'100i' => 'Thin Italic',
|
||||
'100italic' => 'Thin Italic',
|
||||
'200' => 'Extra-Light',
|
||||
'200i' => 'Extra-Light Italic',
|
||||
'200italic' => 'Extra-Light Italic',
|
||||
'300' => 'Light',
|
||||
'300i' => 'Light Italic',
|
||||
'300italic' => 'Light Italic',
|
||||
'400' => 'Regular',
|
||||
'regular' => 'Regular',
|
||||
'400i' => 'Regular Italic',
|
||||
'italic' => 'Italic',
|
||||
'400italic' => 'Regular Italic',
|
||||
'500' => 'Medium',
|
||||
'500i' => 'Medium Italic',
|
||||
'500italic' => 'Medium Italic',
|
||||
'600' => 'Semi-Bold',
|
||||
'600i' => 'Semi-Bold Italic',
|
||||
'600italic' => 'Semi-Bold Italic',
|
||||
'700' => 'Bold',
|
||||
'700i' => 'Bold Italic',
|
||||
'700italic' => 'Bold Italic',
|
||||
'800' => 'Extra-Bold',
|
||||
'800i' => 'Extra-Bold Italic',
|
||||
'800italic' => 'Extra-Bold Italic',
|
||||
'900' => 'Black',
|
||||
'900i' => 'Black Italic',
|
||||
'900italic' => 'Black Italic',
|
||||
);
|
||||
|
||||
$variant = (string) $variant;
|
||||
if ( $compact ) {
|
||||
if ( isset( $variant_names[ $variant ] ) ) {
|
||||
return str_replace( array( ' ', '-' ), '', $this->family ) . '-' . str_replace( array( ' ', '-' ), '', $variant_names[ $variant ] );
|
||||
}
|
||||
return str_replace( array( ' ', '-' ), '', $this->family );
|
||||
}
|
||||
|
||||
if ( isset( $variant_names[ $variant ] ) ) {
|
||||
return $this->family . ' ' . $variant_names[ $variant ];
|
||||
}
|
||||
return $this->family;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the local URL for a variant.
|
||||
*
|
||||
* @access public
|
||||
* @param string $variant The variant.
|
||||
* @return string The URL.
|
||||
*/
|
||||
public function get_variant_local_url( $variant ) {
|
||||
$local_urls = $this->get_font_files_urls_local();
|
||||
|
||||
if ( empty( $local_urls ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Return the specific variant if we can find it.
|
||||
if ( isset( $local_urls[ $variant ] ) ) {
|
||||
return $local_urls[ $variant ];
|
||||
}
|
||||
|
||||
// Return regular if the one we want could not be found.
|
||||
if ( isset( $local_urls['regular'] ) ) {
|
||||
return $local_urls['regular'];
|
||||
}
|
||||
|
||||
// Return the first available if all else failed.
|
||||
$vals = array_values( $local_urls );
|
||||
return $vals[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of local file URLs.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function get_font_files_urls_local() {
|
||||
$urls = array();
|
||||
$files = $this->get_font_files();
|
||||
foreach ( $files as $key => $file ) {
|
||||
$urls[ $key ] = $this->folder_url . '/' . $file;
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of local file paths.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function get_font_files_paths() {
|
||||
$paths = array();
|
||||
$files = $this->get_font_files();
|
||||
foreach ( $files as $key => $file ) {
|
||||
$paths[ $key ] = $this->folder_path . '/' . $file;
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of font-files.
|
||||
* Only contains the filenames.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function get_font_files() {
|
||||
$files = array();
|
||||
foreach ( $this->files as $key => $url ) {
|
||||
$files[ $key ] = $this->get_filename_from_url( $url );
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root fonts folder path.
|
||||
* Other paths are built based on this.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function get_root_path() {
|
||||
|
||||
// Get the upload directory for this site.
|
||||
$upload_dir = wp_upload_dir();
|
||||
$path = untrailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . '/webfonts';
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $path ) ) {
|
||||
wp_mkdir_p( $path );
|
||||
}
|
||||
|
||||
// Return the path.
|
||||
return apply_filters( 'daisy_blog_googlefonts_root_path', $path );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root folder url.
|
||||
* Other urls are built based on this.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function get_root_url() {
|
||||
|
||||
// Get the upload directory for this site.
|
||||
$upload_dir = wp_upload_dir();
|
||||
|
||||
// The URL.
|
||||
$url = trailingslashit( $upload_dir['baseurl'] );
|
||||
|
||||
// Take care of domain mapping.
|
||||
// When using domain mapping we have to make sure that the URL to the file
|
||||
// does not include the original domain but instead the mapped domain.
|
||||
if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
|
||||
if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
|
||||
$mapped_domain = domain_mapping_siteurl( false );
|
||||
$original_domain = get_original_url( 'siteurl' );
|
||||
$url = str_replace( $original_domain, $mapped_domain, $url );
|
||||
}
|
||||
}
|
||||
$url = str_replace( array( 'https://', 'http://' ), '//', $url );
|
||||
return apply_filters( 'daisy_blog_googlefonts_root_url', untrailingslashit( esc_url_raw( $url ) ) . '/webfonts' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a font-family from the array of google-fonts.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function get_font_family() {
|
||||
// Get the fonts array.
|
||||
$fonts = $this->get_fonts();
|
||||
if ( isset( $fonts[ $this->family ] ) ) {
|
||||
return $fonts[ $this->family ];
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font defined in the google-fonts API.
|
||||
*
|
||||
* @access private
|
||||
* @return array
|
||||
*/
|
||||
private function get_fonts() {
|
||||
zeitfresser_get_google_fonts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the WP_Filesystem object.
|
||||
*
|
||||
* @access protected
|
||||
* @return object
|
||||
*/
|
||||
protected function get_filesystem(){
|
||||
// The WordPress filesystem.
|
||||
global $wp_filesystem;
|
||||
|
||||
if ( empty( $wp_filesystem ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
WP_Filesystem();
|
||||
}
|
||||
return $wp_filesystem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Handles adding to the footer the @font-face CSS for locally-hosted google-fonts.
|
||||
* Solves privacy concerns with Google's CDN and their sometimes less-than-transparent policies.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Manages the way Google Fonts are enqueued.
|
||||
*/
|
||||
final class Daisy_Blog_Webfonts_Local{
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*/
|
||||
protected $googlefonts;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $googlefonts ) {
|
||||
$this->googlefonts = $googlefonts;
|
||||
|
||||
add_action( 'wp_footer', array( $this, 'add_styles' ) );
|
||||
add_action( 'admin_footer', array( $this, 'add_styles' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Webfont Loader for Google Fonts.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function add_styles() {
|
||||
|
||||
$hosted_fonts = $this->googlefonts;
|
||||
|
||||
// Early exit if we don't need to add any fonts.
|
||||
if ( empty( $hosted_fonts ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure we only do this once per font-family.
|
||||
$hosted_fonts = array_unique( $hosted_fonts );
|
||||
|
||||
// Start CSS.
|
||||
$css = '';
|
||||
foreach( $hosted_fonts as $family ){
|
||||
// Add the @font-face CSS for this font-family.
|
||||
$css .= Daisy_Blog_Google_Local::init( $family )->get_css();
|
||||
}
|
||||
|
||||
// If we've got CSS, add to the footer.
|
||||
if ( $css ) {
|
||||
echo '<style id="daisy-blog-local-webfonts">' . $css . '</style>'; // WPCS: XSS ok.
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Function to check if it's a google font
|
||||
*/
|
||||
function zeitfresser_is_google_font( $font ){
|
||||
$return = false;
|
||||
$websafe_fonts = zeitfresser_get_websafe_font();
|
||||
if( $font ){
|
||||
if( array_key_exists( $font, $websafe_fonts ) ){
|
||||
//Web Safe Font
|
||||
$return = false;
|
||||
}else{
|
||||
//Google Font
|
||||
$return = true;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( ! function_exists( 'zeitfresser_get_websafe_font' ) ) {
|
||||
|
||||
/**
|
||||
* Function listing WebSafe Fonts and its attributes
|
||||
*/
|
||||
function zeitfresser_get_websafe_font(){
|
||||
$standard_fonts = array(
|
||||
'georgia-serif' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => 'Georgia, serif',
|
||||
),
|
||||
'palatino-serif' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Palatino Linotype", "Book Antiqua", Palatino, serif',
|
||||
),
|
||||
'times-serif' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Times New Roman", Times, serif',
|
||||
),
|
||||
'arial-helvetica' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => 'Arial, Helvetica, sans-serif',
|
||||
),
|
||||
'arial-gadget' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Arial Black", Gadget, sans-serif',
|
||||
),
|
||||
'comic-cursive' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Comic Sans MS", cursive, sans-serif',
|
||||
),
|
||||
'impact-charcoal' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => 'Impact, Charcoal, sans-serif',
|
||||
),
|
||||
'lucida' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Lucida Sans Unicode", "Lucida Grande", sans-serif',
|
||||
),
|
||||
'tahoma-geneva' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => 'Tahoma, Geneva, sans-serif',
|
||||
),
|
||||
'trebuchet-helvetica' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Trebuchet MS", Helvetica, sans-serif',
|
||||
),
|
||||
'verdana-geneva' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => 'Verdana, Geneva, sans-serif',
|
||||
),
|
||||
'courier' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Courier New", Courier, monospace',
|
||||
),
|
||||
'lucida-monaco' => array(
|
||||
'variants' => array( 'regular', 'italic', '700', '700italic' ),
|
||||
'fonts' => '"Lucida Console", Monaco, monospace',
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'daisy_blog_standard_fonts', $standard_fonts );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_used_google_fonts() {
|
||||
$main_font_family = zeitfresser_get_mod( 'main_font_family', zeitfresser_get_default_main_font_family() );
|
||||
$secondary_font_family = zeitfresser_get_mod( 'secondary_font_family', zeitfresser_get_default_secondary_font_family() );
|
||||
$site_identity_font_family = esc_attr( zeitfresser_get_mod( 'site_identity_font_family', zeitfresser_get_default_site_identity_font_family() ) );
|
||||
|
||||
$args['main_font_family'] = $main_font_family;
|
||||
$args['secondary_font_family'] = $secondary_font_family;
|
||||
$args['site_identity_font_family'] = $site_identity_font_family;
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_action( 'wp_loaded', 'zeitfresser_google_font_local' );
|
||||
if( ! function_exists( 'zeitfresser_google_font_local' ) ) {
|
||||
/**
|
||||
* Function that load Google Fonts used in our theme from customer locally.
|
||||
* Solves privacy concerns with Google's CDN and their sometimes less-than-transparent policies.
|
||||
*/
|
||||
function zeitfresser_google_font_local() {
|
||||
|
||||
$args = array();
|
||||
$fonts = zeitfresser_used_google_fonts();
|
||||
|
||||
foreach( $fonts as $font ) {
|
||||
|
||||
$is_google_font = zeitfresser_is_google_font( $font );
|
||||
|
||||
if( $is_google_font ) {
|
||||
array_push( $args, $font );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new Daisy_Blog_Webfonts_Local( $args );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_font_weight_variants' ) ) {
|
||||
/**
|
||||
* Return the font variants used by the theme as an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_font_weight_variants() {
|
||||
$weights = explode( ';', zeitfresser_font_weight_query() );
|
||||
$weights = array_map( 'trim', $weights );
|
||||
$weights = array_filter( $weights );
|
||||
|
||||
if ( ! in_array( '400', $weights, true ) ) {
|
||||
$weights[] = '400';
|
||||
}
|
||||
|
||||
$weights = array_values( array_unique( $weights ) );
|
||||
sort( $weights );
|
||||
|
||||
return $weights;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_local_webfonts_css' ) ) {
|
||||
/**
|
||||
* Build local @font-face CSS for currently selected Google fonts.
|
||||
*
|
||||
* Falls back to remote font file URLs per variant if a local file is not
|
||||
* available yet, so typography does not break during warmup.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_get_local_webfonts_css() {
|
||||
$fonts = array_values( array_unique( array_filter( zeitfresser_used_google_fonts() ) ) );
|
||||
$variants = zeitfresser_font_weight_variants();
|
||||
$css = '';
|
||||
|
||||
foreach ( $fonts as $font ) {
|
||||
if ( ! zeitfresser_is_google_font( $font ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$css .= Daisy_Blog_Google_Local::init( $font )->get_css( $variants );
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_local_webfont_urls' ) ) {
|
||||
/**
|
||||
* Extract local font asset URLs from a generated @font-face stylesheet.
|
||||
*
|
||||
* @param string $css Local webfont CSS.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_get_local_webfont_urls( $css ) {
|
||||
if ( empty( $css ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
preg_match_all( '#url\(([^)]+)\)#', $css, $matches );
|
||||
|
||||
if ( empty( $matches[1] ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$urls = array();
|
||||
|
||||
foreach ( $matches[1] as $url ) {
|
||||
$url = trim( $url, "\"'" );
|
||||
|
||||
if ( false !== strpos( $url, content_url() ) ) {
|
||||
$urls[] = esc_url_raw( $url );
|
||||
}
|
||||
}
|
||||
|
||||
return array_values( array_unique( array_filter( $urls ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( ! function_exists( 'zeitfresser_font_weight_query' ) ) {
|
||||
/**
|
||||
* Return the compact weight list used by the Zeitfresser theme.
|
||||
*/
|
||||
function zeitfresser_font_weight_query() {
|
||||
$weights = array( '400', '500', '700' );
|
||||
$body_weight = (string) zeitfresser_get_mod( 'font_weight', zeitfresser_get_default_font_weight() );
|
||||
|
||||
if ( preg_match( '/^\d{3}$/', $body_weight ) ) {
|
||||
$weights[] = $body_weight;
|
||||
}
|
||||
|
||||
$weights = array_values( array_unique( array_filter( $weights ) ) );
|
||||
sort( $weights );
|
||||
|
||||
return implode( ';', $weights );
|
||||
}
|
||||
}
|
||||
|
||||
if( ! function_exists( 'zeitfresser_fonts_url' ) ) {
|
||||
/**
|
||||
* Returns a Google Fonts CSS2 URL for the selected theme fonts.
|
||||
*/
|
||||
function zeitfresser_fonts_url( $fonts = array() ) {
|
||||
$font_families = array();
|
||||
$weights = zeitfresser_font_weight_query();
|
||||
|
||||
foreach ( $fonts as $font ) {
|
||||
if ( ! zeitfresser_is_google_font( $font ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$family_name = trim( (string) $font );
|
||||
|
||||
if ( '' === $family_name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$font_families[] = 'family=' . str_replace( ' ', '+', $family_name ) . ':wght@' . $weights;
|
||||
}
|
||||
|
||||
$font_families = array_values( array_unique( $font_families ) );
|
||||
|
||||
if ( empty( $font_families ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return esc_url( 'https://fonts.googleapis.com/css2?' . implode( '&', $font_families ) . '&display=swap' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( ! function_exists( 'zeitfresser_check_varient' ) ) {
|
||||
/**
|
||||
* Checks for matched varients in google fonts for typography fields
|
||||
*/
|
||||
function zeitfresser_check_varient( $font_family = 'serif', $font_variants = 'regular', $body = false ){
|
||||
$variant = '';
|
||||
$var = array();
|
||||
$google_fonts = zeitfresser_get_google_fonts(); //Google Fonts
|
||||
$websafe_fonts = zeitfresser_get_websafe_font(); //Standard Web Safe Fonts
|
||||
|
||||
if( array_key_exists( $font_family, $google_fonts ) ){
|
||||
$variants = $google_fonts[ $font_family ][ 'variants' ];
|
||||
if( in_array( $font_variants, $variants ) ){
|
||||
if( $body ){ //LOAD ALL VARIANTS FOR BODY FONT
|
||||
foreach( $variants as $v ){
|
||||
$var[] = $v;
|
||||
}
|
||||
$variant = implode( ',', $var );
|
||||
}else{
|
||||
$variant = $font_variants;
|
||||
}
|
||||
}else{
|
||||
$variant = 'regular';
|
||||
}
|
||||
}else{ //Standard Web Safe Fonts
|
||||
if( array_key_exists( $font_family, $websafe_fonts ) ){
|
||||
$variants = $websafe_fonts[ $font_family ][ 'variants' ];
|
||||
if( in_array( $font_variants, $variants ) ){
|
||||
if( $body ){ //LOAD ALL VARIANTS FOR BODY FONT
|
||||
foreach( $variants as $v ){
|
||||
$var[] = $v;
|
||||
}
|
||||
$variant = implode( ',', $var );
|
||||
}else{
|
||||
$variant = $font_variants;
|
||||
}
|
||||
}else{
|
||||
$variant = 'regular';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $variant;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( ! function_exists( 'zeitfresser_get_google_fonts' ) ) {
|
||||
/**
|
||||
* Get Google Fonts
|
||||
*/
|
||||
function zeitfresser_get_google_fonts(){
|
||||
$webfonts_json = @file_get_contents( get_template_directory_uri() . '/inc/blocks/font-family/inc/google-webfonts.json', true );
|
||||
$fonts = json_decode( $webfonts_json, true );
|
||||
|
||||
$google_fonts = array();
|
||||
|
||||
if ( is_array( $fonts ) ) {
|
||||
foreach ( $fonts['items'] as $font ) {
|
||||
$google_fonts[ $font['family'] ] = array(
|
||||
'variants' => $font['variants'],
|
||||
);
|
||||
}
|
||||
}
|
||||
return $google_fonts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('main_font_family',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
$("head").append("<link href='https://fonts.googleapis.com/css?family=" + to + ":200,300,400,500,600,700,800,900|' rel='stylesheet' type='text/css'>");
|
||||
document.body.style.setProperty('--primary-font', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_main_font_family' );
|
||||
function zeitfresser_main_font_family( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'main_font_family', array(
|
||||
'default' => zeitfresser_get_default_main_font_family(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_google_fonts'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'main_font_family', array(
|
||||
'settings' => 'main_font_family',
|
||||
'label' => esc_html__( 'Primary Font', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_font_customization_section',
|
||||
'type' => 'select',
|
||||
'choices' => zeitfresser_google_fonts( zeitfresser_free_pro() ),
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_main_font_family_enqueue_scripts' );
|
||||
function zeitfresser_main_font_family_enqueue_scripts() {
|
||||
|
||||
$main_font_family = esc_attr( get_theme_mod( 'main_font_family', zeitfresser_get_default_main_font_family() ) );
|
||||
|
||||
wp_enqueue_script( 'graphthemes-main-font-family-customizer', get_template_directory_uri() . '/inc/blocks/font-family/main/customizer-main-font-family.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_main_font_family_dynamic_css' );
|
||||
function zeitfresser_main_font_family_dynamic_css() {
|
||||
|
||||
$main_font_family = esc_attr( get_theme_mod( 'main_font_family', zeitfresser_get_default_main_font_family() ) );
|
||||
|
||||
$dynamic_css = ":root { --primary-font: $main_font_family; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('secondary_font_family',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
$("head").append("<link href='https://fonts.googleapis.com/css?family=" + to + ":200,300,400,500,600,700,800,900|' rel='stylesheet' type='text/css'>");
|
||||
document.body.style.setProperty('--secondary-font', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_secondary_font_family' );
|
||||
function zeitfresser_secondary_font_family( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'secondary_font_family', array(
|
||||
'default' => zeitfresser_get_default_secondary_font_family(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_google_fonts'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'secondary_font_family', array(
|
||||
'settings' => 'secondary_font_family',
|
||||
'label' => esc_html__( 'Secondary Font', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_font_customization_section',
|
||||
'type' => 'select',
|
||||
'choices' => zeitfresser_google_fonts( zeitfresser_free_pro() ),
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_secondary_font_family_enqueue_scripts' );
|
||||
function zeitfresser_secondary_font_family_enqueue_scripts() {
|
||||
|
||||
$secondary_font_family = esc_attr( get_theme_mod( 'secondary_font_family', zeitfresser_get_default_secondary_font_family() ) );
|
||||
|
||||
|
||||
wp_enqueue_script( 'graphthemes-secondary-font-family-customizer', get_template_directory_uri() . '/inc/blocks/font-family/secondary/customizer-secondary-font-family.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_secondary_font_family_dynamic_css' );
|
||||
function zeitfresser_secondary_font_family_dynamic_css() {
|
||||
|
||||
$secondary_font_family = esc_attr( get_theme_mod( 'secondary_font_family', zeitfresser_get_default_secondary_font_family() ) );
|
||||
|
||||
|
||||
$dynamic_css = ":root { --secondary-font: $secondary_font_family; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('site_identity_font_family',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
$("head").append("<link rel='stylesheet' href='https://fonts.googleapis.com/css?family="+to+":200,300,400,500,600,700,800,900|' rel='stylesheet' type='text/css'>");
|
||||
document.body.style.setProperty('--site-identity-font-family', to);
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_site_identity_font_family' );
|
||||
function zeitfresser_site_identity_font_family( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'site_identity_font_family', array(
|
||||
'default' => zeitfresser_get_default_site_identity_font_family(),
|
||||
'transport' => 'postMessage',
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_google_fonts'
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'site_identity_font_family', array(
|
||||
'settings' => 'site_identity_font_family',
|
||||
'label' => esc_html__( 'Site Title/Tagline Font', 'zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'type' => 'select',
|
||||
'choices' => zeitfresser_google_fonts( zeitfresser_free_pro() ),
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_site_identity_font_family_enqueue_scripts' );
|
||||
function zeitfresser_site_identity_font_family_enqueue_scripts() {
|
||||
|
||||
$site_identity_font_family = esc_attr( get_theme_mod( 'site_identity_font_family', zeitfresser_get_default_site_identity_font_family() ) );
|
||||
|
||||
|
||||
wp_enqueue_script( 'graphthemes-site-identity-font-family-customizer', get_template_directory_uri() . '/inc/blocks/font-family/site-identity/customizer-site-identity-font-family.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_site_identity_font_family_dynamic_css' );
|
||||
function zeitfresser_site_identity_font_family_dynamic_css() {
|
||||
|
||||
$site_identity_font_family = esc_attr( get_theme_mod( 'site_identity_font_family', zeitfresser_get_default_site_identity_font_family() ) );
|
||||
|
||||
$dynamic_css = ":root { --site-identity-font-family: $site_identity_font_family; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
function zeitfresser_get_default_footer_copyright() {
|
||||
return "Zeitfresser ©";
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/* Add Default Copyright Text */
|
||||
require dirname( __FILE__ ) . '/default-footer-copyright.php';
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_customize_register_footer_copyright' );
|
||||
function zeitfresser_customize_register_footer_copyright( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'daisy_blog_footer_copyright_section', array(
|
||||
'title' => esc_html__( 'Footer Copyright', 'zeitfresser' ),
|
||||
'priority' => 24
|
||||
) );
|
||||
|
||||
$wp_customize->add_setting( 'footer_copyright_text', array(
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'default' => zeitfresser_get_default_footer_copyright()
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'footer_copyright_text', array(
|
||||
'label' => esc_html__( 'Copyright Text', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_footer_copyright_section',
|
||||
'settings' => 'footer_copyright_text',
|
||||
'type'=> 'textarea',
|
||||
) );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_container_width' );
|
||||
function zeitfresser_container_width( $wp_customize ) {
|
||||
|
||||
$general_title = '<hr/><h2>' . esc_html__( 'General:', 'zeitfresser' ) . '</h2>';
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'zeitfresser_general_title',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Daisy_Blog_Custom_Text(
|
||||
$wp_customize,
|
||||
'zeitfresser_general_title',
|
||||
array(
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => $general_title,
|
||||
'priority' => 5,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting('container_width', array(
|
||||
'default' => zeitfresser_get_default_container_width(),
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
));
|
||||
|
||||
$wp_customize->add_control( 'container_width', array(
|
||||
'label' => esc_html__('Container Width', 'zeitfresser'),
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'type' => 'number',
|
||||
'priority' => 10,
|
||||
'input_attrs' => array(
|
||||
'min' => 1000,
|
||||
'max' => 1600
|
||||
) )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_container_width_enqueue_scripts' );
|
||||
function zeitfresser_container_width_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-container-width-customizer', get_template_directory_uri() . '/inc/blocks/general/container-width/customizer-container-width.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_container_width_dynamic_css' );
|
||||
function zeitfresser_container_width_dynamic_css() {
|
||||
|
||||
$container_width = esc_attr( get_theme_mod( 'container_width', zeitfresser_get_default_container_width() ) );
|
||||
$container_width .= 'px';
|
||||
|
||||
$dynamic_css = ":root { --container-width: $container_width; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('container_width',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--container-width', to+"px");
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/* Default General Customization */
|
||||
|
||||
function zeitfresser_get_default_breadcrumbs() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_get_default_sticky_menu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_get_default_container_width() {
|
||||
return 1400;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* General customizer section.
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_general_customization_section' );
|
||||
|
||||
/**
|
||||
* Register the general options section.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_register_general_customization_section( $wp_customize ) {
|
||||
$wp_customize->add_section(
|
||||
'daisy_blog_general_customization_section',
|
||||
array(
|
||||
'title' => esc_html__( 'General Options', 'zeitfresser' ),
|
||||
'priority' => 21,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/default-general.php';
|
||||
require dirname( __FILE__ ) . '/container-width/container-width.php';
|
||||
require dirname( __FILE__ ) . '/social-links/social-links.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/../post-snippet/default-post-snippet.php';
|
||||
require dirname( __FILE__ ) . '/../post-snippet/excerpt/excerpt.php';
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* Social links customizer settings.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_social_links' ) ) {
|
||||
/**
|
||||
* Return supported social network labels.
|
||||
*
|
||||
* @return array<string,string>
|
||||
*/
|
||||
function zeitfresser_get_social_links() {
|
||||
return array(
|
||||
'facebook' => esc_html__( 'Facebook', 'zeitfresser' ),
|
||||
'instagram' => esc_html__( 'Instagram', 'zeitfresser' ),
|
||||
'youtube' => esc_html__( 'Youtube', 'zeitfresser' ),
|
||||
'linkedin' => esc_html__( 'LinkedIn', 'zeitfresser' ),
|
||||
'twitter' => esc_html__( 'Twitter', 'zeitfresser' ),
|
||||
'pinterest' => esc_html__( 'Pinterest', 'zeitfresser' ),
|
||||
'tiktok' => esc_html__( 'TikTok', 'zeitfresser' ),
|
||||
'mastodon' => esc_html__( 'Mastodon', 'zeitfresser' ),
|
||||
'github' => esc_html__( 'GitHub', 'zeitfresser' ),
|
||||
'matrix' => esc_html__( 'Matrix.org', 'zeitfresser' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_social_links' );
|
||||
|
||||
/**
|
||||
* Register social link customizer controls.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_social_links( $wp_customize ) {
|
||||
$social_links = zeitfresser_get_social_links();
|
||||
$social_links_title = '<hr/><h2>' . esc_html__( 'Social Links:', 'zeitfresser' ) . '</h2>';
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'social_links_title',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Daisy_Blog_Custom_Text(
|
||||
$wp_customize,
|
||||
'social_links_title',
|
||||
array(
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => $social_links_title,
|
||||
'priority' => 20,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$social_priority = 21;
|
||||
|
||||
foreach ( $social_links as $social_key => $social_label ) {
|
||||
$wp_customize->add_setting(
|
||||
'social_links_' . $social_key,
|
||||
array(
|
||||
'default' => zeitfresser_get_social_link_default( $social_key ),
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'social_links_' . $social_key,
|
||||
array(
|
||||
'label' => $social_label,
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'type' => 'url',
|
||||
'priority' => $social_priority++,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#customize-controls .control-section-button .accordion-section-title:hover,
|
||||
#customize-controls .control-section-button .accordion-section-title:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.control-section-button .accordion-section-title .button {
|
||||
margin-top: -4px;
|
||||
font-weight: 400;
|
||||
margin-left: 8px;
|
||||
background: #e45157;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.rtl .control-section-button .accordion-section-title .button {
|
||||
margin-left: 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
(function (api) {
|
||||
if (api != null) {
|
||||
// Extends our custom "upgrade-to-pro" section.
|
||||
api.sectionConstructor["button"] = api.Section.extend({
|
||||
// No events for this type of section.
|
||||
attachEvents: function () {},
|
||||
|
||||
// Always make the section active.
|
||||
isContextuallyActive: function () {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
} else {
|
||||
}
|
||||
})(wp.customize);
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Pro customizer section.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
class Daisy_Blog_Button_Control extends WP_Customize_Section {
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'button';
|
||||
|
||||
/**
|
||||
* Custom button text to output.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_text = '';
|
||||
|
||||
/**
|
||||
* Custom pro button URL.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_url = '';
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
|
||||
$json['pro_text'] = $this->pro_text;
|
||||
$json['pro_url'] = esc_url( $this->pro_url );
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Outputs the Underscore.js template.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function render_template() { ?>
|
||||
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
|
||||
<h3 class="accordion-section-title">
|
||||
{{ data.title }}
|
||||
|
||||
<# if ( data.pro_text && data.pro_url ) { #>
|
||||
<a href="{{ data.pro_url }}" class="button button-secondary alignright" target="_blank">{{ data.pro_text }}</a>
|
||||
<# } #>
|
||||
</h3>
|
||||
</li>
|
||||
<?php }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
if( class_exists( 'WP_Customize_control' ) ){
|
||||
|
||||
class Daisy_Blog_Custom_Text extends WP_Customize_Control
|
||||
{
|
||||
/**
|
||||
* Render the content on the theme customizer page
|
||||
*/
|
||||
public function render_content()
|
||||
{
|
||||
?>
|
||||
<label>
|
||||
<strong class="customize-text_editor"><?php echo wp_kses_post( $this->label ); ?></strong>
|
||||
<br />
|
||||
<span class="customize-text_editor_desc">
|
||||
<?php echo wp_kses_post( $this->description ); ?>
|
||||
</span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}//editor close
|
||||
|
||||
}//class close
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: multi-check
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Graphthemes_Multi_Check_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Adds a multicheck control.
|
||||
*/
|
||||
class Graphthemes_Multi_Check_Control extends Wp_Customize_Control {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'multi-check';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'graphthemes-multi-check', get_template_directory_uri() . '/inc/blocks/includes/multicheck/multi-check.js', array( 'jquery' ), false, true );
|
||||
}
|
||||
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<# if ( ! data.choices ) { return; } #>
|
||||
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.label ) { #>
|
||||
<span class="customize-control-title">{{ data.label }}</span>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
|
||||
<ul>
|
||||
<# for ( key in data.choices ) { #>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="{{ key }}"<# if ( _.contains( data.value, key ) ) { #> checked<# } #> />
|
||||
{{ data.choices[ key ] }}
|
||||
</label>
|
||||
</li>
|
||||
<# } #>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
wp.customize.controlConstructor['multi-check'] = wp.customize.Control.extend({
|
||||
|
||||
// When we're finished loading continue processing.
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this;
|
||||
|
||||
// Save the value
|
||||
control.container.on( 'change', 'input', function() {
|
||||
var value = [],
|
||||
i = 0;
|
||||
|
||||
// Build the value as an object using the sub-values from individual checkboxes.
|
||||
jQuery.each( control.params.choices, function( key, subValue ) {
|
||||
if ( control.container.find( 'input[value="' + key + '"]' ).is( ':checked' ) ) {
|
||||
value[ i ] = key;
|
||||
i++;
|
||||
}
|
||||
});
|
||||
|
||||
// Update the value in the customizer.
|
||||
control.setting.set( value );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_custom_controls' );
|
||||
function zeitfresser_register_custom_controls( $wp_customize ) {
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes/button/class-button-control.php';
|
||||
$wp_customize->register_control_type( 'Daisy_Blog_Button_Control' );
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes//custom-html/class-custom-html.php';
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes/toggle/class-toggle-control.php';
|
||||
$wp_customize->register_control_type( 'Graphthemes_Toggle_Control' );
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes//multicheck/class-multi-check-control.php';
|
||||
$wp_customize->register_control_type( 'Graphthemes_Multi_Check_Control' );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* Sanitize Google Fonts */
|
||||
function zeitfresser_sanitize_google_fonts( $input, $setting ) {
|
||||
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_sanitize_float( $input ) {
|
||||
return filter_var($input, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//checkbox sanitization function
|
||||
function zeitfresser_sanitize_checkbox( $input ) {
|
||||
//returns true if checkbox is checked
|
||||
return ( ( isset( $input ) && true == $input ) ? true : false );
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_sanitize_select( $input, $setting ) {
|
||||
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_sanitize_array( $value ){
|
||||
if ( is_array( $value ) ) {
|
||||
foreach ( $value as $key => $subvalue ) {
|
||||
$value[ $key ] = esc_attr( $subvalue );
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
return esc_attr( $value );
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<script type="text/javascript">
|
||||
var fb = '<?php echo esc_html__( "Facebook", 'zeitfresser' ); ?>';
|
||||
var twitter = '<?php echo esc_html__( "Twitter", 'zeitfresser' ); ?>';
|
||||
var pinterest = '<?php echo esc_html__( "Pinterest", 'zeitfresser' ); ?>';
|
||||
var linkedin = '<?php echo esc_html__( "Linkedin", 'zeitfresser' ); ?>';
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$url = urlencode(get_the_permalink());
|
||||
$title = html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8');
|
||||
$media = urlencode(get_the_post_thumbnail_url(get_the_ID(), 'full'));
|
||||
$twitter_id = get_theme_mod('twitter_id');
|
||||
|
||||
$social_share = $args;
|
||||
?>
|
||||
|
||||
<ul class="list-inline">
|
||||
|
||||
<li><?php esc_html_e( "Share", 'zeitfresser' ); ?>:</li>
|
||||
|
||||
<?php if( in_array( 'facebook', $social_share ) ) { ?>
|
||||
<li><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>" onclick="return ! window.open( this.href, fb, 'width=500, height=500' )">
|
||||
<svg version="1.1" viewBox="0 0 56.693 56.693" width="56.693px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M40.43,21.739h-7.645v-5.014c0-1.883,1.248-2.322,2.127-2.322c0.877,0,5.395,0,5.395,0V6.125l-7.43-0.029 c-8.248,0-10.125,6.174-10.125,10.125v5.518h-4.77v8.53h4.77c0,10.947,0,24.137,0,24.137h10.033c0,0,0-13.32,0-24.137h6.77 L40.43,21.739z"/></svg></a></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( in_array( 'twitter', $social_share ) ) { ?>
|
||||
<li><a href="https://twitter.com/intent/tweet?text=<?php echo $title; ?>&url=<?php echo $url; ?>&via=<?php echo esc_html( $twitter_id ); ?>" onclick="return ! window.open( this.href, twitter, 'width=500, height=500' )">
|
||||
<svg version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M492,109.5c-17.4,7.7-36,12.9-55.6,15.3c20-12,35.4-31,42.6-53.6c-18.7,11.1-39.4,19.2-61.5,23.5 C399.8,75.8,374.6,64,346.8,64c-53.5,0-96.8,43.4-96.8,96.9c0,7.6,0.8,15,2.5,22.1C172,179,100.6,140.4,52.9,81.7 c-8.3,14.3-13.1,31-13.1,48.7c0,33.6,17.1,63.3,43.1,80.7C67,210.7,52,206.3,39,199c0,0.4,0,0.8,0,1.2c0,47,33.4,86.1,77.7,95 c-8.1,2.2-16.7,3.4-25.5,3.4c-6.2,0-12.3-0.6-18.2-1.8c12.3,38.5,48.1,66.5,90.5,67.3c-33.1,26-74.9,41.5-120.3,41.5 c-7.8,0-15.5-0.5-23.1-1.4C62.9,432,113.8,448,168.4,448C346.6,448,444,300.3,444,172.2c0-4.2-0.1-8.4-0.3-12.5 C462.6,146,479,128.9,492,109.5z"/></svg>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( in_array( 'pinterest', $social_share ) ) { ?>
|
||||
<li><a href="http://pinterest.com/pin/create/button/?url=<?php echo $url; ?>&media=<?php echo $media; ?>&description=<?php echo esc_html( $title ); ?>" onclick="return ! window.open( this.href, pinterest, 'width=500, height=500' )">
|
||||
<svg viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M12.486,4.771c-4.23,0-6.363,3.033-6.363,5.562c0,1.533,0.581,2.894,1.823,3.401c0.205,0.084,0.387,0.004,0.446-0.221 c0.041-0.157,0.138-0.553,0.182-0.717c0.061-0.221,0.037-0.3-0.127-0.495c-0.359-0.422-0.588-0.972-0.588-1.747 c0-2.25,1.683-4.264,4.384-4.264c2.392,0,3.706,1.463,3.706,3.412c0,2.568-1.137,4.734-2.824,4.734 c-0.932,0-1.629-0.77-1.405-1.715c0.268-1.13,0.786-2.347,0.786-3.16c0-0.729-0.392-1.336-1.2-1.336 c-0.952,0-1.718,0.984-1.718,2.304c0,0.841,0.286,1.409,0.286,1.409s-0.976,4.129-1.146,4.852c-0.34,1.44-0.051,3.206-0.025,3.385 c0.013,0.104,0.149,0.131,0.21,0.051c0.088-0.115,1.223-1.517,1.607-2.915c0.111-0.396,0.627-2.445,0.627-2.445 c0.311,0.589,1.213,1.108,2.175,1.108c2.863,0,4.804-2.608,4.804-6.103C18.123,7.231,15.886,4.771,12.486,4.771z"/></g></svg>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( in_array( 'linkedin', $social_share ) ) { ?>
|
||||
<li><a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo esc_html( $title ); ?>" onclick="return ! window.open( this.href, linkedin, 'width=500, height=500' )">
|
||||
<svg baseProfile="tiny" version="1.2" viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M8,19H5V9h3V19z M19,19h-3v-5.342c0-1.392-0.496-2.085-1.479-2.085c-0.779,0-1.273,0.388-1.521,1.165C13,14,13,19,13,19h-3 c0,0,0.04-9,0-10h2.368l0.183,2h0.062c0.615-1,1.598-1.678,2.946-1.678c1.025,0,1.854,0.285,2.487,1.001 C18.683,11.04,19,12.002,19,13.353V19z"/></g><g><ellipse cx="6.5" cy="6.5" rx="1.55" ry="1.5"/></g></svg>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if( in_array( 'email', $social_share ) ) { ?>
|
||||
<li><a href="mailto:?subject=<?php echo esc_attr( $title ); ?>&body=<?php echo $title . " " . $url; ?>" target="_blank">
|
||||
<svg version="1.1" viewBox="0 0 100.354 100.352" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M93.09,76.224c0.047-0.145,0.079-0.298,0.079-0.459V22.638c0-0.162-0.032-0.316-0.08-0.462 c-0.007-0.02-0.011-0.04-0.019-0.06c-0.064-0.171-0.158-0.325-0.276-0.46c-0.008-0.009-0.009-0.02-0.017-0.029 c-0.005-0.005-0.011-0.007-0.016-0.012c-0.126-0.134-0.275-0.242-0.442-0.323c-0.013-0.006-0.023-0.014-0.036-0.02 c-0.158-0.071-0.33-0.111-0.511-0.123c-0.018-0.001-0.035-0.005-0.053-0.005c-0.017-0.001-0.032-0.005-0.049-0.005H8.465 c-0.017,0-0.033,0.004-0.05,0.005c-0.016,0.001-0.032,0.004-0.048,0.005c-0.183,0.012-0.358,0.053-0.518,0.125 c-0.01,0.004-0.018,0.011-0.028,0.015c-0.17,0.081-0.321,0.191-0.448,0.327c-0.005,0.005-0.011,0.006-0.016,0.011 c-0.008,0.008-0.009,0.019-0.017,0.028c-0.118,0.135-0.213,0.29-0.277,0.461c-0.008,0.02-0.012,0.04-0.019,0.061 c-0.048,0.146-0.08,0.3-0.08,0.462v53.128c0,0.164,0.033,0.32,0.082,0.468c0.007,0.02,0.011,0.039,0.018,0.059 c0.065,0.172,0.161,0.327,0.28,0.462c0.007,0.008,0.009,0.018,0.016,0.026c0.006,0.007,0.014,0.011,0.021,0.018 c0.049,0.051,0.103,0.096,0.159,0.14c0.025,0.019,0.047,0.042,0.073,0.06c0.066,0.046,0.137,0.083,0.21,0.117 c0.018,0.008,0.034,0.021,0.052,0.028c0.181,0.077,0.38,0.121,0.589,0.121h83.204c0.209,0,0.408-0.043,0.589-0.121 c0.028-0.012,0.054-0.03,0.081-0.044c0.062-0.031,0.124-0.063,0.181-0.102c0.03-0.021,0.057-0.048,0.086-0.071 c0.051-0.041,0.101-0.082,0.145-0.129c0.008-0.008,0.017-0.014,0.025-0.022c0.008-0.009,0.01-0.021,0.018-0.03 c0.117-0.134,0.211-0.288,0.275-0.458C93.078,76.267,93.083,76.246,93.09,76.224z M9.965,26.04l25.247,23.061L9.965,72.346V26.04z M61.711,47.971c-0.104,0.068-0.214,0.125-0.301,0.221c-0.033,0.036-0.044,0.083-0.073,0.121l-11.27,10.294L12.331,24.138h75.472 L61.711,47.971z M37.436,51.132l11.619,10.613c0.287,0.262,0.649,0.393,1.012,0.393s0.725-0.131,1.011-0.393l11.475-10.481 l25.243,23.002H12.309L37.436,51.132z M64.778,49.232L90.169,26.04v46.33L64.778,49.232z"/></svg></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</ul>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: toggle.
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Graphthemes_Toggle_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Toggle control (modified checkbox).
|
||||
*/
|
||||
class Graphthemes_Toggle_Control extends Wp_Customize_Control {
|
||||
|
||||
public $type = 'toggle';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'graphthemes-toggle', get_template_directory_uri() . '/inc/blocks/includes/toggle/toggle.css', null );
|
||||
wp_enqueue_script( 'graphthemes-toggle', get_template_directory_uri() . '/inc/blocks/includes/toggle/toggle.js', array( 'jquery' ), false, true ); //for toggle
|
||||
}
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
<label for="toggle_{{ data.id }}">
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<input {{{ data.inputAttrs }}} name="toggle_{{ data.id }}" id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( '1' == data.value ) { #> checked<# } #> hidden />
|
||||
<span class="switch"></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
.customize-control-toggle label {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.customize-control-toggle label .customize-control-title {
|
||||
width: calc(100% - 55px);
|
||||
}
|
||||
.customize-control-toggle label .description {
|
||||
order: 99;
|
||||
}
|
||||
.customize-control-toggle input[type="checkbox"] {
|
||||
display: none;
|
||||
}
|
||||
.customize-control-toggle .switch {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 12px;
|
||||
border-radius: 8px;
|
||||
background: #ccc;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: background 350ms ease;
|
||||
}
|
||||
.customize-control-toggle .switch:before, .customize-control-toggle .switch:after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -3px;
|
||||
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
}
|
||||
.customize-control-toggle .switch:before {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
transform: translate3d(0, -50%, 0) scale(0);
|
||||
}
|
||||
.customize-control-toggle .switch:after {
|
||||
background: #999;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
transform: translate3d(0, -50%, 0);
|
||||
}
|
||||
.customize-control-toggle .switch:active:before {
|
||||
transform: translate3d(0, -50%, 0) scale(3);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch {
|
||||
background: rgba(52, 152, 222, 0.3);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:before {
|
||||
background: rgba(52, 152, 222, 0.075);
|
||||
transform: translate3d(100%, -50%, 0) scale(1);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:after {
|
||||
background: #3498DE;
|
||||
transform: translate3d(100%, -50%, 0);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:active:before {
|
||||
background: rgba(52, 152, 222, 0.075);
|
||||
transform: translate3d(100%, -50%, 0) scale(3);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
wp.customize.controlConstructor['toggle'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
checkboxValue = control.setting._value;
|
||||
|
||||
// Save the value
|
||||
this.container.on( 'change', 'input', function() {
|
||||
checkboxValue = ( jQuery( this ).is( ':checked' ) ) ? true : false;
|
||||
control.setting.set( checkboxValue );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/* Default Post Detail Author*/
|
||||
function zeitfresser_get_default_post_detail_author() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Category*/
|
||||
function zeitfresser_get_default_post_detail_category() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Comment*/
|
||||
function zeitfresser_get_default_post_detail_comment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Detail Date*/
|
||||
function zeitfresser_get_default_post_detail_date() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Detail Featured Image*/
|
||||
function zeitfresser_get_default_post_detail_featured_image() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Tag*/
|
||||
function zeitfresser_get_default_post_detail_featured_image_size() {
|
||||
return esc_html__( 'large', 'zeitfresser' );
|
||||
}
|
||||
|
||||
/* Default Post Detail Tag*/
|
||||
function zeitfresser_get_default_post_detail_tag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Social Share */
|
||||
function zeitfresser_get_default_post_detail_social_share() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Social Share Options*/
|
||||
function zeitfresser_get_default_post_detail_social_share_options() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/* Default Post Detail Author Block Options */
|
||||
function zeitfresser_get_default_post_detail_author_block() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Related Articles Options*/
|
||||
function zeitfresser_get_default_post_detail_related_articles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Detail Related Articles Title */
|
||||
function zeitfresser_get_default_post_detail_related_articles_title() {
|
||||
return esc_html__( "Related Articles", 'zeitfresser' );
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* Post detail defaults only.
|
||||
*
|
||||
* The frontend still uses these defaults, but the related controls are intentionally
|
||||
* hidden to keep the customizer lean for the Zeitfresser setup.
|
||||
*/
|
||||
|
||||
require dirname( __FILE__ ) . '/default-post-detail.php';
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/* Default Post Snippet Author*/
|
||||
function zeitfresser_get_default_post_snippet_author() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Category*/
|
||||
function zeitfresser_get_default_post_snippet_category() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Comment*/
|
||||
function zeitfresser_get_default_post_snippet_comment() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Date*/
|
||||
function zeitfresser_get_default_post_snippet_date() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Featured Image*/
|
||||
function zeitfresser_get_default_post_snippet_featured_image() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Tag*/
|
||||
function zeitfresser_get_default_post_snippet_featured_image_size() {
|
||||
return esc_html__( 'thumbnail', 'zeitfresser' );
|
||||
}
|
||||
|
||||
/* Default Post Snippet Tag*/
|
||||
function zeitfresser_get_default_post_snippet_tag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Excerpt Szie */
|
||||
function zeitfresser_get_default_post_snippet_excerpt_size() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Read More */
|
||||
function zeitfresser_get_default_post_snippet_show_hide_read_more() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Read More Text */
|
||||
function zeitfresser_get_default_post_snippet_read_more_text() {
|
||||
return esc_html__( "Read More", 'zeitfresser' );
|
||||
}
|
||||
|
||||
/* Default Post Snippet Social Share */
|
||||
function zeitfresser_get_default_post_snippet_social_share() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Social Share Options*/
|
||||
function zeitfresser_get_default_post_snippet_social_share_options() {
|
||||
return array();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_post_snippet_excerpt_size' );
|
||||
function zeitfresser_post_snippet_excerpt_size( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'post_snippet_excerpt_size', array(
|
||||
'sanitize_callback' => 'absint',
|
||||
'default' => zeitfresser_get_default_post_snippet_excerpt_size()
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'post_snippet_excerpt_size', array(
|
||||
'settings' => 'post_snippet_excerpt_size',
|
||||
'type' => 'number',
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => esc_html__( 'Excerpt Size', 'zeitfresser' ),
|
||||
'priority' => 11,
|
||||
'input_attrs' => array(
|
||||
'min' => 5,
|
||||
'max' => 80,
|
||||
),
|
||||
) );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Post snippet customizer section.
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_post_snippet_customization_section' );
|
||||
|
||||
/**
|
||||
* Register the post snippet section.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_register_post_snippet_customization_section( $wp_customize ) {
|
||||
$wp_customize->add_section(
|
||||
'daisy_blog_post_snippet_customization_section',
|
||||
array(
|
||||
'title' => esc_html__( 'Post Snippet', 'zeitfresser' ),
|
||||
'priority' => 22,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/default-post-snippet.php';
|
||||
require dirname( __FILE__ ) . '/excerpt/excerpt.php';
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* Default Site Title Show Hide Option */
|
||||
function zeitfresser_get_default_site_title_show_hide() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Site Tagline Show Hide Option */
|
||||
function zeitfresser_get_default_site_tagline_show_hide() {
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/* Default Site Identity Settings */
|
||||
require dirname( __FILE__ ) . '/default-site-identity.php';
|
||||
|
||||
|
||||
require dirname( __FILE__ ) . '/site-title/site-title.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/site-tagline/site-tagline.php';
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_show_hide_site_tagline' );
|
||||
function zeitfresser_show_hide_site_tagline( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'show_hide_site_tagline', array(
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_checkbox',
|
||||
'default' => zeitfresser_get_default_site_tagline_show_hide()
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new Graphthemes_Toggle_Control( $wp_customize, 'show_hide_site_tagline', array(
|
||||
'label' => esc_html__( 'Show/Hide Site Tagline','zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'settings' => 'show_hide_site_tagline',
|
||||
'type'=> 'toggle',
|
||||
) ) );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_show_hide_site_title' );
|
||||
function zeitfresser_show_hide_site_title( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'show_hide_site_title', array(
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_checkbox',
|
||||
'default' => zeitfresser_get_default_site_title_show_hide(),
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new Graphthemes_Toggle_Control( $wp_customize, 'show_hide_site_title', array(
|
||||
'label' => esc_html__( 'Show/Hide Site Title','zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'settings' => 'show_hide_site_title',
|
||||
'type'=> 'toggle',
|
||||
) ) );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Sample implementation of the Custom Header feature
|
||||
*
|
||||
* You can add an optional custom header image to header.php like so ...
|
||||
*
|
||||
<?php the_header_image_tag(); ?>
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/functionality/custom-headers/
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set up the WordPress core custom header feature.
|
||||
*
|
||||
* @uses zeitfresser_header_style()
|
||||
*/
|
||||
function zeitfresser_custom_header_setup() {
|
||||
add_theme_support(
|
||||
'custom-header',
|
||||
apply_filters(
|
||||
'daisy_blog_custom_header_args',
|
||||
array(
|
||||
'default-image' => '',
|
||||
'default-text-color' => '444444',
|
||||
'width' => 1000,
|
||||
'height' => 250,
|
||||
'flex-height' => true,
|
||||
'wp-head-callback' => 'zeitfresser_header_style',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_custom_header_setup' );
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_header_style' ) ) :
|
||||
/**
|
||||
* Styles the header image and text displayed on the blog.
|
||||
*
|
||||
* @see zeitfresser_custom_header_setup().
|
||||
*/
|
||||
function zeitfresser_header_style() {
|
||||
$header_text_color = get_header_textcolor();
|
||||
|
||||
/*
|
||||
* If no custom options for text are set, let's bail.
|
||||
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
|
||||
*/
|
||||
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we get this far, we have custom styles. Let's do this.
|
||||
?>
|
||||
<style type="text/css">
|
||||
<?php
|
||||
// Has the text been hidden?
|
||||
if ( ! display_header_text() ) :
|
||||
?>
|
||||
.site-title,
|
||||
.site-description {
|
||||
position: absolute;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
}
|
||||
<?php
|
||||
// If the user has set a custom color for the text use that.
|
||||
else :
|
||||
?>
|
||||
.site-title a,
|
||||
.site-description {
|
||||
color: #<?php echo esc_attr( $header_text_color ); ?>;
|
||||
}
|
||||
<?php endif; ?>
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* daisy blog Theme Customizer
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add postMessage support for site title and description for the Theme Customizer.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
||||
*/
|
||||
function zeitfresser_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' => 'zeitfresser_customize_partial_blogname',
|
||||
)
|
||||
);
|
||||
$wp_customize->selective_refresh->add_partial(
|
||||
'blogdescription',
|
||||
array(
|
||||
'selector' => '.site-description',
|
||||
'render_callback' => 'zeitfresser_customize_partial_blogdescription',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'customize_register', 'zeitfresser_customize_register' );
|
||||
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function zeitfresser_customize_preview_js() {
|
||||
wp_enqueue_script( 'zeitfresser-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), ZEITFRESSER_VERSION, true );
|
||||
}
|
||||
add_action( 'customize_preview_init', 'zeitfresser_customize_preview_js' );
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
|
||||
if( ! defined( 'DAISY_BLOG_WIDGET_PATH' ) ) {
|
||||
define( 'DAISY_BLOG_WIDGET_PATH', dirname( __FILE__ ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Author Profile Widget.
|
||||
*/
|
||||
require_once DAISY_BLOG_WIDGET_PATH . '/includes/class-graphthemes-widget-functions.php';
|
||||
|
||||
require_once DAISY_BLOG_WIDGET_PATH . '/includes/widgets/widget-author-profile.php';
|
||||
|
||||
require_once DAISY_BLOG_WIDGET_PATH . '/includes/widgets/widget-recent-posts.php';
|
||||
|
||||
require_once DAISY_BLOG_WIDGET_PATH . '/includes/widgets/widget-popular-posts.php';
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class Graphthemes_Widget_Functions {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
||||
}
|
||||
|
||||
public function enqueue_admin_scripts() {
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script( 'graphthemes-widgets-admin-scripts', get_template_directory_uri() . '/inc/graphthemes-widgets/includes/js/graphthemes-widgets-admin.js', array( 'jquery' ), ZEITFRESSER_VERSION , true );
|
||||
}
|
||||
|
||||
public function zeitfresser_widget_get_attachment_id( $url ) {
|
||||
$attachment_id = 0;
|
||||
$dir = wp_upload_dir();
|
||||
if ( false !== strpos( $url, $dir['baseurl'] . '/' ) ) { // Is URL in uploads directory?
|
||||
$file = basename( $url );
|
||||
$query_args = array(
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'fields' => 'ids',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'value' => $file,
|
||||
'compare' => 'LIKE',
|
||||
'key' => '_wp_attachment_metadata',
|
||||
),
|
||||
)
|
||||
);
|
||||
$query = new WP_Query( $query_args );
|
||||
if ( $query->have_posts() ) {
|
||||
foreach ( $query->posts as $post_id ) {
|
||||
$meta = wp_get_attachment_metadata( $post_id );
|
||||
$original_file = basename( $meta['file'] );
|
||||
$cropped_image_files = wp_list_pluck( $meta['sizes'], 'file' );
|
||||
if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
|
||||
$attachment_id = $post_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $attachment_id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$obj = new Graphthemes_Widget_Functions;
|
||||
@@ -0,0 +1,36 @@
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
$(document).on("click", ".upload_image_button", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $button = $(this);
|
||||
|
||||
|
||||
// Create the media frame.
|
||||
var file_frame = wp.media.frames.file_frame = wp.media({
|
||||
title: 'Select or upload image',
|
||||
library: { // remove these to show all
|
||||
type: 'image' // specific mime
|
||||
},
|
||||
button: {
|
||||
text: 'Select'
|
||||
},
|
||||
multiple: false // Set to true to allow multiple files to be selected
|
||||
});
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
file_frame.on('select', function () {
|
||||
// We set multiple to false so only get one image from the uploader
|
||||
|
||||
var attachment = file_frame.state().get('selection').first().toJSON();
|
||||
$button.siblings('input').val(attachment.url).trigger('change');
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Finally, open the modal
|
||||
file_frame.open();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,285 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget Author Profile
|
||||
*/
|
||||
|
||||
// register Author Profile Widget
|
||||
function zeitfresser_register_author_profile_widget() {
|
||||
register_widget( 'Graphthemes_Author_Profile' );
|
||||
}
|
||||
add_action( 'widgets_init', 'zeitfresser_register_author_profile_widget' );
|
||||
|
||||
if( ! class_exists( 'Graphthemes_Author_Profile' ) ) :
|
||||
/**
|
||||
* Adds Graphthemes_Author_Profile widget.
|
||||
*/
|
||||
class Graphthemes_Author_Profile extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Register widget with WordPress.
|
||||
*/
|
||||
function __construct() {
|
||||
parent::__construct(
|
||||
'daisy_blog_widget_author_profile', // Base ID
|
||||
__( 'Graphthemes: Author Profile', 'zeitfresser' ), // Name
|
||||
array( 'description' => __( 'An Author Profile Widget', 'zeitfresser' ), ) // Args
|
||||
);
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
||||
$name = ! empty( $instance['name'] ) ? $instance['name'] : '';
|
||||
$email = ! empty( $instance['email'] ) ? $instance['email'] : '';
|
||||
$content = ! empty( $instance['content'] ) ? $instance['content'] : '';
|
||||
$image = ! empty( $instance['image'] ) ? $instance['image'] : '';
|
||||
$author_image = ! empty( $instance['author-image'] ) ? $instance['author-image'] : '';
|
||||
$label = ! empty( $instance['label'] ) ? $instance['label'] : '';
|
||||
$link = ! empty( $instance['link'] ) ? $instance['link'] : '';
|
||||
$target = ! empty( $instance['target'] ) ? $instance['target'] : '';
|
||||
$attachment_id = $image;
|
||||
$social_facebook = ! empty( $instance['social-facebook'] ) ? $instance['social-facebook'] : '';
|
||||
$social_linkedin = ! empty( $instance['social-linkedin'] ) ? $instance['social-linkedin'] : '';
|
||||
$social_twitter = ! empty( $instance['social-twitter'] ) ? $instance['social-twitter'] : '';
|
||||
$social_instagram = ! empty( $instance['social-instagram'] ) ? $instance['social-instagram'] : '';
|
||||
|
||||
if ( !filter_var( $image, FILTER_VALIDATE_URL ) === false ) {
|
||||
$attachment_id = $obj->zeitfresser_widget_get_attachment_id( $image );
|
||||
}
|
||||
|
||||
$option = ! empty( $instance['author-image-option'] ) ? $instance['author-image-option'] : 'gravatar';
|
||||
|
||||
if( $attachment_id ){
|
||||
$author_bio_img_size = apply_filters('author_bio_img_size','thumbnail');
|
||||
}
|
||||
|
||||
|
||||
echo $args['before_widget'];
|
||||
ob_start();
|
||||
|
||||
if( $title ) {
|
||||
echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title'];
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="graphthemes-widget-author-bio-holder">
|
||||
<div class="image-holder">
|
||||
<?php
|
||||
if( $option == 'gravatar' ){
|
||||
echo get_avatar( $email, 300 );
|
||||
}
|
||||
elseif( $option == 'photo' && $author_image ) { ?>
|
||||
<img src="<?php echo esc_url( $author_image ); ?>">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="text-holder">
|
||||
<H5 class="title-holder"><?php echo esc_html( $name ); ?></H5>
|
||||
<div class="author-bio-content">
|
||||
<?php echo wpautop( wp_kses_post( $content ) ); ?>
|
||||
</div>
|
||||
|
||||
<?php if( $link && $label ){ ?>
|
||||
<a <?php if( isset( $instance['target'] ) && $instance['target']=='1' ){ echo "target=_blank"; } ?> href="<?php echo esc_url( $link ); ?>" class="btn-readmore"><?php echo esc_html( $label );?></a>
|
||||
<?php } ?>
|
||||
|
||||
<div class="author-bio-socicons social-share">
|
||||
<ul class="list-group list-group-horizontal list-inline">
|
||||
<?php if( isset( $instance['social-facebook'] ) && $instance['social-facebook'] ){ ?>
|
||||
|
||||
<li class="social-share-list list-group-item facebook-svg">
|
||||
<a target="_blank" href="<?php echo esc_url( $instance['social-facebook'] );?>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"/></svg>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if( isset( $instance['social-linkedin'] ) && $instance['social-linkedin'] ){ ?>
|
||||
|
||||
|
||||
<li class="social-share-list list-group-item linkedin-svg">
|
||||
<a target="_blank" href="<?php echo esc_url( $instance['social-linkedin'] );?>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"/></svg>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if( isset( $instance['social-twitter'] ) && $instance['social-twitter'] ){ ?>
|
||||
|
||||
|
||||
<li class="social-share-list list-group-item twitter-svg">
|
||||
<a target="_blank" href="<?php echo esc_url( $instance['social-twitter'] );?>">
|
||||
<svg version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M492,109.5c-17.4,7.7-36,12.9-55.6,15.3c20-12,35.4-31,42.6-53.6c-18.7,11.1-39.4,19.2-61.5,23.5 C399.8,75.8,374.6,64,346.8,64c-53.5,0-96.8,43.4-96.8,96.9c0,7.6,0.8,15,2.5,22.1C172,179,100.6,140.4,52.9,81.7 c-8.3,14.3-13.1,31-13.1,48.7c0,33.6,17.1,63.3,43.1,80.7C67,210.7,52,206.3,39,199c0,0.4,0,0.8,0,1.2c0,47,33.4,86.1,77.7,95 c-8.1,2.2-16.7,3.4-25.5,3.4c-6.2,0-12.3-0.6-18.2-1.8c12.3,38.5,48.1,66.5,90.5,67.3c-33.1,26-74.9,41.5-120.3,41.5 c-7.8,0-15.5-0.5-23.1-1.4C62.9,432,113.8,448,168.4,448C346.6,448,444,300.3,444,172.2c0-4.2-0.1-8.4-0.3-12.5 C462.6,146,479,128.9,492,109.5z"/></svg>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if( isset( $instance['social-instagram'] ) && $instance['social-instagram'] ){ ?>
|
||||
|
||||
|
||||
<li class="social-share-list list-group-item instagram-svg">
|
||||
<a target="_blank" href="<?php echo esc_url( $instance['social-instagram'] );?>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-instagram" viewBox="0 0 16 16"> <path d="M8 0C5.829 0 5.556.01 4.703.048 3.85.088 3.269.222 2.76.42a3.917 3.917 0 0 0-1.417.923A3.927 3.927 0 0 0 .42 2.76C.222 3.268.087 3.85.048 4.7.01 5.555 0 5.827 0 8.001c0 2.172.01 2.444.048 3.297.04.852.174 1.433.372 1.942.205.526.478.972.923 1.417.444.445.89.719 1.416.923.51.198 1.09.333 1.942.372C5.555 15.99 5.827 16 8 16s2.444-.01 3.298-.048c.851-.04 1.434-.174 1.943-.372a3.916 3.916 0 0 0 1.416-.923c.445-.445.718-.891.923-1.417.197-.509.332-1.09.372-1.942C15.99 10.445 16 10.173 16 8s-.01-2.445-.048-3.299c-.04-.851-.175-1.433-.372-1.941a3.926 3.926 0 0 0-.923-1.417A3.911 3.911 0 0 0 13.24.42c-.51-.198-1.092-.333-1.943-.372C10.443.01 10.172 0 7.998 0h.003zm-.717 1.442h.718c2.136 0 2.389.007 3.232.046.78.035 1.204.166 1.486.275.373.145.64.319.92.599.28.28.453.546.598.92.11.281.24.705.275 1.485.039.843.047 1.096.047 3.231s-.008 2.389-.047 3.232c-.035.78-.166 1.203-.275 1.485a2.47 2.47 0 0 1-.599.919c-.28.28-.546.453-.92.598-.28.11-.704.24-1.485.276-.843.038-1.096.047-3.232.047s-2.39-.009-3.233-.047c-.78-.036-1.203-.166-1.485-.276a2.478 2.478 0 0 1-.92-.598 2.48 2.48 0 0 1-.6-.92c-.109-.281-.24-.705-.275-1.485-.038-.843-.046-1.096-.046-3.233 0-2.136.008-2.388.046-3.231.036-.78.166-1.204.276-1.486.145-.373.319-.64.599-.92.28-.28.546-.453.92-.598.282-.11.705-.24 1.485-.276.738-.034 1.024-.044 2.515-.045v.002zm4.988 1.328a.96.96 0 1 0 0 1.92.96.96 0 0 0 0-1.92zm-4.27 1.122a4.109 4.109 0 1 0 0 8.217 4.109 4.109 0 0 0 0-8.217zm0 1.441a2.667 2.667 0 1 1 0 5.334 2.667 2.667 0 0 1 0-5.334z"/> </svg>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$html = ob_get_clean();
|
||||
echo apply_filters( 'daisy_blog_widget_author_profile_widget_filter', $html, $args, $instance );
|
||||
echo $args['after_widget'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function form( $instance ) {
|
||||
$obj = new Graphthemes_Widget_Functions();
|
||||
|
||||
$email = get_option('admin_email');
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
||||
$name = ! empty( $instance['name'] ) ? $instance['name'] : '';
|
||||
$email = ! empty( $instance['email'] ) ? $instance['email'] : sanitize_email( $email );
|
||||
$content = ! empty( $instance['content'] ) ? $instance['content'] : '';
|
||||
$image = ! empty( $instance['image'] ) ? $instance['image'] : '';
|
||||
$author_image = ! empty( $instance['author-image'] ) ? $instance['author-image'] : '';
|
||||
$label = ! empty( $instance['label'] ) ? $instance['label'] : '';
|
||||
$link = ! empty( $instance['link'] ) ? $instance['link'] : '';
|
||||
$target = ! empty( $instance['target'] ) ? $instance['target'] : 0;
|
||||
$socicon = ! empty( $instance['socicon'] ) ? $instance['socicon'] : '';
|
||||
$option = ! empty( $instance['author-image-option'] ) ? $instance['author-image-option'] : 'gravatar';
|
||||
$social_facebook = ! empty( $instance['social-facebook'] ) ? $instance['social-facebook'] : '';
|
||||
$social_linkedin = ! empty( $instance['social-linkedin'] ) ? $instance['social-linkedin'] : '';
|
||||
$social_twitter = ! empty( $instance['social-twitter'] ) ? $instance['social-twitter'] : '';
|
||||
$social_instagram = ! empty( $instance['social-instagram'] ) ? $instance['social-instagram'] : '';
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>"><?php esc_html_e( 'Author Name', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'name' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'name' ) ); ?>" type="text" value="<?php echo esc_attr( $name ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label><?php esc_html_e('Display photo from:','zeitfresser'); ?></label>
|
||||
|
||||
<input class="author-image" type="radio" name="<?php echo esc_attr( $this->get_field_name( 'author-image-option' ) );?>" id="<?php echo esc_attr( $this->get_field_id( 'author-image-option' . '-gravatar' ) );?>" value="gravatar" <?php if( $option == 'gravatar' ) echo 'checked'; ?> />
|
||||
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'author-image-option' . '-gravatar' ) );?>" class="radio-btn-wrap"><?php esc_html_e('Gravatar', 'zeitfresser');?></label>
|
||||
|
||||
<input class="author-image" type="radio" name="<?php echo esc_attr( $this->get_field_name( 'author-image-option' ) );?>" id="<?php echo esc_attr( $this->get_field_id( 'author-image-option' . '-photo' ) );?>" value="photo" <?php if( $option == 'photo' ) echo 'checked'; ?> />
|
||||
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'author-image-option' . '-photo' ) );?>" class="radio-btn-wrap"><?php esc_html_e('Uploaded Photo','zeitfresser');?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input class="widefat author_image_url" id="<?php echo $this->get_field_id( 'author-image' ); ?>" name="<?php echo $this->get_field_name( 'author-image' ); ?>" type="text" value="<?php echo esc_url( $author_image ); ?>" />
|
||||
<button class="upload_image_button button button-primary"><?php esc_html_e( "Select Image", 'zeitfresser' ); ?></button>
|
||||
</p>
|
||||
|
||||
<p class="author-email">
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>"><?php esc_html_e( 'Author Email', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" type="text" value="<?php echo esc_attr( $email ); ?>" />
|
||||
</p>
|
||||
<div class="widget-side-note" class="example-text"><?php $grav_link = '<a href=' . esc_url( get_avatar_url( $email ) ) . ' target="_blank">' . esc_html__( "Gravatar", 'zeitfresser' ) . '</a>'; echo sprintf( __( 'You can show your %1$s image instead of manually uploading your photo. Just add your gravatar registered email address here.','zeitfresser'), $grav_link );?></div>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'content' ) ); ?>"><?php esc_html_e( 'Description', 'zeitfresser' ); ?></label>
|
||||
<textarea name="<?php echo esc_attr( $this->get_field_name( 'content' ) ); ?>" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'content' ) ); ?>"><?php echo wp_kses_post( $content ); ?></textarea>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'label' ) ); ?>"><?php esc_html_e( 'Button Label', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'label' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'label' ) ); ?>" type="text" value="<?php echo esc_attr( $label ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'link' ) ); ?>"><?php esc_html_e( 'Button Link', 'zeitfresser' ); ?></label>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'link' ) ); ?>" type="text" value="<?php echo esc_url( $link ); ?>" />
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'target' ) ); ?>" <?php $j='0'; if( isset( $instance['target'] ) ){ $j='1'; } ?> value="1" <?php checked( $j, true ); ?> name="<?php echo esc_attr( $this->get_field_name( 'target' ) ); ?>" type="checkbox" />
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'target' ) ); ?>"><?php esc_html_e( 'Open in New Tab', 'zeitfresser' ); ?></label>
|
||||
</p>
|
||||
|
||||
|
||||
<div class="widget-social-profile">
|
||||
<label><h3><?php esc_html_e( "Social Profile", 'zeitfresser' ); ?></h3></label>
|
||||
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'social-facebook' ) ); ?>"><?php esc_html_e( 'Facebook Profile', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'social-facebook' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'social-facebook' ) ); ?>" type="text" value="<?php echo esc_attr( $social_facebook ); ?>" />
|
||||
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'social-linkedin' ) ); ?>"><?php esc_html_e( 'LinkedIn Profile', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'social-linkedin' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'social-linkedin' ) ); ?>" type="text" value="<?php echo esc_attr( $social_linkedin ); ?>" />
|
||||
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'social-twitter' ) ); ?>"><?php esc_html_e( 'Twitter Profile', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'social-twitter' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'social-twitter' ) ); ?>" type="text" value="<?php echo esc_attr( $social_twitter ); ?>" />
|
||||
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'social-instagram' ) ); ?>"><?php esc_html_e( 'Instagram Profile', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'social-instagram' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'social-instagram' ) ); ?>" type="text" value="<?php echo esc_attr( $social_instagram ); ?>" />
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize widget form values as they are saved.
|
||||
*
|
||||
* @see WP_Widget::update()
|
||||
*
|
||||
* @param array $new_instance Values just sent to be saved.
|
||||
* @param array $old_instance Previously saved values from database.
|
||||
*
|
||||
* @return array Updated safe values to be saved.
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
|
||||
$instance = array();
|
||||
$email = get_option('admin_email');
|
||||
|
||||
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : "";
|
||||
$instance['name'] = ! empty( $new_instance['name'] ) ? sanitize_text_field( $new_instance['name'] ) : "" ;
|
||||
$instance['email'] = ! empty( $new_instance['email'] ) ? sanitize_email( $new_instance['email'] ) : $email;
|
||||
$instance['content'] = ! empty( $new_instance['content'] ) ? wp_kses_post( $new_instance['content'] ) : '';
|
||||
$instance['image'] = ! empty( $new_instance['image'] ) ? esc_url( $new_instance['image'] ) : '';
|
||||
$instance['author-image'] = ! empty( $new_instance['author-image'] ) ? esc_url( $new_instance['author-image'] ) : '';
|
||||
$instance['label'] = ! empty( $new_instance['label'] ) ? wp_kses_post( $new_instance['label'] ) : '';
|
||||
$instance['link'] = ! empty( $new_instance['link'] ) ? esc_url( $new_instance['link'] ) : '';
|
||||
$instance['target'] = ! empty( $new_instance['target'] ) ? absint( $new_instance['target'] ) : 0;
|
||||
$instance['socicon'] = ! empty( $new_instance['socicon'] ) ? wp_kses_post( $new_instance['socicon'] ) : '';
|
||||
$instance['author-image-option'] = ! empty( $new_instance['author-image-option'] ) ? wp_kses_post( $new_instance['author-image-option'] ) : '';
|
||||
$instance['social-facebook'] = ! empty( $new_instance['social-facebook'] ) ? esc_url( $new_instance['social-facebook'] ) : '';
|
||||
$instance['social-linkedin'] = ! empty( $new_instance['social-linkedin'] ) ? esc_url( $new_instance['social-linkedin'] ) : '';
|
||||
$instance['social-twitter'] = ! empty( $new_instance['social-twitter'] ) ? esc_url( $new_instance['social-twitter'] ) : '';
|
||||
$instance['social-instagram'] = ! empty( $new_instance['social-instagram'] ) ? wp_kses_post( $new_instance['social-instagram'] ) : '';
|
||||
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
/**
|
||||
* Widget Popular Post
|
||||
*
|
||||
* @package Graphthemes_Widget
|
||||
*/
|
||||
|
||||
// register Graphthemes_Widget_Popular_Post widget
|
||||
function zeitfresser_register_popular_post_widget() {
|
||||
register_widget( 'Graphthemes_Widget_Popular_Post' );
|
||||
}
|
||||
add_action( 'widgets_init', 'zeitfresser_register_popular_post_widget' );
|
||||
|
||||
if( ! class_exists( 'Graphthemes_Widget_Popular_Post' ) ) :
|
||||
/**
|
||||
* Adds Graphthemes_Widget_Popular_Post widget.
|
||||
*/
|
||||
class Graphthemes_Widget_Popular_Post extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Register widget with WordPress.
|
||||
*/
|
||||
function __construct(){
|
||||
if( ! is_customize_preview() ) add_action('wp', array( $this, 'zeitfresser_set_views' ) );
|
||||
|
||||
parent::__construct(
|
||||
'daisy_blog_widget_popular_post', // Base ID
|
||||
esc_html__( 'Graphthemes: Popular Post', 'zeitfresser' ), // Name
|
||||
array( 'description' => esc_html__( 'A Popular Post Widget', 'zeitfresser' ), ) // Args
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add the post view count
|
||||
*/
|
||||
function zeitfresser_set_views( $post_id ) {
|
||||
if ( in_the_loop() ) {
|
||||
$post_id = get_the_ID();
|
||||
}
|
||||
else {
|
||||
global $wp_query;
|
||||
$post_id = $wp_query->get_queried_object_id();
|
||||
}
|
||||
if( is_singular( 'post' ) )
|
||||
{
|
||||
$count_key = '_daisy_blog_view_count';
|
||||
$count = get_post_meta( $post_id, $count_key, true );
|
||||
if( $count == '' ){
|
||||
$count = 0;
|
||||
delete_post_meta( $post_id, $count_key );
|
||||
add_post_meta( $post_id, $count_key, '1' );
|
||||
}else{
|
||||
$count++;
|
||||
update_post_meta( $post_id, $count_key, $count );
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Function to get the post view count
|
||||
*/
|
||||
function zeitfresser_get_views( $post_id ){
|
||||
$count_key = '_daisy_blog_view_count';
|
||||
$count = get_post_meta( $post_id, $count_key, true );
|
||||
if( $count == '' ){
|
||||
return __( "0 View", 'zeitfresser' );
|
||||
}elseif($count<=1){
|
||||
return $count. __(' View', 'zeitfresser' );
|
||||
}else{
|
||||
return $count. __(' Views', 'zeitfresser' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Front-end display of widget.
|
||||
*
|
||||
* @see WP_Widget::widget()
|
||||
*
|
||||
* @param array $args Widget arguments.
|
||||
* @param array $instance Saved values from database.
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Popular Posts', 'zeitfresser' );
|
||||
$num_post = ! empty( $instance['num_post'] ) ? $instance['num_post'] : 3 ;
|
||||
$show_thumbnail = ! empty( $instance['show_thumbnail'] ) ? $instance['show_thumbnail'] : '';
|
||||
$show_date = ! empty( $instance['show_postdate'] ) ? $instance['show_postdate'] : '';
|
||||
$based_on = ! empty( $instance['based_on'] ) ? $instance['based_on'] : 'views';
|
||||
$comment_num = ! empty( $instance['comment_num'] ) ? $instance['comment_num'] : '';
|
||||
$view_count = ! empty( $instance['view_count'] ) ? $instance['view_count'] : '';
|
||||
$style = ! empty( $instance['style'] ) ? $instance['style'] : 'style-one';
|
||||
|
||||
$cat = get_theme_mod( 'exclude_categories' );
|
||||
if( $cat ) $cat = array_diff( array_unique( $cat ), array('') );
|
||||
|
||||
$arg = array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => $num_post,
|
||||
'ignore_sticky_posts' => true,
|
||||
'no_found_rows' => true,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
'category__not_in' => $cat
|
||||
);
|
||||
|
||||
if( $based_on == 'views' ){
|
||||
$arg['orderby'] = 'meta_value_num';
|
||||
$arg['meta_key'] = '_daisy_blog_view_count';
|
||||
}elseif( $based_on == 'comments' ){
|
||||
$arg['orderby'] = 'comment_count';
|
||||
}
|
||||
|
||||
$obj = new Graphthemes_Widget_Functions;
|
||||
|
||||
$daisy_blog_widget_popular_post_size = apply_filters('daisy_blog_widget_popular_post_size', 'thumbnail');
|
||||
$arg['no_found_rows'] = true;
|
||||
$arg['update_post_meta_cache'] = false;
|
||||
$arg['update_post_term_cache'] = false;
|
||||
$qry = new WP_Query( $arg );
|
||||
|
||||
if( $qry->have_posts() ){
|
||||
|
||||
echo $args['before_widget'];
|
||||
ob_start();
|
||||
|
||||
if( $title ) echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title'];
|
||||
|
||||
$target = 'target="_self"';
|
||||
if( isset($instance['target']) && $instance['target']!='' )
|
||||
{
|
||||
$target = 'target="_blank"';
|
||||
}
|
||||
?>
|
||||
<ul>
|
||||
<?php
|
||||
while( $qry->have_posts() ){
|
||||
$qry->the_post();
|
||||
?>
|
||||
<li>
|
||||
<?php
|
||||
if( $show_thumbnail ){ ?>
|
||||
<a <?php echo $target;?> href="<?php the_permalink();?>" class="post-thumbnail">
|
||||
<?php
|
||||
if( has_post_thumbnail() && $show_thumbnail ){
|
||||
the_post_thumbnail( $daisy_blog_widget_popular_post_size, array( 'itemprop' => 'image' ) );
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<?php }
|
||||
?>
|
||||
<div class="entry-header">
|
||||
<h6 class="entry-title"><a <?php echo $target;?> href="<?php the_permalink(); ?>"><?php the_title();?></a></h6>
|
||||
|
||||
<?php if( $show_date ){ ?>
|
||||
<div class="entry-meta info">
|
||||
<?php
|
||||
$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( DATE_W3C ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( DATE_W3C ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
);
|
||||
?>
|
||||
<?php echo $time_string; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if( $based_on == 'views' && $view_count ){ ?>
|
||||
<span class="view-count"><?php echo esc_html( $this->zeitfresser_get_views( get_the_ID() ) );?></span>
|
||||
<?php }
|
||||
elseif( $based_on == 'comments' && $comment_num ){ ?>
|
||||
<span class="comment-count"><i class="fa fa-comment" aria-hidden="true"></i><?php echo absint( get_comments_number() ); ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
$html = ob_get_clean();
|
||||
echo apply_filters( 'daisy_blog_widget_popular_post_widget_filter', $html, $args, $instance );
|
||||
echo $args['after_widget'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Back-end widget form.
|
||||
*
|
||||
* @see WP_Widget::form()
|
||||
*
|
||||
* @param array $instance Previously saved values from database.
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Popular Posts', 'zeitfresser' );
|
||||
$num_post = ! empty( $instance['num_post'] ) ? $instance['num_post'] : 3 ;
|
||||
$show_thumbnail = ! empty( $instance['show_thumbnail'] ) ? $instance['show_thumbnail'] : '';
|
||||
$show_postdate = ! empty( $instance['show_postdate'] ) ? $instance['show_postdate'] : '';
|
||||
$based_on = ! empty( $instance['based_on'] ) ? $instance['based_on'] : 'views';
|
||||
$comment_num = ! empty( $instance['comment_num'] ) ? $instance['comment_num'] : '';
|
||||
$view_count = ! empty( $instance['view_count'] ) ? $instance['view_count'] : '';
|
||||
$style = ! empty( $instance['style'] ) ? $instance['style'] : 'style-one';
|
||||
$target = ! empty( $instance['target'] ) ? $instance['target'] : '';
|
||||
?>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'num_post' ) ); ?>"><?php esc_html_e( 'Number of Posts', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'num_post' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'num_post' ) ); ?>" type="number" step="1" min="1" value="<?php echo esc_attr( $num_post ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'based_on' ) ); ?>"><?php esc_html_e( 'Popular based on:', 'zeitfresser' ); ?></label>
|
||||
<select id="<?php echo esc_attr( $this->get_field_id( 'based_on' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'based_on' ) ); ?>" class="based-on">
|
||||
<option value="views" <?php selected( $based_on, 'views' ); ?>><?php esc_html_e( 'Post Views', 'zeitfresser' ); ?></option>
|
||||
<option value="comments" <?php selected( $based_on, 'comments' ); ?>><?php esc_html_e( 'Comment Count', 'zeitfresser' ); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_thumbnail' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_thumbnail ); ?>/>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ); ?>"><?php esc_html_e( 'Show Post Thumbnail', 'zeitfresser' ); ?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'show_postdate' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_postdate' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_postdate ); ?>/>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_postdate' ) ); ?>"><?php esc_html_e( 'Show Post Date', 'zeitfresser' ); ?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'target' ) ); ?>">
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'target' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'target' ) ); ?>" type="checkbox" value="1" <?php echo checked($target,1);?> /><?php esc_html_e( 'Open in New Tab', 'zeitfresser' ); ?> </label>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize widget form values as they are saved.
|
||||
*
|
||||
* @see WP_Widget::update()
|
||||
*
|
||||
* @param array $new_instance Values just sent to be saved.
|
||||
* @param array $old_instance Previously saved values from database.
|
||||
*
|
||||
* @return array Updated safe values to be saved.
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
|
||||
$instance = array();
|
||||
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : __( 'Recent Posts', 'zeitfresser' );
|
||||
$instance['num_post'] = ! empty( $new_instance['num_post'] ) ? absint( $new_instance['num_post'] ) : 3 ;
|
||||
$instance['show_thumbnail'] = ! empty( $new_instance['show_thumbnail'] ) ? absint( $new_instance['show_thumbnail'] ) : '';
|
||||
$instance['show_postdate'] = ! empty( $new_instance['show_postdate'] ) ? absint( $new_instance['show_postdate'] ) : '';
|
||||
$instance['based_on'] = ! empty( $new_instance['based_on'] ) ? esc_attr( $new_instance['based_on'] ) : 'views';
|
||||
$instance['comment_num'] = ! empty( $new_instance['comment_num'] ) ? absint( $new_instance['comment_num'] ) : '';
|
||||
$instance['view_count'] = ! empty( $new_instance['view_count'] ) ? absint( $new_instance['view_count'] ) : '';
|
||||
$instance['style'] = ! empty( $new_instance['style'] ) ? esc_attr( $new_instance['style'] ) : 'style-one';
|
||||
$instance['target'] = ! empty( $new_instance['target'] ) ? esc_attr( $new_instance['target'] ) : '';
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
} // class Graphthemes_Widget_Popular_Post
|
||||
endif;
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
// register Daisy_Blog_Recent_Post widget
|
||||
function zeitfresser_register_recent_post_widget() {
|
||||
register_widget( 'Daisy_Blog_Recent_Post' );
|
||||
}
|
||||
add_action( 'widgets_init', 'zeitfresser_register_recent_post_widget' );
|
||||
|
||||
/**
|
||||
* Adds Daisy_Blog_Recent_Post widget.
|
||||
*/
|
||||
class Daisy_Blog_Recent_Post extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Register widget with WordPress.
|
||||
*/
|
||||
function __construct() {
|
||||
parent::__construct(
|
||||
'daisy_blog_widget_recent_post', // Base ID
|
||||
__( 'Graphthemes: Recent Post', 'zeitfresser' ), // Name
|
||||
array( 'description' => __( 'A Recent Post Widget', 'zeitfresser' ), ) // Args
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Front-end display of widget.
|
||||
*
|
||||
* @see WP_Widget::widget()
|
||||
*
|
||||
* @param array $args Widget arguments.
|
||||
* @param array $instance Saved values from database.
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Recent Posts', 'zeitfresser' );
|
||||
$num_post = ! empty( $instance['num_post'] ) ? $instance['num_post'] : 3 ;
|
||||
$show_thumb = ! empty( $instance['show_thumbnail'] ) ? $instance['show_thumbnail'] : '';
|
||||
$show_date = ! empty( $instance['show_postdate'] ) ? $instance['show_postdate'] : '';
|
||||
$cats[] = '';
|
||||
$cat = apply_filters( 'daisy_blog_pro_exclude_categories', $cats );
|
||||
$style = ! empty( $instance['style'] ) ? $instance['style'] : 'style-one';
|
||||
|
||||
$target = 'target="_self"';
|
||||
if( isset($instance['target']) && $instance['target']!='' ){
|
||||
$target = 'target="_blank"';
|
||||
}
|
||||
|
||||
$obj = new Graphthemes_Widget_Functions;
|
||||
|
||||
$daisy_blog_recent_post_size = apply_filters('daisy_blog_recent_post_size', 'thumbnail');
|
||||
$qry = new WP_Query( array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => $num_post,
|
||||
'ignore_sticky_posts' => true,
|
||||
'no_found_rows' => true,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
'category__not_in' => $cat
|
||||
) );
|
||||
if( $qry->have_posts() ){
|
||||
echo $args['before_widget'];
|
||||
ob_start();
|
||||
if( $title ) echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title'];
|
||||
?>
|
||||
<ul>
|
||||
<?php
|
||||
while( $qry->have_posts() ){
|
||||
$qry->the_post();
|
||||
?>
|
||||
<li>
|
||||
<?php
|
||||
if( $show_thumb ){ ?>
|
||||
<a <?php echo $target; ?> href="<?php the_permalink();?>" class="post-thumbnail">
|
||||
<?php
|
||||
if( has_post_thumbnail() && $show_thumb ){
|
||||
the_post_thumbnail( $daisy_blog_recent_post_size, array( 'itemprop' => 'image' ) );
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<?php }
|
||||
?>
|
||||
<div class="entry-header">
|
||||
<h6 class="entry-title"><a <?php echo $target; ?> href="<?php the_permalink(); ?>"><?php the_title();?></a></h6>
|
||||
|
||||
<?php if( $show_date ){ ?>
|
||||
<div class="entry-meta info">
|
||||
<?php
|
||||
$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( DATE_W3C ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( DATE_W3C ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
);
|
||||
?>
|
||||
<?php echo $time_string; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
$html = ob_get_clean();
|
||||
echo apply_filters( 'daisy_blog_recent_post_widget_filter', $html, $args, $instance );
|
||||
echo $args['after_widget'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Back-end widget form.
|
||||
*
|
||||
* @see WP_Widget::form()
|
||||
*
|
||||
* @param array $instance Previously saved values from database.
|
||||
*/
|
||||
public function form( $instance ) {
|
||||
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Recent Posts', 'zeitfresser' );
|
||||
$num_post = ! empty( $instance['num_post'] ) ? $instance['num_post'] : 3 ;
|
||||
$show_thumbnail = ! empty( $instance['show_thumbnail'] ) ? $instance['show_thumbnail'] : '';
|
||||
$show_postdate = ! empty( $instance['show_postdate'] ) ? $instance['show_postdate'] : '';
|
||||
$style = ! empty( $instance['style'] ) ? $instance['style'] : 'style-one';
|
||||
$target = ! empty( $instance['target'] ) ? $instance['target'] : '';
|
||||
?>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'num_post' ) ); ?>"><?php esc_html_e( 'Number of Posts', 'zeitfresser' ); ?></label>
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'num_post' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'num_post' ) ); ?>" type="number" step="1" min="1" value="<?php echo esc_attr( $num_post ); ?>" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_thumbnail' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_thumbnail ); ?>/>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ); ?>"><?php esc_html_e( 'Show Post Thumbnail', 'zeitfresser' ); ?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input id="<?php echo esc_attr( $this->get_field_id( 'show_postdate' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_postdate' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_postdate ); ?>/>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'show_postdate' ) ); ?>"><?php esc_html_e( 'Show Post Date', 'zeitfresser' ); ?></label>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<label for="<?php echo esc_attr( $this->get_field_id( 'target' ) ); ?>">
|
||||
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'target' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'target' ) ); ?>" type="checkbox" value="1" <?php echo checked($target,1);?> /><?php esc_html_e( 'Open in New Tab', 'zeitfresser' ); ?> </label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize widget form values as they are saved.
|
||||
*
|
||||
* @see WP_Widget::update()
|
||||
*
|
||||
* @param array $new_instance Values just sent to be saved.
|
||||
* @param array $old_instance Previously saved values from database.
|
||||
*
|
||||
* @return array Updated safe values to be saved.
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
|
||||
$instance = array();
|
||||
|
||||
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : __( 'Recent Posts', 'zeitfresser' );
|
||||
$instance['num_post'] = ! empty( $new_instance['num_post'] ) ? absint( $new_instance['num_post'] ) : 3 ;
|
||||
$instance['show_thumbnail'] = ! empty( $new_instance['show_thumbnail'] ) ? absint( $new_instance['show_thumbnail'] ) : '';
|
||||
$instance['show_postdate'] = ! empty( $new_instance['show_postdate'] ) ? absint( $new_instance['show_postdate'] ) : '';
|
||||
$instance['style'] = ! empty( $new_instance['style'] ) ? esc_attr( $new_instance['style'] ) : 'style-one';
|
||||
|
||||
$instance['target'] = ! empty( $new_instance['target'] ) ? esc_attr( $new_instance['target'] ) : '';
|
||||
|
||||
return $instance;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Jetpack Compatibility File
|
||||
*
|
||||
* @link https://jetpack.com/
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 zeitfresser_jetpack_setup() {
|
||||
// Add theme support for Infinite Scroll.
|
||||
add_theme_support(
|
||||
'infinite-scroll',
|
||||
array(
|
||||
'container' => 'main',
|
||||
'render' => 'zeitfresser_infinite_scroll_render',
|
||||
'footer' => 'page',
|
||||
)
|
||||
);
|
||||
|
||||
// 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' => 'zeitfresser',
|
||||
'date' => '.posted-on',
|
||||
'categories' => '.cat-links',
|
||||
'tags' => '.tags-links',
|
||||
'author' => '.byline',
|
||||
'comment' => '.comments-link',
|
||||
),
|
||||
'featured-images' => array(
|
||||
'archive' => true,
|
||||
'post' => true,
|
||||
'page' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_jetpack_setup' );
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_infinite_scroll_render' ) ) :
|
||||
/**
|
||||
* Custom render function for Infinite Scroll.
|
||||
*/
|
||||
function zeitfresser_infinite_scroll_render() {
|
||||
while ( have_posts() ) {
|
||||
the_post();
|
||||
if ( is_search() ) :
|
||||
get_template_part( 'template-parts/content', 'search' );
|
||||
else :
|
||||
get_template_part( 'template-parts/content', get_post_type() );
|
||||
endif;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* Legacy compatibility aliases for old Daisy-prefixed callbacks.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
||||
|
||||
if ( ! function_exists( 'daisy_blog_body_classes' ) && function_exists( 'zeitfresser_body_classes' ) ) { function daisy_blog_body_classes(...$args) { return zeitfresser_body_classes(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_check_varient' ) && function_exists( 'zeitfresser_check_varient' ) ) { function daisy_blog_check_varient(...$args) { return zeitfresser_check_varient(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_color_section' ) && function_exists( 'zeitfresser_color_section' ) ) { function daisy_blog_color_section(...$args) { return zeitfresser_color_section(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_container_width' ) && function_exists( 'zeitfresser_container_width' ) ) { function daisy_blog_container_width(...$args) { return zeitfresser_container_width(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_container_width_dynamic_css' ) && function_exists( 'zeitfresser_container_width_dynamic_css' ) ) { function daisy_blog_container_width_dynamic_css(...$args) { return zeitfresser_container_width_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_container_width_enqueue_scripts' ) && function_exists( 'zeitfresser_container_width_enqueue_scripts' ) ) { function daisy_blog_container_width_enqueue_scripts(...$args) { return zeitfresser_container_width_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_content_width' ) && function_exists( 'zeitfresser_content_width' ) ) { function daisy_blog_content_width(...$args) { return zeitfresser_content_width(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_custom_header_setup' ) && function_exists( 'zeitfresser_custom_header_setup' ) ) { function daisy_blog_custom_header_setup(...$args) { return zeitfresser_custom_header_setup(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_customize_partial_blogdescription' ) && function_exists( 'zeitfresser_customize_partial_blogdescription' ) ) { function daisy_blog_customize_partial_blogdescription(...$args) { return zeitfresser_customize_partial_blogdescription(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_customize_partial_blogname' ) && function_exists( 'zeitfresser_customize_partial_blogname' ) ) { function daisy_blog_customize_partial_blogname(...$args) { return zeitfresser_customize_partial_blogname(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_customize_preview_js' ) && function_exists( 'zeitfresser_customize_preview_js' ) ) { function daisy_blog_customize_preview_js(...$args) { return zeitfresser_customize_preview_js(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_customize_register' ) && function_exists( 'zeitfresser_customize_register' ) ) { function daisy_blog_customize_register(...$args) { return zeitfresser_customize_register(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_customize_register_footer_copyright' ) && function_exists( 'zeitfresser_customize_register_footer_copyright' ) ) { function daisy_blog_customize_register_footer_copyright(...$args) { return zeitfresser_customize_register_footer_copyright(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_dark_color' ) && function_exists( 'zeitfresser_dark_color' ) ) { function daisy_blog_dark_color(...$args) { return zeitfresser_dark_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_dark_color_dynamic_css' ) && function_exists( 'zeitfresser_dark_color_dynamic_css' ) ) { function daisy_blog_dark_color_dynamic_css(...$args) { return zeitfresser_dark_color_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_dark_color_enqueue_scripts' ) && function_exists( 'zeitfresser_dark_color_enqueue_scripts' ) ) { function daisy_blog_dark_color_enqueue_scripts(...$args) { return zeitfresser_dark_color_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_entry_footer' ) && function_exists( 'zeitfresser_entry_footer' ) ) { function daisy_blog_entry_footer(...$args) { return zeitfresser_entry_footer(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_font_size' ) && function_exists( 'zeitfresser_font_size' ) ) { function daisy_blog_font_size(...$args) { return zeitfresser_font_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_font_size_dynamic_css' ) && function_exists( 'zeitfresser_font_size_dynamic_css' ) ) { function daisy_blog_font_size_dynamic_css(...$args) { return zeitfresser_font_size_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_font_size_enqueue_scripts' ) && function_exists( 'zeitfresser_font_size_enqueue_scripts' ) ) { function daisy_blog_font_size_enqueue_scripts(...$args) { return zeitfresser_font_size_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_font_weight' ) && function_exists( 'zeitfresser_font_weight' ) ) { function daisy_blog_font_weight(...$args) { return zeitfresser_font_weight(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_font_weight_dynamic_css' ) && function_exists( 'zeitfresser_font_weight_dynamic_css' ) ) { function daisy_blog_font_weight_dynamic_css(...$args) { return zeitfresser_font_weight_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_font_weight_enqueue_scripts' ) && function_exists( 'zeitfresser_font_weight_enqueue_scripts' ) ) { function daisy_blog_font_weight_enqueue_scripts(...$args) { return zeitfresser_font_weight_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_fonts_url' ) && function_exists( 'zeitfresser_fonts_url' ) ) { function daisy_blog_fonts_url(...$args) { return zeitfresser_fonts_url(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_free_pro' ) && function_exists( 'zeitfresser_free_pro' ) ) { function daisy_blog_free_pro(...$args) { return zeitfresser_free_pro(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_background_color' ) && function_exists( 'zeitfresser_get_default_background_color' ) ) { function daisy_blog_get_default_background_color(...$args) { return zeitfresser_get_default_background_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_breadcrumbs' ) && function_exists( 'zeitfresser_get_default_breadcrumbs' ) ) { function daisy_blog_get_default_breadcrumbs(...$args) { return zeitfresser_get_default_breadcrumbs(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_container_width' ) && function_exists( 'zeitfresser_get_default_container_width' ) ) { function daisy_blog_get_default_container_width(...$args) { return zeitfresser_get_default_container_width(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_dark_color' ) && function_exists( 'zeitfresser_get_default_dark_color' ) ) { function daisy_blog_get_default_dark_color(...$args) { return zeitfresser_get_default_dark_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_font_size' ) && function_exists( 'zeitfresser_get_default_font_size' ) ) { function daisy_blog_get_default_font_size(...$args) { return zeitfresser_get_default_font_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_font_weight' ) && function_exists( 'zeitfresser_get_default_font_weight' ) ) { function daisy_blog_get_default_font_weight(...$args) { return zeitfresser_get_default_font_weight(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_footer_copyright' ) && function_exists( 'zeitfresser_get_default_footer_copyright' ) ) { function daisy_blog_get_default_footer_copyright(...$args) { return zeitfresser_get_default_footer_copyright(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_grey_color' ) && function_exists( 'zeitfresser_get_default_grey_color' ) ) { function daisy_blog_get_default_grey_color(...$args) { return zeitfresser_get_default_grey_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_light_color' ) && function_exists( 'zeitfresser_get_default_light_color' ) ) { function daisy_blog_get_default_light_color(...$args) { return zeitfresser_get_default_light_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_line_height' ) && function_exists( 'zeitfresser_get_default_line_height' ) ) { function daisy_blog_get_default_line_height(...$args) { return zeitfresser_get_default_line_height(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_logo_size' ) && function_exists( 'zeitfresser_get_default_logo_size' ) ) { function daisy_blog_get_default_logo_size(...$args) { return zeitfresser_get_default_logo_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_main_font_family' ) && function_exists( 'zeitfresser_get_default_main_font_family' ) ) { function daisy_blog_get_default_main_font_family(...$args) { return zeitfresser_get_default_main_font_family(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_author' ) && function_exists( 'zeitfresser_get_default_post_detail_author' ) ) { function daisy_blog_get_default_post_detail_author(...$args) { return zeitfresser_get_default_post_detail_author(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_author_block' ) && function_exists( 'zeitfresser_get_default_post_detail_author_block' ) ) { function daisy_blog_get_default_post_detail_author_block(...$args) { return zeitfresser_get_default_post_detail_author_block(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_category' ) && function_exists( 'zeitfresser_get_default_post_detail_category' ) ) { function daisy_blog_get_default_post_detail_category(...$args) { return zeitfresser_get_default_post_detail_category(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_comment' ) && function_exists( 'zeitfresser_get_default_post_detail_comment' ) ) { function daisy_blog_get_default_post_detail_comment(...$args) { return zeitfresser_get_default_post_detail_comment(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_date' ) && function_exists( 'zeitfresser_get_default_post_detail_date' ) ) { function daisy_blog_get_default_post_detail_date(...$args) { return zeitfresser_get_default_post_detail_date(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_featured_image' ) && function_exists( 'zeitfresser_get_default_post_detail_featured_image' ) ) { function daisy_blog_get_default_post_detail_featured_image(...$args) { return zeitfresser_get_default_post_detail_featured_image(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_featured_image_size' ) && function_exists( 'zeitfresser_get_default_post_detail_featured_image_size' ) ) { function daisy_blog_get_default_post_detail_featured_image_size(...$args) { return zeitfresser_get_default_post_detail_featured_image_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_related_articles' ) && function_exists( 'zeitfresser_get_default_post_detail_related_articles' ) ) { function daisy_blog_get_default_post_detail_related_articles(...$args) { return zeitfresser_get_default_post_detail_related_articles(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_related_articles_title' ) && function_exists( 'zeitfresser_get_default_post_detail_related_articles_title' ) ) { function daisy_blog_get_default_post_detail_related_articles_title(...$args) { return zeitfresser_get_default_post_detail_related_articles_title(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_social_share' ) && function_exists( 'zeitfresser_get_default_post_detail_social_share' ) ) { function daisy_blog_get_default_post_detail_social_share(...$args) { return zeitfresser_get_default_post_detail_social_share(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_social_share_options' ) && function_exists( 'zeitfresser_get_default_post_detail_social_share_options' ) ) { function daisy_blog_get_default_post_detail_social_share_options(...$args) { return zeitfresser_get_default_post_detail_social_share_options(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_detail_tag' ) && function_exists( 'zeitfresser_get_default_post_detail_tag' ) ) { function daisy_blog_get_default_post_detail_tag(...$args) { return zeitfresser_get_default_post_detail_tag(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_author' ) && function_exists( 'zeitfresser_get_default_post_snippet_author' ) ) { function daisy_blog_get_default_post_snippet_author(...$args) { return zeitfresser_get_default_post_snippet_author(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_category' ) && function_exists( 'zeitfresser_get_default_post_snippet_category' ) ) { function daisy_blog_get_default_post_snippet_category(...$args) { return zeitfresser_get_default_post_snippet_category(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_comment' ) && function_exists( 'zeitfresser_get_default_post_snippet_comment' ) ) { function daisy_blog_get_default_post_snippet_comment(...$args) { return zeitfresser_get_default_post_snippet_comment(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_date' ) && function_exists( 'zeitfresser_get_default_post_snippet_date' ) ) { function daisy_blog_get_default_post_snippet_date(...$args) { return zeitfresser_get_default_post_snippet_date(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_excerpt_size' ) && function_exists( 'zeitfresser_get_default_post_snippet_excerpt_size' ) ) { function daisy_blog_get_default_post_snippet_excerpt_size(...$args) { return zeitfresser_get_default_post_snippet_excerpt_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_featured_image' ) && function_exists( 'zeitfresser_get_default_post_snippet_featured_image' ) ) { function daisy_blog_get_default_post_snippet_featured_image(...$args) { return zeitfresser_get_default_post_snippet_featured_image(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_featured_image_size' ) && function_exists( 'zeitfresser_get_default_post_snippet_featured_image_size' ) ) { function daisy_blog_get_default_post_snippet_featured_image_size(...$args) { return zeitfresser_get_default_post_snippet_featured_image_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_read_more_text' ) && function_exists( 'zeitfresser_get_default_post_snippet_read_more_text' ) ) { function daisy_blog_get_default_post_snippet_read_more_text(...$args) { return zeitfresser_get_default_post_snippet_read_more_text(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_show_hide_read_more' ) && function_exists( 'zeitfresser_get_default_post_snippet_show_hide_read_more' ) ) { function daisy_blog_get_default_post_snippet_show_hide_read_more(...$args) { return zeitfresser_get_default_post_snippet_show_hide_read_more(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_social_share' ) && function_exists( 'zeitfresser_get_default_post_snippet_social_share' ) ) { function daisy_blog_get_default_post_snippet_social_share(...$args) { return zeitfresser_get_default_post_snippet_social_share(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_social_share_options' ) && function_exists( 'zeitfresser_get_default_post_snippet_social_share_options' ) ) { function daisy_blog_get_default_post_snippet_social_share_options(...$args) { return zeitfresser_get_default_post_snippet_social_share_options(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_post_snippet_tag' ) && function_exists( 'zeitfresser_get_default_post_snippet_tag' ) ) { function daisy_blog_get_default_post_snippet_tag(...$args) { return zeitfresser_get_default_post_snippet_tag(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_primary_color' ) && function_exists( 'zeitfresser_get_default_primary_color' ) ) { function daisy_blog_get_default_primary_color(...$args) { return zeitfresser_get_default_primary_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_secondary_color' ) && function_exists( 'zeitfresser_get_default_secondary_color' ) ) { function daisy_blog_get_default_secondary_color(...$args) { return zeitfresser_get_default_secondary_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_secondary_font_family' ) && function_exists( 'zeitfresser_get_default_secondary_font_family' ) ) { function daisy_blog_get_default_secondary_font_family(...$args) { return zeitfresser_get_default_secondary_font_family(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_site_identity_font_family' ) && function_exists( 'zeitfresser_get_default_site_identity_font_family' ) ) { function daisy_blog_get_default_site_identity_font_family(...$args) { return zeitfresser_get_default_site_identity_font_family(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_site_identity_font_size' ) && function_exists( 'zeitfresser_get_default_site_identity_font_size' ) ) { function daisy_blog_get_default_site_identity_font_size(...$args) { return zeitfresser_get_default_site_identity_font_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_site_tagline_show_hide' ) && function_exists( 'zeitfresser_get_default_site_tagline_show_hide' ) ) { function daisy_blog_get_default_site_tagline_show_hide(...$args) { return zeitfresser_get_default_site_tagline_show_hide(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_site_title_color' ) && function_exists( 'zeitfresser_get_default_site_title_color' ) ) { function daisy_blog_get_default_site_title_color(...$args) { return zeitfresser_get_default_site_title_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_site_title_show_hide' ) && function_exists( 'zeitfresser_get_default_site_title_show_hide' ) ) { function daisy_blog_get_default_site_title_show_hide(...$args) { return zeitfresser_get_default_site_title_show_hide(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_default_sticky_menu' ) && function_exists( 'zeitfresser_get_default_sticky_menu' ) ) { function daisy_blog_get_default_sticky_menu(...$args) { return zeitfresser_get_default_sticky_menu(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_google_fonts' ) && function_exists( 'zeitfresser_get_google_fonts' ) ) { function daisy_blog_get_google_fonts(...$args) { return zeitfresser_get_google_fonts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_views' ) && function_exists( 'zeitfresser_get_views' ) ) { function daisy_blog_get_views(...$args) { return zeitfresser_get_views(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_get_websafe_font' ) && function_exists( 'zeitfresser_get_websafe_font' ) ) { function daisy_blog_get_websafe_font(...$args) { return zeitfresser_get_websafe_font(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_google_font_local' ) && function_exists( 'zeitfresser_google_font_local' ) ) { function daisy_blog_google_font_local(...$args) { return zeitfresser_google_font_local(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_google_fonts' ) && function_exists( 'zeitfresser_google_fonts' ) ) { function daisy_blog_google_fonts(...$args) { return zeitfresser_google_fonts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_google_fonts_scripts' ) && function_exists( 'zeitfresser_google_fonts_scripts' ) ) { function daisy_blog_google_fonts_scripts(...$args) { return zeitfresser_google_fonts_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_grey_color' ) && function_exists( 'zeitfresser_grey_color' ) ) { function daisy_blog_grey_color(...$args) { return zeitfresser_grey_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_grey_color_dynamic_css' ) && function_exists( 'zeitfresser_grey_color_dynamic_css' ) ) { function daisy_blog_grey_color_dynamic_css(...$args) { return zeitfresser_grey_color_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_grey_color_enqueue_scripts' ) && function_exists( 'zeitfresser_grey_color_enqueue_scripts' ) ) { function daisy_blog_grey_color_enqueue_scripts(...$args) { return zeitfresser_grey_color_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_header_style' ) && function_exists( 'zeitfresser_header_style' ) ) { function daisy_blog_header_style(...$args) { return zeitfresser_header_style(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_infinite_scroll_render' ) && function_exists( 'zeitfresser_infinite_scroll_render' ) ) { function daisy_blog_infinite_scroll_render(...$args) { return zeitfresser_infinite_scroll_render(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_is_google_font' ) && function_exists( 'zeitfresser_is_google_font' ) ) { function daisy_blog_is_google_font(...$args) { return zeitfresser_is_google_font(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_jetpack_setup' ) && function_exists( 'zeitfresser_jetpack_setup' ) ) { function daisy_blog_jetpack_setup(...$args) { return zeitfresser_jetpack_setup(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_light_color' ) && function_exists( 'zeitfresser_light_color' ) ) { function daisy_blog_light_color(...$args) { return zeitfresser_light_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_light_color_dynamic_css' ) && function_exists( 'zeitfresser_light_color_dynamic_css' ) ) { function daisy_blog_light_color_dynamic_css(...$args) { return zeitfresser_light_color_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_light_color_enqueue_scripts' ) && function_exists( 'zeitfresser_light_color_enqueue_scripts' ) ) { function daisy_blog_light_color_enqueue_scripts(...$args) { return zeitfresser_light_color_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_line_height' ) && function_exists( 'zeitfresser_line_height' ) ) { function daisy_blog_line_height(...$args) { return zeitfresser_line_height(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_line_height_dynamic_css' ) && function_exists( 'zeitfresser_line_height_dynamic_css' ) ) { function daisy_blog_line_height_dynamic_css(...$args) { return zeitfresser_line_height_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_line_height_enqueue_scripts' ) && function_exists( 'zeitfresser_line_height_enqueue_scripts' ) ) { function daisy_blog_line_height_enqueue_scripts(...$args) { return zeitfresser_line_height_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_logo_size' ) && function_exists( 'zeitfresser_logo_size' ) ) { function daisy_blog_logo_size(...$args) { return zeitfresser_logo_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_logo_size_dynamic_css' ) && function_exists( 'zeitfresser_logo_size_dynamic_css' ) ) { function daisy_blog_logo_size_dynamic_css(...$args) { return zeitfresser_logo_size_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_logo_size_enqueue_scripts' ) && function_exists( 'zeitfresser_logo_size_enqueue_scripts' ) ) { function daisy_blog_logo_size_enqueue_scripts(...$args) { return zeitfresser_logo_size_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_main_font_family' ) && function_exists( 'zeitfresser_main_font_family' ) ) { function daisy_blog_main_font_family(...$args) { return zeitfresser_main_font_family(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_main_font_family_dynamic_css' ) && function_exists( 'zeitfresser_main_font_family_dynamic_css' ) ) { function daisy_blog_main_font_family_dynamic_css(...$args) { return zeitfresser_main_font_family_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_main_font_family_enqueue_scripts' ) && function_exists( 'zeitfresser_main_font_family_enqueue_scripts' ) ) { function daisy_blog_main_font_family_enqueue_scripts(...$args) { return zeitfresser_main_font_family_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_numeric_pagination' ) && function_exists( 'zeitfresser_numeric_pagination' ) ) { function daisy_blog_numeric_pagination(...$args) { return zeitfresser_numeric_pagination(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_pingback_header' ) && function_exists( 'zeitfresser_pingback_header' ) ) { function daisy_blog_pingback_header(...$args) { return zeitfresser_pingback_header(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_post_snippet_excerpt_size' ) && function_exists( 'zeitfresser_post_snippet_excerpt_size' ) ) { function daisy_blog_post_snippet_excerpt_size(...$args) { return zeitfresser_post_snippet_excerpt_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_post_thumbnail' ) && function_exists( 'zeitfresser_post_thumbnail' ) ) { function daisy_blog_post_thumbnail(...$args) { return zeitfresser_post_thumbnail(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_posted_by' ) && function_exists( 'zeitfresser_posted_by' ) ) { function daisy_blog_posted_by(...$args) { return zeitfresser_posted_by(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_posted_on' ) && function_exists( 'zeitfresser_posted_on' ) ) { function daisy_blog_posted_on(...$args) { return zeitfresser_posted_on(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_primary_color' ) && function_exists( 'zeitfresser_primary_color' ) ) { function daisy_blog_primary_color(...$args) { return zeitfresser_primary_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_primary_color_dynamic_css' ) && function_exists( 'zeitfresser_primary_color_dynamic_css' ) ) { function daisy_blog_primary_color_dynamic_css(...$args) { return zeitfresser_primary_color_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_primary_color_enqueue_scripts' ) && function_exists( 'zeitfresser_primary_color_enqueue_scripts' ) ) { function daisy_blog_primary_color_enqueue_scripts(...$args) { return zeitfresser_primary_color_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_author_profile_widget' ) && function_exists( 'zeitfresser_register_author_profile_widget' ) ) { function daisy_blog_register_author_profile_widget(...$args) { return zeitfresser_register_author_profile_widget(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_custom_controls' ) && function_exists( 'zeitfresser_register_custom_controls' ) ) { function daisy_blog_register_custom_controls(...$args) { return zeitfresser_register_custom_controls(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_font_customization_section' ) && function_exists( 'zeitfresser_register_font_customization_section' ) ) { function daisy_blog_register_font_customization_section(...$args) { return zeitfresser_register_font_customization_section(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_general_customization_section' ) && function_exists( 'zeitfresser_register_general_customization_section' ) ) { function daisy_blog_register_general_customization_section(...$args) { return zeitfresser_register_general_customization_section(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_popular_post_widget' ) && function_exists( 'zeitfresser_register_popular_post_widget' ) ) { function daisy_blog_register_popular_post_widget(...$args) { return zeitfresser_register_popular_post_widget(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_post_snippet_customization_section' ) && function_exists( 'zeitfresser_register_post_snippet_customization_section' ) ) { function daisy_blog_register_post_snippet_customization_section(...$args) { return zeitfresser_register_post_snippet_customization_section(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_register_recent_post_widget' ) && function_exists( 'zeitfresser_register_recent_post_widget' ) ) { function daisy_blog_register_recent_post_widget(...$args) { return zeitfresser_register_recent_post_widget(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_sanitize_array' ) && function_exists( 'zeitfresser_sanitize_array' ) ) { function daisy_blog_sanitize_array(...$args) { return zeitfresser_sanitize_array(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_sanitize_checkbox' ) && function_exists( 'zeitfresser_sanitize_checkbox' ) ) { function daisy_blog_sanitize_checkbox(...$args) { return zeitfresser_sanitize_checkbox(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_sanitize_float' ) && function_exists( 'zeitfresser_sanitize_float' ) ) { function daisy_blog_sanitize_float(...$args) { return zeitfresser_sanitize_float(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_sanitize_google_fonts' ) && function_exists( 'zeitfresser_sanitize_google_fonts' ) ) { function daisy_blog_sanitize_google_fonts(...$args) { return zeitfresser_sanitize_google_fonts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_sanitize_select' ) && function_exists( 'zeitfresser_sanitize_select' ) ) { function daisy_blog_sanitize_select(...$args) { return zeitfresser_sanitize_select(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_scripts' ) && function_exists( 'zeitfresser_scripts' ) ) { function daisy_blog_scripts(...$args) { return zeitfresser_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_secondary_color' ) && function_exists( 'zeitfresser_secondary_color' ) ) { function daisy_blog_secondary_color(...$args) { return zeitfresser_secondary_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_secondary_color_dynamic_css' ) && function_exists( 'zeitfresser_secondary_color_dynamic_css' ) ) { function daisy_blog_secondary_color_dynamic_css(...$args) { return zeitfresser_secondary_color_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_secondary_color_enqueue_scripts' ) && function_exists( 'zeitfresser_secondary_color_enqueue_scripts' ) ) { function daisy_blog_secondary_color_enqueue_scripts(...$args) { return zeitfresser_secondary_color_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_secondary_font_family' ) && function_exists( 'zeitfresser_secondary_font_family' ) ) { function daisy_blog_secondary_font_family(...$args) { return zeitfresser_secondary_font_family(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_secondary_font_family_dynamic_css' ) && function_exists( 'zeitfresser_secondary_font_family_dynamic_css' ) ) { function daisy_blog_secondary_font_family_dynamic_css(...$args) { return zeitfresser_secondary_font_family_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_secondary_font_family_enqueue_scripts' ) && function_exists( 'zeitfresser_secondary_font_family_enqueue_scripts' ) ) { function daisy_blog_secondary_font_family_enqueue_scripts(...$args) { return zeitfresser_secondary_font_family_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_set_views' ) && function_exists( 'zeitfresser_set_views' ) ) { function daisy_blog_set_views(...$args) { return zeitfresser_set_views(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_setup' ) && function_exists( 'zeitfresser_setup' ) ) { function daisy_blog_setup(...$args) { return zeitfresser_setup(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_show_hide_site_tagline' ) && function_exists( 'zeitfresser_show_hide_site_tagline' ) ) { function daisy_blog_show_hide_site_tagline(...$args) { return zeitfresser_show_hide_site_tagline(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_show_hide_site_title' ) && function_exists( 'zeitfresser_show_hide_site_title' ) ) { function daisy_blog_show_hide_site_title(...$args) { return zeitfresser_show_hide_site_title(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_identity_font_family' ) && function_exists( 'zeitfresser_site_identity_font_family' ) ) { function daisy_blog_site_identity_font_family(...$args) { return zeitfresser_site_identity_font_family(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_identity_font_family_dynamic_css' ) && function_exists( 'zeitfresser_site_identity_font_family_dynamic_css' ) ) { function daisy_blog_site_identity_font_family_dynamic_css(...$args) { return zeitfresser_site_identity_font_family_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_identity_font_family_enqueue_scripts' ) && function_exists( 'zeitfresser_site_identity_font_family_enqueue_scripts' ) ) { function daisy_blog_site_identity_font_family_enqueue_scripts(...$args) { return zeitfresser_site_identity_font_family_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_identity_font_size' ) && function_exists( 'zeitfresser_site_identity_font_size' ) ) { function daisy_blog_site_identity_font_size(...$args) { return zeitfresser_site_identity_font_size(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_identity_font_size_dynamic_css' ) && function_exists( 'zeitfresser_site_identity_font_size_dynamic_css' ) ) { function daisy_blog_site_identity_font_size_dynamic_css(...$args) { return zeitfresser_site_identity_font_size_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_identity_font_size_enqueue_scripts' ) && function_exists( 'zeitfresser_site_identity_font_size_enqueue_scripts' ) ) { function daisy_blog_site_identity_font_size_enqueue_scripts(...$args) { return zeitfresser_site_identity_font_size_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_title_color' ) && function_exists( 'zeitfresser_site_title_color' ) ) { function daisy_blog_site_title_color(...$args) { return zeitfresser_site_title_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_title_color_dynamic_css' ) && function_exists( 'zeitfresser_site_title_color_dynamic_css' ) ) { function daisy_blog_site_title_color_dynamic_css(...$args) { return zeitfresser_site_title_color_dynamic_css(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_site_title_color_enqueue_scripts' ) && function_exists( 'zeitfresser_site_title_color_enqueue_scripts' ) ) { function daisy_blog_site_title_color_enqueue_scripts(...$args) { return zeitfresser_site_title_color_enqueue_scripts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_social_links' ) && function_exists( 'zeitfresser_social_links' ) ) { function daisy_blog_social_links(...$args) { return zeitfresser_social_links(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_sticky_menu_background_color' ) && function_exists( 'zeitfresser_sticky_menu_background_color' ) ) { function daisy_blog_sticky_menu_background_color(...$args) { return zeitfresser_sticky_menu_background_color(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_used_google_fonts' ) && function_exists( 'zeitfresser_used_google_fonts' ) ) { function daisy_blog_used_google_fonts(...$args) { return zeitfresser_used_google_fonts(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_widget_get_attachment_id' ) && function_exists( 'zeitfresser_widget_get_attachment_id' ) ) { function daisy_blog_widget_get_attachment_id(...$args) { return zeitfresser_widget_get_attachment_id(...$args); } }
|
||||
if ( ! function_exists( 'daisy_blog_widgets_init' ) && function_exists( 'zeitfresser_widgets_init' ) ) { function daisy_blog_widgets_init(...$args) { return zeitfresser_widgets_init(...$args); } }
|
||||
if ( ! function_exists( 'graphthemes_get_social_link_default' ) && function_exists( 'zeitfresser_get_social_link_default' ) ) { function graphthemes_get_social_link_default(...$args) { return zeitfresser_get_social_link_default(...$args); } }
|
||||
if ( ! function_exists( 'graphthemes_get_social_links' ) && function_exists( 'zeitfresser_get_social_links' ) ) { function graphthemes_get_social_links(...$args) { return zeitfresser_get_social_links(...$args); } }
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
function zeitfresser_numeric_pagination() {
|
||||
|
||||
if( is_singular() )
|
||||
return;
|
||||
|
||||
global $wp_query;
|
||||
|
||||
/** Stop execution if there's only 1 page */
|
||||
if( $wp_query->max_num_pages <= 1 )
|
||||
return;
|
||||
|
||||
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
|
||||
$max = intval( $wp_query->max_num_pages );
|
||||
|
||||
/** Add current page to the array */
|
||||
if ( $paged >= 1 )
|
||||
$links[] = $paged;
|
||||
|
||||
/** Add the pages around the current page to the array */
|
||||
if ( $paged >= 3 ) {
|
||||
$links[] = $paged - 1;
|
||||
$links[] = $paged - 2;
|
||||
}
|
||||
|
||||
if ( ( $paged + 2 ) <= $max ) {
|
||||
$links[] = $paged + 2;
|
||||
$links[] = $paged + 1;
|
||||
}
|
||||
|
||||
echo '<div class="pagination"><ul>' . "\n";
|
||||
|
||||
/** Previous Post Link */
|
||||
if ( get_previous_posts_link() )
|
||||
printf( '<li>%s</li>' . "\n", get_previous_posts_link() );
|
||||
|
||||
/** Link to first page, plus ellipses if necessary */
|
||||
if ( ! in_array( 1, $links ) ) {
|
||||
$class = 1 == $paged ? ' class="active"' : '';
|
||||
|
||||
printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
|
||||
|
||||
if ( ! in_array( 2, $links ) )
|
||||
echo '<li>…</li>';
|
||||
}
|
||||
|
||||
/** Link to current page, plus 2 pages in either direction if necessary */
|
||||
sort( $links );
|
||||
foreach ( (array) $links as $link ) {
|
||||
$class = $paged == $link ? ' class="active"' : '';
|
||||
printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
|
||||
}
|
||||
|
||||
/** Link to last page, plus ellipses if necessary */
|
||||
if ( ! in_array( $max, $links ) ) {
|
||||
if ( ! in_array( $max - 1, $links ) )
|
||||
echo '<li>…</li>' . "\n";
|
||||
|
||||
$class = $paged == $max ? ' class="active"' : '';
|
||||
printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );
|
||||
}
|
||||
|
||||
/** Next Post Link */
|
||||
if ( get_next_posts_link() )
|
||||
printf( '<li>%s</li>' . "\n", get_next_posts_link() );
|
||||
|
||||
echo '</ul></div>' . "\n";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/**
|
||||
* Performance tools for existing media and webfonts.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the performance tools admin page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_register_performance_tools_page() {
|
||||
add_theme_page(
|
||||
esc_html__( 'Performance Tools', 'zeitfresser' ),
|
||||
esc_html__( 'Performance Tools', 'zeitfresser' ),
|
||||
'manage_options',
|
||||
'zeitfresser-performance-tools',
|
||||
'zeitfresser_render_performance_tools_page'
|
||||
);
|
||||
}
|
||||
add_action( 'admin_menu', 'zeitfresser_register_performance_tools_page' );
|
||||
|
||||
/**
|
||||
* Count attachments still waiting for one-time optimization.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function zeitfresser_get_pending_legacy_images_count() {
|
||||
$query = new WP_Query(
|
||||
array(
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'post_mime_type' => 'image',
|
||||
'fields' => 'ids',
|
||||
'posts_per_page' => 1,
|
||||
'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
|
||||
array(
|
||||
'key' => '_zeitfresser_media_optimized',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
),
|
||||
'no_found_rows' => false,
|
||||
'cache_results' => false,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
)
|
||||
);
|
||||
|
||||
return (int) $query->found_posts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a batch of legacy images with current thumbnail/webp rules.
|
||||
*
|
||||
* @param int $batch_size Number of images to process.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_process_legacy_images_batch( $batch_size = 20 ) {
|
||||
$results = array(
|
||||
'processed' => 0,
|
||||
'updated' => 0,
|
||||
'skipped' => 0,
|
||||
'errors' => 0,
|
||||
);
|
||||
|
||||
$query = new WP_Query(
|
||||
array(
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'post_mime_type' => 'image',
|
||||
'fields' => 'ids',
|
||||
'posts_per_page' => absint( $batch_size ),
|
||||
'orderby' => 'ID',
|
||||
'order' => 'ASC',
|
||||
'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
|
||||
array(
|
||||
'key' => '_zeitfresser_media_optimized',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
),
|
||||
'no_found_rows' => true,
|
||||
'cache_results' => false,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $query->posts ) ) {
|
||||
return $results;
|
||||
}
|
||||
|
||||
foreach ( $query->posts as $attachment_id ) {
|
||||
$results['processed']++;
|
||||
|
||||
$file = get_attached_file( $attachment_id );
|
||||
|
||||
if ( empty( $file ) || ! file_exists( $file ) ) {
|
||||
update_post_meta( $attachment_id, '_zeitfresser_media_optimized', 'missing' );
|
||||
$results['skipped']++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$metadata = wp_generate_attachment_metadata( $attachment_id, $file );
|
||||
|
||||
if ( is_wp_error( $metadata ) || empty( $metadata ) ) {
|
||||
$results['errors']++;
|
||||
continue;
|
||||
}
|
||||
|
||||
wp_update_attachment_metadata( $attachment_id, $metadata );
|
||||
update_post_meta( $attachment_id, '_zeitfresser_media_optimized', current_time( 'mysql' ) );
|
||||
$results['updated']++;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle admin actions for performance tools.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_handle_performance_tools_actions() {
|
||||
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty( $_GET['page'] ) || 'zeitfresser-performance-tools' !== $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty( $_GET['zeitfresser_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
return;
|
||||
}
|
||||
|
||||
check_admin_referer( 'zeitfresser_performance_tools' );
|
||||
|
||||
$action = sanitize_key( wp_unslash( $_GET['zeitfresser_action'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
if ( 'optimize_legacy_images' === $action ) {
|
||||
$results = zeitfresser_process_legacy_images_batch( 25 );
|
||||
$args = array(
|
||||
'page' => 'zeitfresser-performance-tools',
|
||||
'processed' => $results['processed'],
|
||||
'updated' => $results['updated'],
|
||||
'skipped' => $results['skipped'],
|
||||
'errors' => $results['errors'],
|
||||
);
|
||||
|
||||
wp_safe_redirect( add_query_arg( $args, admin_url( 'themes.php' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( 'reset_legacy_images' === $action ) {
|
||||
$query = new WP_Query(
|
||||
array(
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'inherit',
|
||||
'post_mime_type' => 'image',
|
||||
'fields' => 'ids',
|
||||
'posts_per_page' => -1,
|
||||
'meta_key' => '_zeitfresser_media_optimized', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
|
||||
'no_found_rows' => true,
|
||||
'cache_results' => false,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $query->posts as $attachment_id ) {
|
||||
delete_post_meta( $attachment_id, '_zeitfresser_media_optimized' );
|
||||
}
|
||||
|
||||
wp_safe_redirect(
|
||||
add_query_arg(
|
||||
array(
|
||||
'page' => 'zeitfresser-performance-tools',
|
||||
'reset' => count( $query->posts ),
|
||||
),
|
||||
admin_url( 'themes.php' )
|
||||
)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
add_action( 'admin_init', 'zeitfresser_handle_performance_tools_actions' );
|
||||
|
||||
/**
|
||||
* Render the performance tools page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_render_performance_tools_page() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pending = zeitfresser_get_pending_legacy_images_count();
|
||||
$local = function_exists( 'zeitfresser_get_local_webfonts_css' ) ? zeitfresser_get_local_webfont_urls( zeitfresser_get_local_webfonts_css() ) : array();
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h1><?php esc_html_e( 'Zeitfresser Performance Tools', 'zeitfresser' ); ?></h1>
|
||||
<p><?php esc_html_e( 'Use these tools after major performance updates to warm local fonts and reprocess older uploads with the current image rules.', 'zeitfresser' ); ?></p>
|
||||
|
||||
<?php if ( isset( $_GET['updated'] ) || isset( $_GET['reset'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>
|
||||
<div class="notice notice-success is-dismissible">
|
||||
<p>
|
||||
<?php
|
||||
if ( isset( $_GET['reset'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
printf(
|
||||
esc_html__( 'Reset complete. %d legacy image markers removed.', 'zeitfresser' ),
|
||||
absint( $_GET['reset'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
esc_html__( 'Batch finished. Processed: %1$d, updated: %2$d, skipped: %3$d, errors: %4$d.', 'zeitfresser' ),
|
||||
absint( $_GET['processed'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
absint( $_GET['updated'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
absint( $_GET['skipped'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
absint( $_GET['errors'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
);
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card" style="max-width: 880px; padding: 20px;">
|
||||
<h2><?php esc_html_e( 'Legacy Image Optimization', 'zeitfresser' ); ?></h2>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( '%d image attachments have not been reprocessed with the current size, quality and WebP rules yet.', 'zeitfresser' ),
|
||||
(int) $pending
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p><?php esc_html_e( 'Run the batch button repeatedly until the counter reaches zero. This keeps each request small and safe on shared hosting.', 'zeitfresser' ); ?></p>
|
||||
<p>
|
||||
<a class="button button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'page' => 'zeitfresser-performance-tools', 'zeitfresser_action' => 'optimize_legacy_images' ), admin_url( 'themes.php' ) ), 'zeitfresser_performance_tools' ) ); ?>">
|
||||
<?php esc_html_e( 'Process Next 25 Images', 'zeitfresser' ); ?>
|
||||
</a>
|
||||
<a class="button" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'page' => 'zeitfresser-performance-tools', 'zeitfresser_action' => 'reset_legacy_images' ), admin_url( 'themes.php' ) ), 'zeitfresser_performance_tools' ) ); ?>">
|
||||
<?php esc_html_e( 'Reset Progress', 'zeitfresser' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="card" style="max-width: 880px; padding: 20px; margin-top: 20px;">
|
||||
<h2><?php esc_html_e( 'Local Font Warmup', 'zeitfresser' ); ?></h2>
|
||||
<p><?php esc_html_e( 'Zeitfresser now prefers locally cached Google font files for the currently selected font families. When the cache is available, the theme preloads the local files and no longer needs the external stylesheet request.', 'zeitfresser' ); ?></p>
|
||||
<p>
|
||||
<?php
|
||||
if ( empty( $local ) ) {
|
||||
esc_html_e( 'Local font files are not cached yet. Visit the front-end once after saving your font settings to warm the cache.', 'zeitfresser' );
|
||||
} else {
|
||||
printf(
|
||||
esc_html__( 'Local font files ready: %d preloadable assets detected.', 'zeitfresser' ),
|
||||
count( $local )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Functions which enhance the theme by hooking into WordPress
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adds custom classes to the array of body classes.
|
||||
*
|
||||
* @param array $classes Classes for the body element.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_body_classes( $classes ) {
|
||||
// Adds a class of hfeed to non-singular pages.
|
||||
if ( ! is_singular() ) {
|
||||
$classes[] = 'hfeed';
|
||||
}
|
||||
|
||||
// Adds a class of no-sidebar when there is no sidebar present.
|
||||
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
|
||||
$classes[] = 'no-sidebar';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'body_class', 'zeitfresser_body_classes' );
|
||||
|
||||
/**
|
||||
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
|
||||
*/
|
||||
function zeitfresser_pingback_header() {
|
||||
if ( is_singular() && pings_open() ) {
|
||||
printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_head', 'zeitfresser_pingback_header' );
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/**
|
||||
* Custom template tags for this theme
|
||||
*
|
||||
* Eventually, some of the functionality here could be replaced by core features.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_posted_on' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current post-date/time.
|
||||
*/
|
||||
function zeitfresser_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( DATE_W3C ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( DATE_W3C ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
);
|
||||
|
||||
$posted_on = sprintf(
|
||||
/* translators: %s: post date. */
|
||||
esc_html_x( 'Posted on %s', 'post date', 'zeitfresser' ),
|
||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||
);
|
||||
|
||||
echo '<span class="posted-on">' . $posted_on . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_posted_by' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current author.
|
||||
*/
|
||||
function zeitfresser_posted_by() {
|
||||
$byline = sprintf(
|
||||
/* translators: %s: post author. */
|
||||
esc_html_x( 'by %s', 'post author', 'zeitfresser' ),
|
||||
'<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>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_entry_footer' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the categories, tags and comments.
|
||||
*/
|
||||
function zeitfresser_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__( ', ', 'zeitfresser' ) );
|
||||
if ( $categories_list ) {
|
||||
/* translators: 1: list of categories. */
|
||||
printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'zeitfresser' ) . '</span>', $categories_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
/* translators: used between list items, there is a space after the comma */
|
||||
$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'zeitfresser' ) );
|
||||
if ( $tags_list ) {
|
||||
/* translators: 1: list of tags. */
|
||||
printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'zeitfresser' ) . '</span>', $tags_list ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
|
||||
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>', 'zeitfresser' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
wp_kses_post( get_the_title() )
|
||||
)
|
||||
);
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
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>', 'zeitfresser' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
wp_kses_post( get_the_title() )
|
||||
),
|
||||
'<span class="edit-link">',
|
||||
'</span>'
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_post_thumbnail' ) ) :
|
||||
/**
|
||||
* Displays an optional post thumbnail.
|
||||
*
|
||||
* Wraps the post thumbnail in an anchor element on index views, or a div
|
||||
* element when on single views.
|
||||
*/
|
||||
function zeitfresser_post_thumbnail() {
|
||||
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_singular() ) :
|
||||
?>
|
||||
|
||||
<div class="post-thumbnail">
|
||||
<?php the_post_thumbnail(); ?>
|
||||
</div><!-- .post-thumbnail -->
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
|
||||
<?php
|
||||
the_post_thumbnail(
|
||||
'post-thumbnail',
|
||||
array(
|
||||
'alt' => the_title_attribute(
|
||||
array(
|
||||
'echo' => false,
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
endif; // End is_singular().
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'wp_body_open' ) ) :
|
||||
/**
|
||||
* Shim for sites older than 5.2.
|
||||
*
|
||||
* @link https://core.trac.wordpress.org/ticket/12563
|
||||
*/
|
||||
function wp_body_open() {
|
||||
do_action( 'wp_body_open' );
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* Zeitfresser helper functions.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_fs' ) ) {
|
||||
/**
|
||||
* Lightweight Freemius compatibility stub.
|
||||
*
|
||||
* The original premium theme used Freemius checks to gate premium-only controls.
|
||||
* Zeitfresser ships as a self-contained theme, so we keep a tiny compatibility
|
||||
* object instead of loading the full SDK.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function zeitfresser_fs() {
|
||||
static $stub = null;
|
||||
|
||||
if ( null === $stub ) {
|
||||
$stub = new class() {
|
||||
public function is__premium_only() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return $stub;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_social_defaults' ) ) {
|
||||
/**
|
||||
* Return default social profile URLs.
|
||||
*
|
||||
* @return array<string,string>
|
||||
*/
|
||||
function zeitfresser_get_social_defaults() {
|
||||
return array(
|
||||
'mastodon' => 'https://social.ztfr.eu/@dome',
|
||||
'github' => 'https://github.com/Domoel',
|
||||
'matrix' => 'https://look.ztfr.eu/#/@dome:ztfr.eu',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_social_link_default' ) ) {
|
||||
/**
|
||||
* Return default social URL for a given service.
|
||||
*
|
||||
* @param string $social_key Social service key.
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_get_social_link_default( $social_key ) {
|
||||
$defaults = zeitfresser_get_social_defaults();
|
||||
return isset( $defaults[ $social_key ] ) ? $defaults[ $social_key ] : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_mod' ) ) {
|
||||
/**
|
||||
* Return a cached theme modification value.
|
||||
*
|
||||
* @param string $key Theme mod key.
|
||||
* @param mixed $default Optional default value.
|
||||
* @return mixed
|
||||
*/
|
||||
function zeitfresser_get_mod( $key, $default = null ) {
|
||||
static $cache = array();
|
||||
|
||||
if ( array_key_exists( $key, $cache ) ) {
|
||||
return $cache[ $key ];
|
||||
}
|
||||
|
||||
$cache[ $key ] = get_theme_mod( $key, $default );
|
||||
|
||||
return $cache[ $key ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_social_links_settings' ) ) {
|
||||
/**
|
||||
* Return configured social links with defaults applied.
|
||||
*
|
||||
* @return array<string,string>
|
||||
*/
|
||||
function zeitfresser_get_social_links_settings() {
|
||||
$settings = array();
|
||||
|
||||
foreach ( zeitfresser_get_social_links() as $social_key => $social_label ) {
|
||||
$settings[ $social_key ] = zeitfresser_get_mod(
|
||||
'social_links_' . $social_key,
|
||||
zeitfresser_get_social_link_default( $social_key )
|
||||
);
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_social_icon_svg' ) ) {
|
||||
/**
|
||||
* Return inline SVG markup for social icons.
|
||||
*
|
||||
* @param string $key Social service key.
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_social_icon_svg( $key ) {
|
||||
$icons = array(
|
||||
'facebook' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" aria-hidden="true" focusable="false"><path d="M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"/></svg>',
|
||||
'instagram' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M8 0C5.829 0 5.556.01 4.703.048 3.85.088 3.269.222 2.76.42a3.917 3.917 0 0 0-1.417.923A3.927 3.927 0 0 0 .42 2.76C.222 3.268.087 3.85.048 4.7.01 5.555 0 5.827 0 8.001c0 2.172.01 2.444.048 3.297.04.852.174 1.433.372 1.942.205.526.478.972.923 1.417.444.445.89.719 1.416.923.51.198 1.09.333 1.942.372C5.555 15.99 5.827 16 8 16s2.444-.01 3.298-.048c.851-.04 1.434-.174 1.943-.372a3.916 3.916 0 0 0 1.416-.923c.445-.445.718-.891.923-1.417.197-.509.332-1.09.372-1.942C15.99 10.445 16 10.173 16 8s-.01-2.445-.048-3.299c-.04-.851-.175-1.433-.372-1.941a3.926 3.926 0 0 0-.923-1.417A3.911 3.911 0 0 0 13.24.42c-.51-.198-1.092-.333-1.943-.372C10.443.01 10.172 0 7.998 0h.003zm-.717 1.442h.718c2.136 0 2.389.007 3.232.046.78.035 1.204.166 1.486.275.373.145.64.319.92.599.28.28.453.546.598.92.11.281.24.705.275 1.485.039.843.047 1.096.047 3.231s-.008 2.389-.047 3.232c-.035.78-.166 1.203-.275 1.485a2.47 2.47 0 0 1-.599.919c-.28.28-.546.453-.92.598-.28.11-.704.24-1.485.276-.843.038-1.096.047-3.232.047s-2.39-.009-3.233-.047c-.78-.036-1.203-.166-1.485-.276a2.478 2.478 0 0 1-.92-.598 2.48 2.48 0 0 1-.6-.92c-.109-.281-.24-.705-.275-1.485-.038-.843-.046-1.096-.046-3.233 0-2.136.008-2.388.046-3.231.036-.78.166-1.204.276-1.486.145-.373.319-.64.599-.92.28-.28.546-.453.92-.598.282-.11.705-.24 1.485-.276.738-.034 1.024-.044 2.515-.045v.002zm4.988 1.328a.96.96 0 1 0 0 1.92.96.96 0 0 0 0-1.92zm-4.27 1.122a4.109 4.109 0 1 0 0 8.217 4.109 4.109 0 0 0 0-8.217zm0 1.441a2.667 2.667 0 1 1 0 5.334 2.667 2.667 0 0 1 0-5.334z"/></svg>',
|
||||
'youtube' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 0 1 7.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z"/></svg>',
|
||||
'linkedin' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"><path d="M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8A53.79 53.79 0 0 1 53.79 0A53.79 53.79 0 0 1 107.6 53.8c0 29.7-24.1 54.3-53.81 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2c-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.29 87.88-48.29c94 0 111.28 61.9 111.28 142.3V448z"/></svg>',
|
||||
'twitter' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path d="M459.37 151.72c.32 4.54.32 9.1.32 13.63c0 138.72-105.58 298.56-298.56 298.56c-59.45 0-114.68-17.22-161.14-47.11c8.45 1 16.57 1.32 25.34 1.32c49.06 0 94.21-16.57 130.27-44.84c-46.13-1-84.79-31.24-98.11-72.77c6.5 1 12.99 1.63 19.81 1.63c9.42 0 18.84-1.32 27.61-3.57c-48.08-9.74-84.14-51.98-84.14-102.98v-1.32c13.97 7.8 30.21 12.67 47.43 13.3c-28.3-18.84-46.78-51.02-46.78-87.39c0-19.49 5.2-37.36 14.29-52.95c51.98 63.67 129.3 105.26 216.36 109.75c-1.62-7.8-2.6-15.92-2.6-24.04c0-57.83 46.78-104.93 104.93-104.93c30.21 0 57.5 12.67 76.67 33.14c23.72-4.55 46.46-13.3 66.59-25.34c-7.8 24.37-24.37 44.84-46.13 57.83c21.12-2.27 41.58-8.12 60.42-16.24c-14.29 20.79-32.16 39.31-52.63 54.25z"/></svg>',
|
||||
'pinterest' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" aria-hidden="true" focusable="false"><path d="M204 6.7C93.4 6.7 0 100.1 0 210.7c0 69.2 40.5 128.9 101.6 161.4c-1.4-13.7-2.6-34.8.5-49.8c2.8-15.9 18.1-101.2 18.1-101.2s-4.6-9.3-4.6-23c0-21.6 12.5-37.8 28.1-37.8c13.2 0 19.6 9.9 19.6 21.8c0 13.2-8.4 33-12.7 51.3c-3.6 15.6 7.7 28.4 23 28.4c27.6 0 48.9-29.1 48.9-71.1c0-37.2-26.8-63.2-65-63.2c-44.3 0-70.3 33.1-70.3 67.5c0 13.3 5.1 27.5 11.6 35.2c1.3 1.6 1.5 3 .9 4.7c-1 5.1-3.2 16-3.6 18.2c-.6 3-2.1 3.6-4.8 2.2c-17.8-8.3-28.9-34.1-28.9-54.8c0-44.6 32.4-85.6 93.4-85.6c49 0 87.1 34.9 87.1 81.6c0 48.7-30.7 87.9-73.2 87.9c-14.3 0-27.7-7.4-32.3-16.2l-8.8 33.5c-3.2 12.2-11.8 27.5-17.6 36.8c13.2 4.1 27.1 6.2 41.5 6.2c110.6 0 204-93.4 204-204S314.6 6.7 204 6.7z"/></svg>',
|
||||
'tiktok' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"><path d="M448,209.9a210.06,210.06,0,0,1-122.77-39.25V349.38A162.55,162.55,0,1,1,185,188.31V278.2a74.62,74.62,0,1,0,52.23,71.18V0h88a121.18,121.18,0,0,0,1.86,22.17h0A122.18,122.18,0,0,0,448,142.3Z"/></svg>',
|
||||
'mastodon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"><path d="M433 179.11c0-97.2-63.91-125.7-63.91-125.7C336.42 38.4 279.2 32 224.14 32h-.27c-55.06 0-112.28 6.4-144.95 21.41c0 0-63.92 28.5-63.92 125.7c0 22.34-.43 49.13.27 81.78c2.31 109.32 20.05 217.01 121.08 241.82c46.64 11.45 86.68 13.84 119.46 12.06c59.08-3.2 92.27-20.62 92.27-20.62l-1.96-43.47s-42.3 13.33-89.78 11.72c-47.03-1.6-96.73-5.09-104.41-63.16a116.85 116.85 0 0 1-1.06-15.65s46.27 11.3 104.92 13.99c35.27 1.62 68.32-2.06 101.96-6.15c64.49-7.83 120.53-48.23 127.62-85.36c11.18-58.65 10.26-143.5 10.26-143.5zm-80.32 145.27h-50.54V200.59c0-26.15-11.06-39.43-33.17-39.43c-24.46 0-36.72 15.84-36.72 47.1v67.82H181.8V208.26c0-31.26-12.26-47.1-36.73-47.1c-22.1 0-33.16 13.28-33.16 39.43v123.79H61.37V196.83c0-26.15 6.68-46.92 20.03-62.31c13.75-15.39 31.75-23.14 54.09-23.14c25.82 0 45.34 9.92 58.74 29.76l12.69 21.11l12.69-21.11c13.4-19.84 32.92-29.76 58.75-29.76c22.33 0 40.34 7.75 54.08 23.14c13.36 15.39 20.04 36.16 20.04 62.31z"/></svg>',
|
||||
'github' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512" aria-hidden="true" focusable="false"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6c-3.3.3-5.6-1.3-5.6-3.6c0-2 2.3-3.6 5.2-3.6c3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9c2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9c.3 2 2.6 3.3 5.6 2.6c2.9-.7 4.9-2.6 4.6-4.6c-.3-2.3-2.6-3.6-5.6-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 71.8 205 171.6 238.2c12.8 2.3 17.5-5.6 17.5-12.1c0-6.2-.3-40.4-.3-61.4c0 0-70 15-84.7-29.8c0 0-11.4-29.1-27.8-36.9c0 0-22.9-15.7 1.6-15.4c0 0 24.9 2 38.6 25.8c21.9 38.6 58.6 27.5 72.9 20.9c2.3-16 8.8-27.5 16-33.7c-55.9-6.2-112.3-13.9-112.3-110.5c0-27.5 7.8-41.4 20.6-55.2c-2-5-8.8-25.7 2-53.6c16.1-5 52.6 20.6 52.6 20.6c15.2-4.3 31.4-6.5 47.6-6.5c16.3 0 32.8 2.3 47.7 6.5c0 0 36.6-25.8 52.6-20.6c10.8 27.8 4 48.6 2 53.6c12.8 13.8 20.6 27.8 20.6 55.2c0 96.9-58.8 104.2-114.9 110.5c9.2 7.8 17.2 22.9 17.2 46.4c0 33.7-.3 75.4-.3 83.1c0 6.5 4.6 14.4 17.5 12.1C424.2 457 496 362.9 496 252C496 113.3 383.5 8 244.8 8z"/></svg>',
|
||||
'matrix' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" aria-hidden="true" focusable="false"><path d="M0 32v448h60V0H0v32zm580 0v448h60V0h-60v32zM120 96v320h70V206.8l77.7 117.8h4.6L350 206.8V416h70V96h-68l-81.4 122.6L189 96h-69z"/></svg>',
|
||||
);
|
||||
|
||||
return isset( $icons[ $key ] ) ? $icons[ $key ] : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Backward-compatible Freemius helper alias.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function db_fs() {
|
||||
return zeitfresser_fs();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Backward-compatible social default alias.
|
||||
*
|
||||
* @param string $social_key Social service key.
|
||||
* @return string
|
||||
*/
|
||||
function graphthemes_get_social_link_default( $social_key ) {
|
||||
return zeitfresser_get_social_link_default( $social_key );
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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 zeitfresser
|
||||
*/
|
||||
|
||||
get_header();
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="archive-wrapper">
|
||||
<main id="primary" 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;
|
||||
?>
|
||||
<div class="custom-grid-view">
|
||||
<?php
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
|
||||
/*
|
||||
* Include the Post-Type-specific template for the content.
|
||||
* If you want to override this in a child theme, then include a file
|
||||
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
|
||||
*/
|
||||
get_template_part( 'template-parts/content', get_post_type() );
|
||||
|
||||
endwhile;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
zeitfresser_numeric_pagination();
|
||||
|
||||
else :
|
||||
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
endif;
|
||||
?>
|
||||
</main><!-- #main -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
@@ -0,0 +1,42 @@
|
||||
/* global wp, jQuery */
|
||||
/**
|
||||
* 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 ) );
|
||||
Vendored
+9
File diff suppressed because one or more lines are too long
@@ -0,0 +1,161 @@
|
||||
/**
|
||||
* File navigation.js.
|
||||
*
|
||||
* Handles toggling the navigation menu for small screens and enables TAB key
|
||||
* navigation support for dropdown menus.
|
||||
*/
|
||||
|
||||
/**
|
||||
* File navigation.js.
|
||||
*
|
||||
* Handles toggling the navigation menu for small screens and enables TAB key
|
||||
* navigation support for dropdown menus.
|
||||
*/
|
||||
( function() {
|
||||
var container, button, menu, links, i, len;
|
||||
|
||||
container = document.getElementById( 'site-navigation' );
|
||||
if ( ! container ) {
|
||||
return;
|
||||
}
|
||||
|
||||
button = container.getElementsByTagName( 'button' )[0];
|
||||
if ( 'undefined' === typeof button ) {
|
||||
return;
|
||||
}
|
||||
|
||||
menu = container.getElementsByTagName( 'ul' )[0];
|
||||
|
||||
// Hide menu toggle button if menu is empty and return early.
|
||||
if ( 'undefined' === typeof menu ) {
|
||||
button.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
|
||||
menu.className += ' nav-menu';
|
||||
}
|
||||
|
||||
button.onclick = function() {
|
||||
if ( -1 !== container.className.indexOf( 'toggled' ) ) {
|
||||
container.className = container.className.replace( ' toggled', '' );
|
||||
button.setAttribute( 'aria-expanded', 'false' );
|
||||
} else {
|
||||
container.className += ' toggled';
|
||||
button.setAttribute( 'aria-expanded', 'true' );
|
||||
}
|
||||
};
|
||||
|
||||
function handleTabPress (e){
|
||||
if((e.keyCode === 9 || e.key === 'Tab') && !e.shiftKey){
|
||||
container.classList.remove('toggled')
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
const toggleButton = document.querySelector('.menu-toggle');
|
||||
toggleButton.setAttribute('tabindex', -1);
|
||||
toggleButton.focus()
|
||||
toggleButton.setAttribute('tabindex', 0);
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function handleSiftTabPress(e){
|
||||
if(e.shiftKey && (e.keyCode === 9 || e.key === 'Tab') && e.target.classList.contains('menu-toggle') ){
|
||||
container.classList.remove('toggled')
|
||||
button.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setupResponsiveMenu (e){
|
||||
document.querySelector('#site-navigation').addEventListener('keydown', handleSiftTabPress)
|
||||
if (window.innerWidth < 1200) {
|
||||
if(document.querySelector("#primary-menu > .menu-item:last-of-type > .sub-menu > .menu-item > .sub-menu > .menu-item, #primary-menu > .nav-menu > .page_item:last-of-type > .children > .page_item > .children > .page_item")){
|
||||
document.querySelector("#primary-menu > .menu-item:last-of-type > .sub-menu > .menu-item:last-of-type > .sub-menu > .menu-item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type > .children > .page_item:last-of-type > .children > .page_item:last-of-type").addEventListener("keydown", handleTabPress);
|
||||
}
|
||||
else if(document.querySelector("#primary-menu > .menu-item:last-of-type > .sub-menu > .menu-item, #primary-menu > .nav-menu > .page_item:last-of-type > .children > .page_item")){
|
||||
document.querySelector("#primary-menu > .menu-item:last-of-type > .sub-menu > .menu-item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type > .children > .page_item:last-of-type").addEventListener("keydown", handleTabPress);
|
||||
} else {
|
||||
if( document.querySelector("#primary-menu > .menu-item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type") != null )
|
||||
document.querySelector("#primary-menu > .menu-item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type").addEventListener("keydown", handleTabPress);
|
||||
}
|
||||
|
||||
}else{
|
||||
if( document.querySelector("#primary-menu > .menu-item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type") != null )
|
||||
document.querySelector("#primary-menu > .menu-item:last-of-type, #primary-menu > .menu-item:last-of-type > .sub-menu > .menu-item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type, #primary-menu > .nav-menu > .page_item:last-of-type > .children > .page_item:last-of-type").removeEventListener("keydown", handleTabPress);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('resize', setupResponsiveMenu);
|
||||
setupResponsiveMenu();
|
||||
|
||||
|
||||
// Close small menu when user clicks outside
|
||||
document.addEventListener( 'click', function( event ) {
|
||||
var isClickInside = container.contains( event.target );
|
||||
|
||||
if ( ! isClickInside ) {
|
||||
container.className = container.className.replace( ' toggled', '' );
|
||||
button.setAttribute( 'aria-expanded', 'false' );
|
||||
}
|
||||
} );
|
||||
|
||||
// Get all the link elements within the menu.
|
||||
links = menu.getElementsByTagName( 'a' );
|
||||
|
||||
// Each time a menu link is focused or blurred, toggle focus.
|
||||
for ( i = 0, len = links.length; i < len; i++ ) {
|
||||
links[i].addEventListener( 'focus', toggleFocus, true );
|
||||
links[i].addEventListener( 'blur', toggleFocus, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or removes .focus class on an element.
|
||||
*/
|
||||
function toggleFocus() {
|
||||
var self = this;
|
||||
|
||||
// Move up through the ancestors of the current link until we hit .nav-menu.
|
||||
while ( -1 === self.className.indexOf( 'nav-menu' ) ) {
|
||||
// On li elements toggle the class .focus.
|
||||
if ( 'li' === self.tagName.toLowerCase() ) {
|
||||
if ( -1 !== self.className.indexOf( 'focus' ) ) {
|
||||
self.className = self.className.replace( ' focus', '' );
|
||||
} else {
|
||||
self.className += ' focus';
|
||||
}
|
||||
}
|
||||
|
||||
self = self.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles `focus` class to allow submenu access on tablets.
|
||||
*/
|
||||
( function() {
|
||||
var touchStartFn,
|
||||
parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' );
|
||||
|
||||
if ( 'ontouchstart' in window ) {
|
||||
touchStartFn = function( e ) {
|
||||
var menuItem = this.parentNode;
|
||||
|
||||
if ( ! menuItem.classList.contains( 'focus' ) ) {
|
||||
e.preventDefault();
|
||||
for ( i = 0; i < menuItem.parentNode.children.length; ++i ) {
|
||||
if ( menuItem === menuItem.parentNode.children[i] ) {
|
||||
continue;
|
||||
}
|
||||
menuItem.parentNode.children[i].classList.remove( 'focus' );
|
||||
}
|
||||
menuItem.classList.add( 'focus' );
|
||||
} else {
|
||||
menuItem.classList.remove( 'focus' );
|
||||
}
|
||||
};
|
||||
|
||||
for ( i = 0; i < parentLink.length; ++i ) {
|
||||
parentLink[i].addEventListener( 'touchstart', touchStartFn, false );
|
||||
}
|
||||
}
|
||||
}( container ) );
|
||||
}() );
|
||||
@@ -0,0 +1,40 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var scrollToTop = document.querySelector('.scroll-to-top');
|
||||
var navToggle = document.getElementById('nav-icon3');
|
||||
var grid = document.querySelector('.blog-grid-view');
|
||||
|
||||
function updateScrollButton() {
|
||||
if (!scrollToTop) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (window.scrollY > 1) {
|
||||
scrollToTop.classList.add('show');
|
||||
} else {
|
||||
scrollToTop.classList.remove('show');
|
||||
}
|
||||
}
|
||||
|
||||
if (scrollToTop) {
|
||||
updateScrollButton();
|
||||
|
||||
window.addEventListener('scroll', updateScrollButton, { passive: true });
|
||||
|
||||
scrollToTop.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
}
|
||||
|
||||
if (navToggle) {
|
||||
navToggle.addEventListener('click', function () {
|
||||
navToggle.classList.toggle('open');
|
||||
});
|
||||
}
|
||||
|
||||
if (grid && typeof Masonry !== 'undefined') {
|
||||
new Masonry(grid, {
|
||||
itemSelector: '.type-post'
|
||||
});
|
||||
}
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user