...
 
Commits (5)
......@@ -18,6 +18,7 @@ add_filter('admin_email_check_interval', '__return_false', 10, 0);
/**
* Display number of published media items in "At a Glance" box.
*
* @global \wpdb $wpdb
* @param array $items
* @return array
......@@ -49,20 +50,21 @@ add_action('admin_print_styles-index.php', function () {
/**
* Alter post state info for gallery, tags and media parent pages.
*
* @param array $post_states
* @param \WP_Post $post
* @return array
*/
add_filter('display_post_states', function (array $post_states, \WP_Post $post): array {
if ($post->ID === intval(get_option(B13R_GALLERY_PAGE, 0))) {
if ($post->ID === get_option(B13R_GALLERY_PAGE, 0)) {
$post_states['b13r_gallery_page'] = __('Gallery Page', 'bezirksblaetter');
}
if ($post->ID === intval(get_option(B13R_MEDIA_PARENT_PAGE, 0))) {
if ($post->ID === get_option(B13R_MEDIA_PARENT_PAGE, 0)) {
$post_states['b13r_media_parent_page'] = __('Media Parent Page', 'bezirksblaetter');
}
if ($post->ID === intval(get_option(B13R_TAGS_PAGE, 0))) {
if ($post->ID === get_option(B13R_TAGS_PAGE, 0)) {
$post_states['b13r_tags_page'] = __('Tags Page', 'bezirksblaetter');
}
......@@ -90,6 +92,7 @@ add_filter('image_downsize', function (bool $downsize, ?int $id, $size) {
/**
* Add meta box with image metadata to attachment edit screen.
*
* @param \WP_Post $post
*/
add_action('add_meta_boxes_attachment', function (\WP_Post $post) {
......@@ -101,6 +104,7 @@ add_action('add_meta_boxes_attachment', function (\WP_Post $post) {
/**
* Render meta box with attachment image metadata.
*
* @param \WP_Post $post
*/
function render_media_image_metadata_meta_box(\WP_Post $post)
......@@ -145,6 +149,7 @@ add_action('add_meta_boxes_attachment', function () {
/**
* Render meta box with menu order.
*
* @param \WP_Post $post
*/
function render_media_menu_order_meta_box(\WP_Post $post)
......
......@@ -27,8 +27,151 @@ add_action('after_setup_theme', function () {
}, 10, 0);
/**
* Include attachments in suggestions offered by "Insert link" box.
*
* @internal By default attachments are not included because of their `inherit` post status.
*
* @param array $results An array of results associative array of query results.
* @param array $query An array of WP_Query arguments.
*
* @return array Filtered array of $results.
*/
add_filter('wp_link_query', function (array $results, array $query): array {
if (0 === ($media_parent_page = get_option(B13R_MEDIA_PARENT_PAGE, 0))) {
// Do nothing if media parent page is not set.
return $results;
}
// Grab a hint whether the link is being inserted from media gallery/tag or page/post edit screen.
$post_id = filter_input(INPUT_POST, 'b13r_post_id', FILTER_VALIDATE_INT);
$term_id = filter_input(INPUT_POST, 'b13r_term_id', FILTER_VALIDATE_INT);
$taxonomy = filter_input(INPUT_POST, 'b13r_taxonomy', FILTER_SANITIZE_STRING);
// The implementation inherently assumes these two can never be both true at the same time.
$is_post_edit_screen = $post_id !== null;
$is_term_edit_screen = $term_id !== null && $taxonomy !== '';
if ($is_term_edit_screen && !empty($query['offset'])) {
// When fetching results for term edit screen, all results are provided in one go, therefore ignore paging requests.
return $results;
}
$attachment_query = [
'post_type' => 'attachment', // Note: proper post_status is set by get_posts() automatically for attachment post type.
// These are taken verbatim from wp_link_query().
'suppress_filters' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
// These are B13R extras:
'post_parent' => $media_parent_page,
];
// Include search term if provided.
if (isset($query['s'])) {
$attachment_query['s'] = $query['s'];
}
if ($is_post_edit_screen) {
// Keep paging working.
$attachment_query['posts_per_page'] = $query['posts_per_page'] ?? 20;
$attachment_query['offset'] = $query['offset'] ?? 0;
}
if ($is_term_edit_screen) {
// Limit the results only to attachments assigned the particular media gallery/tag being edited.
// https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
$attachment_query['tax_query'] = [
[
'taxonomy' => $taxonomy,
'field' => 'term_id',
'terms' => $term_id,
],
];
// Fetch all results right away.
$attachment_query['posts_per_page'] = -1;
}
$attachments = get_posts($attachment_query);
// Build results.
$attachment_results = [];
foreach ($attachments as $attachment) {
// If media gallery or media tag is edited, display link to the image.
if ($is_term_edit_screen && wp_attachment_is_image($attachment)) {
// Add link to attachment file.
$attachment_results[] = [
'ID' => $attachment->ID,
'title' => trim(esc_html(strip_tags(get_the_title($attachment)))),
'permalink' => wp_get_attachment_image_url($attachment->ID, 'full'),
'info' => __('Photo file', 'bezirksblaetter'),
];
}
if ($is_post_edit_screen) {
// Add link to attachment page.
$attachment_results[] = [
'ID' => $attachment->ID,
'title' => trim(esc_html(strip_tags(get_the_title($attachment)))),
'permalink' => get_permalink($attachment),
'info' => __('Photo page', 'bezirksblaetter'),
];
}
}
// Prefer media-related results over default ones.
return $attachment_results + $results;
}, 10, 2);
/**
* Add a signal to `wp-link-ajax` action whether post/page or media gallery/tag is being edited.
*
* @internal Implementation inspired by Polylang.
*
* @global $post_ID
* @global $tag_ID
* @global $taxonomy
*/
add_action('admin_print_footer_scripts', function () {
global $post_ID, $tag_ID, $taxonomy;
$params = [];
if (!empty($post_ID)) {
$params['b13r_post_id'] = $post_ID;
}
if (!empty($tag_ID)) {
$params['b13r_term_id'] = $tag_ID;
}
if (!empty($taxonomy)) {
$params['b13r_taxonomy'] = $taxonomy;
}
if (($query = http_build_query($params)) !== '') {
?>
<script>
if (typeof jQuery !== 'undefined') {
(function($) {
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
// Inject custom query data only into `wp-link-ajax` requests.
if ( typeof originalOptions.data === 'object'
&& originalOptions.data.hasOwnProperty('action')
&& originalOptions.data.action === 'wp-link-ajax'
&& typeof options.data === 'string'
) {
options.data += '&<?= $query; ?>';
}
});
})(jQuery);
}
</script>
<?php
}
}, 1, 0);
/**
* Make attachments query-able and searchable. Disable paging and adjust ordering on attachment taxonomy pages.
*
* @param \WP_Query $query
* @return \WP_Query
*/
......@@ -64,6 +207,7 @@ add_filter('template_redirect', function () {
/**
* Add rel="prev" and image title to previous image link.
*
* @param string $output
* @param int $attachment_id
* @return string
......@@ -75,6 +219,7 @@ add_filter('previous_image_link', function (string $output, int $attachment_id):
/**
* Add rel="next" and image title to next image link.
*
* @param string $output
* @param int $attachment_id
* @return string
......@@ -134,11 +279,11 @@ add_filter('wp_insert_attachment_data', function (array $data, array $postarr):
/**
* Set post parent ID to post page
* Set post parent ID of newly inserted attachments to the "Media parent" page.
*/
add_filter('wp_insert_post_parent', function (int $post_parent, int $post_id, array $post_data, array $raw_data): int {
if ($post_parent !== 0) {
// Only modify post parent, if not set explicitly.
// Only modify post parent if not set explicitly.
return $post_parent;
}
if ($post_data['post_type'] !== 'attachment') {
......
......@@ -22,6 +22,7 @@ remove_action('wp_enqueue_scripts', 'wp_common_block_scripts_and_styles');
/**
* Remove author from media table column.
*
* @param array $posts_columns
* @return array
*/
......@@ -34,6 +35,7 @@ add_filter('manage_media_columns', function (array $posts_columns): array {
if (class_exists('\Cachify')) {
/**
* Alter time to live of captcha data if Cachify plugin is installed.
*
* @return int
*/
add_filter('bezirksblaetter/captcha_ttl', function (): int {
......@@ -55,6 +57,7 @@ if (interface_exists(\BlueChip\Security\Modules\Checklist\Hooks::class)) {
* Ignore premium plugins in core integrity check.
*
* @param array $plugins
*
* @return array
*/
add_filter(\BlueChip\Security\Modules\Checklist\Hooks::PLUGINS_TO_CHECK_FOR_INTEGRITY, function (array $plugins): array {
......@@ -67,6 +70,7 @@ if (interface_exists(\BlueChip\Security\Modules\Checklist\Hooks::class)) {
* Ignore premium plugins in removed plugins check.
*
* @param array $plugins
*
* @return array
*/
add_filter(\BlueChip\Security\Modules\Checklist\Hooks::PLUGINS_TO_CHECK_FOR_REMOVAL, function (array $plugins): array {
......@@ -79,6 +83,7 @@ if (interface_exists(\BlueChip\Security\Modules\Checklist\Hooks::class)) {
/**
* Filter (set) regex for auto-determination of media files. The regex is applied to file's basename.
*
* @return string
*/
add_filter('bezirksblaetter/media_filename_regex', function (): string {
......
......@@ -20,6 +20,7 @@ define('B13R_CAPTCHA_CHECKSUM', 'b13r_captcha_checksum');
/**
* Generate random math question.
*
* @return array
*/
function generate_math_question(): array
......@@ -58,7 +59,8 @@ function generate_math_question(): array
/**
* Generate checksum for given $timestamp and $result values. Uses wp_hash() internally to make checksum site specific.
*
* @see wp_hash
* @see wp_hash()
*
* @param string $timestamp
* @param string $result
* @return string
......@@ -71,6 +73,7 @@ function generate_checksum(string $timestamp, string $result): string
/**
* Add captcha fields to comment form fields.
*
* @param array $comment_fields
* @return array
*/
......
......@@ -14,6 +14,7 @@ namespace App\Frontend;
* @global \WP_Query $wp_query
* @global \WP_Post $post
* @param array $classes
*
* @return array
*/
add_filter('body_class', function (array $classes): array {
......@@ -43,9 +44,9 @@ add_filter('body_class', function (array $classes): array {
$classes[] = 'image-header-on';
$queried_object = $wp_query->get_queried_object();
if (\App\is_image($queried_object)) {
if (\App\isImage($queried_object)) {
$classes[] = 'attachment-image';
} else if (\App\is_video($queried_object)) {
} else if (\App\isVideo($queried_object)) {
$classes[] = 'attachment-video';
}
}
......@@ -55,7 +56,8 @@ add_filter('body_class', function (array $classes): array {
/**
* Clean up the_excerpt()
* Clean up the_excerpt().
*
* @return string
*/
add_filter('excerpt_more', function (): string {
......@@ -65,13 +67,15 @@ add_filter('excerpt_more', function (): string {
/**
* Insert SVG icon after "Reply" text in comments template.
*
* @param string $link Full "reply-to" link body.
*
* @return string
*/
add_filter('comment_reply_link', function (string $link): string {
$matches = [];
if (preg_match('#(.*<a[^<>]+>)([^<>]+)(</a>.*)#', $link, $matches)) {
return $matches[1] . \App\content_with_svg_icon($matches[2], '', 'mail-reply') . $matches[3];
return $matches[1] . \App\contentWithSvgIcon($matches[2], '', 'mail-reply') . $matches[3];
}
return $link;
}, 10, 1);
......@@ -79,9 +83,11 @@ add_filter('comment_reply_link', function (string $link): string {
/**
* Filter (replace) output of built-in `post_gallery` shortcode.
*
* @param string $output
* @param array $attr
* @param string $instance
*
* @return string
*/
add_filter('post_gallery', function (string $output, array $attr, string $instance): string {
......
......@@ -12,9 +12,10 @@ use CeP\Bezirksblaetter\Template;
/**
* @param string $layout
*
* @return \CeP\Bezirksblaetter\Template
*/
function template(string $layout = 'base'): Template
function getTemplate(string $layout = 'base'): Template
{
return Template::$instances[$layout];
}
......@@ -25,42 +26,43 @@ function template(string $layout = 'base'): Template
* @param array $context
* @param string $layout
*/
function template_part(string $template, array $context = [], string $layout = 'base')
function includeTemplatePart(string $template, array $context = [], string $layout = 'base')
{
extract($context);
include template($layout)->partial($template);
include getTemplate($layout)->partial($template);
}
/**
* Return path to theme asset with $filename (relative to assets/dist directory).
* @param string $filename
* @return string
*
* @return string Absolute path to theme asset with $filename (relative to assets/dist directory)
*/
function asset_path(string $filename): string
function getAssetPath(string $filename): string
{
return get_theme_file_path('assets/dist/' . $filename);
}
/**
* Return URI to theme asset with $filename (relative to assets/dist directory).
* @param string $filename
* @return string
*
* @return string Absolute URI to theme asset with $filename (relative to assets/dist directory)
*/
function asset_uri(string $filename): string
function getAssetUri(string $filename): string
{
return get_theme_file_uri('assets/dist/' . $filename);
}
/**
* Return true, if script with given $handle is enqueued in the moment.
* @global \WP_Scripts $wp_scripts
*
* @param string $handle
* @return bool
*
* @return bool True if script with given $handle is enqueued in the moment.
*/
function is_script_enqueued(string $handle): bool
function isScriptEnqueued(string $handle): bool
{
global $wp_scripts;
return in_array($handle, $wp_scripts->queue);
......@@ -68,20 +70,20 @@ function is_script_enqueued(string $handle): bool
/**
* Return true, if $post has MIME type image/*.
* @param \WP_Post $post
* @return bool
*
* @return bool True if $post has MIME type image/*, false otherwise.
*/
function is_image(\WP_Post $post): bool {
function isImage(\WP_Post $post): bool {
return strpos($post->post_mime_type, 'image/') === 0;
}
/**
* Return true, if $post has MIME type video/*.
* @param \WP_Post $post
* @return bool
*
* @return bool True if $post has MIME type video/*, false otherwise.
*/
function is_video(\WP_Post $post): bool {
function isVideo(\WP_Post $post): bool {
return strpos($post->post_mime_type, 'video/') === 0;
}
......@@ -54,6 +54,7 @@ if (class_exists('NginxCache')) {
* @link https://polylang.pro/doc/filter-reference/
*
* @param array $taxonomies
*
* @return array
*/
add_filter('pll_copy_taxonomies', function (array $taxonomies): array {
......@@ -68,6 +69,7 @@ if (function_exists('pll_get_post')) {
* Polylang: Translate page ID of pages set via options, if possible.
*
* @param int $value
*
* @return int
*/
function translate_option(int $value): int
......@@ -88,6 +90,7 @@ if (function_exists('pll_get_post_translations')) {
*
* @param array $post_states
* @param \WP_Post $post
*
* @return array
*/
add_filter('display_post_states', function (array $post_states, \WP_Post $post): array {
......@@ -150,6 +153,7 @@ if (function_exists('pll_current_language') && function_exists('pll_translate_st
* Translate page slug in canonical URLs.
*
* @param string $canonical_url
*
* @return string
*/
add_filter('get_canonical_url', function (string $canonical_url): string {
......@@ -164,7 +168,9 @@ if (function_exists('pll_current_language') && function_exists('pll_translate_st
/**
* Ensure the admin bar is rendered in user's language (snippet 1 of 2).
*
* @link https://github.com/polylang/polylang/issues/201#issuecomment-348178243
*
* @requires WordPress 4.7
*/
add_action('admin_bar_menu', function () {
......@@ -173,11 +179,13 @@ add_action('admin_bar_menu', function () {
/**
* Ensure the admin bar is rendered in user's language (snippet 2 of 2).
*
* @link https://github.com/polylang/polylang/issues/201#issuecomment-348178243
*
* @requires WordPress 4.7
*/
add_action('admin_bar_menu', function () {
restore_previous_locale();
restore_previous_locale();
}, 100, 0);
......@@ -185,6 +193,7 @@ add_action('admin_bar_menu', function () {
* Skip Statify tracking for configured IP addresses.
*
* @param bool|null $skip
*
* @return bool|null
*/
if (defined('STATIFY_IGNORE_REMOTE_ADDRESSES')) {
......
......@@ -102,6 +102,7 @@ add_action('admin_init', function () {
/**
* Render select box for $option_name setting.
*
* @param string $option_name
*/
function render_page_selection_field(string $option_name)
......@@ -127,6 +128,7 @@ function render_page_selection_field(string $option_name)
/**
* Render numerical input for $option_name setting with optional additional $info.
*
* @param string $option_name
* @param string $info
*/
......
......@@ -3,8 +3,6 @@
* @package Bezirksblätter
*/
namespace App;
use CeP\Bezirksblaetter\Template;
use CeP\Bezirksblaetter\Template\Wrapper;
......@@ -72,19 +70,19 @@ add_action('wp_enqueue_scripts', function () {
$suffix = SCRIPT_DEBUG ? '' : '.min';
// Colcade -- only register (enqueued when needed)
wp_register_script('colcade', asset_uri("vendor/colcade/colcade{$suffix}.js"), [], '0.2.0', true);
wp_register_script('colcade', \App\getAssetUri("vendor/colcade/colcade{$suffix}.js"), [], '0.2.0', true);
// Photoswipe -- only register (enqueued when needed) scripts (styles are compiled into main.css):
wp_register_script('photoswipe-core', asset_uri("vendor/photoswipe/photoswipe{$suffix}.js"), [], '4.1.3', true);
wp_register_script('photoswipe-ui', asset_uri("vendor/photoswipe/photoswipe-ui-default{$suffix}.js"), ['photoswipe-core'], '4.1.3', true);
wp_register_script('photoswipe', asset_uri("js/photoswipe{$suffix}.js"), ['photoswipe-core', 'photoswipe-ui'], filemtime(asset_path("js/photoswipe{$suffix}.js")), true);
wp_register_script('photoswipe-core', \App\getAssetUri("vendor/photoswipe/photoswipe{$suffix}.js"), [], '4.1.3', true);
wp_register_script('photoswipe-ui', \App\getAssetUri("vendor/photoswipe/photoswipe-ui-default{$suffix}.js"), ['photoswipe-core'], '4.1.3', true);
wp_register_script('photoswipe', \App\getAssetUri("js/photoswipe{$suffix}.js"), ['photoswipe-core', 'photoswipe-ui'], filemtime(\App\getAssetPath("js/photoswipe{$suffix}.js")), true);
// Media grid -- only register (see above)
wp_register_script('media-grid', asset_uri("js/media-grid{$suffix}.js"), ['colcade'], filemtime(asset_path("js/media-grid{$suffix}.js")), true);
wp_register_script('media-grid', \App\getAssetUri("js/media-grid{$suffix}.js"), ['colcade'], filemtime(\App\getAssetPath("js/media-grid{$suffix}.js")), true);
// Object fit polyfill - only register (see above)
wp_register_script('object-fit-polyfill', asset_uri("vendor/object-fit-images/ofi{$suffix}.js"), [], '3.2.4', true);
wp_register_script('object-fit-polyfill', \App\getAssetUri("vendor/object-fit-images/ofi{$suffix}.js"), [], '3.2.4', true);
// Main stylesheet and script is always needed
wp_enqueue_style('bezirksblaetter', asset_uri("css/main{$suffix}.css"), [], filemtime(asset_path("css/main{$suffix}.css")));
wp_enqueue_script('bezirksblaetter', asset_uri("js/main{$suffix}.js"), [], filemtime(asset_path("js/main{$suffix}.js")), true);
wp_enqueue_style('bezirksblaetter', \App\getAssetUri("css/main{$suffix}.css"), [], filemtime(\App\getAssetPath("css/main{$suffix}.css")));
wp_enqueue_script('bezirksblaetter', \App\getAssetUri("js/main{$suffix}.js"), [], filemtime(\App\getAssetPath("js/main{$suffix}.js")), true);
}, 100, 0);
......@@ -100,7 +98,7 @@ add_action('wp_head', function () {
<meta property="og:type" content="blog">
<meta property="og:title" content="<?= wp_get_document_title(); ?>">
<meta property="og:url" content="<?= esc_attr(home_url(add_query_arg(null, null))); ?>">
<?php if (is_attachment() && is_image($wp_query->get_queried_object())) { ?>
<?php if (is_attachment() && \App\isImage($wp_query->get_queried_object())) { ?>
<meta property="og:image" content="<?= esc_attr(wp_get_attachment_image_url(null, 'medium')); ?>">
<?php }
}, 20, 0);
......@@ -109,8 +107,8 @@ add_action('wp_head', function () {
/**
* Add inline JS code to document's <head> in order to:
* - turn html.no-js into html.js
* - make cookie names available in JS
* - trigger actions (lights off, zoom in) according to stored cookie state
* - make URL to icons.svg available in JS
* - trigger actions (lights off, zoom in) according to stored state
*/
add_action('wp_head', function () {
?>
......@@ -120,11 +118,11 @@ add_action('wp_head', function () {
content_with_svg_icon: function (content, icon_before, icon_after) {
var output = '';
if (icon_before) {
output += '<svg class="icon"><use xlink:href="<?= asset_uri('icons.svg'); ?>#' + icon_before + '"></svg>';
output += '<svg class="icon"><use xlink:href="<?= \App\getAssetUri('icons.svg'); ?>#' + icon_before + '"></svg>';
}
output += '<span class="label">' + content + '</span>';
if (icon_after) {
output += '<svg class="icon"><use xlink:href="<?= asset_uri('icons.svg'); ?>#' + icon_after + '"></svg>';
output += '<svg class="icon"><use xlink:href="<?= \App\getAssetUri('icons.svg'); ?>#' + icon_after + '"></svg>';
}
return output;
}
......@@ -160,8 +158,11 @@ add_filter('template_include', function ($main) {
/**
* Exclude directories with no template files from WP_theme::scandir()
*
* @link https://core.trac.wordpress.org/ticket/38292
*
* @param array $exclusions
*
* @return array
*/
add_filter('theme_scandir_exclusions', function (array $exclusions): array {
......@@ -171,10 +172,13 @@ add_filter('theme_scandir_exclusions', function (array $exclusions): array {
/**
* Alter template inclusion:
* - return "templates/partials/gallery.php" as page template, if current page is "the gallery page"
* - return "templates/partials/tags.php" as page template, if current page is "the tag page"
* - Return "templates/partials/gallery.php" as page template if current page is "the gallery page".
* - Return "templates/partials/tags.php" as page template if current page is "the tag page".
*
* @link https://markjaquith.wordpress.com/2014/02/19/template_redirect-is-not-for-loading-templates/
*
* @param string $template
*
* @return string
*/
add_filter('template_include', function (string $template): string {
......
......@@ -10,6 +10,7 @@ namespace App;
/**
* Return page title. Title depends on main query type.
*
* @return string
*/
function pageTitle(): string
......@@ -55,9 +56,9 @@ function galleryLink(\WP_Term $gallery, string $rel, string $icon_before = '', s
get_term_link($gallery),
esc_attr($gallery->description),
esc_attr($rel),
$icon_before ? svg_use_icon($icon_before) : '',
$icon_before ? svgUseIcon($icon_before) : '',
esc_html($gallery->name),
$icon_after ? svg_use_icon($icon_after) : ''
$icon_after ? svgUseIcon($icon_after) : ''
);
}
......@@ -149,7 +150,7 @@ function contextualMenu(): array
}
// Every contextual menu starts with a link to home page
array_unshift($items, ['class' => 'home', 'href' => home_url('/'), 'rel' => 'home', 'title' => get_option('blogname'), 'content' => svg_use_icon('camera', true) . svg_use_icon('camera-outline', true)]);
array_unshift($items, ['class' => 'home', 'href' => home_url('/'), 'rel' => 'home', 'title' => get_option('blogname'), 'content' => svgUseIcon('camera', true) . svgUseIcon('camera-outline', true)]);
return [ 'class' => $class, 'items' => $items, ];
}
......@@ -161,6 +162,7 @@ function contextualMenu(): array
* @param string $gallery
* @param array $attachments
* @param string $size
*
* @return string
*/
function mediaGrid(string $gallery, array $attachments, string $size = 'medium'): string
......@@ -177,7 +179,7 @@ function mediaGrid(string $gallery, array $attachments, string $size = 'medium')
foreach ($attachments as $attachment) {
if (!is_image($attachment) && !is_video($attachment)) {
if (!isImage($attachment) && !isVideo($attachment)) {
// Only images and videos are supported in the moment
continue;
}
......@@ -188,12 +190,12 @@ function mediaGrid(string $gallery, array $attachments, string $size = 'medium')
$attachment_caption = wp_get_attachment_caption($attachment_id);
$attachment_metadata = wp_get_attachment_metadata($attachment_id);
if (is_image($attachment)) {
if (isImage($attachment)) {
$output
.= '<div class="grid-item pswp-item" data-item-index="' . $image_index++ . '">'
. '<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">'
. getPhotoSwipeLink($attachment_id, wp_get_attachment_image($attachment_id, $size), ['title' => $attachment_title])
. '<a class="pswp-detail info-link" href="' . $attachment_link . '" title="' . esc_attr__('More about photo', 'bezirksblaetter') . '">' . svg_use_icon('info-large') . '</a>'
. '<a class="pswp-detail info-link" href="' . $attachment_link . '" title="' . esc_attr__('More about photo', 'bezirksblaetter') . '">' . svgUseIcon('info-large') . '</a>'
. '<meta itemprop="thumbnailUrl" content="' . wp_get_attachment_image_url($attachment_id, $size) . '">'
;
} else {
......@@ -202,7 +204,7 @@ function mediaGrid(string $gallery, array $attachments, string $size = 'medium')
.= '<div class="grid-item">'
. '<figure class="responsive-embed ' . getVideoRatio($attachment_metadata['width'], $attachment_metadata['height']) . '" itemprop="associatedMedia" itemscope itemtype="http://schema.org/VideoObject">'
. '<video src="' . wp_get_attachment_url($attachment_id) . '" itemprop="contentUrl" controls poster="' . ($attachment_thumbnail ?: '') . '"></video>'
. '<a class="info-link" href="' . $attachment_link . '" title="' . esc_attr__('More about video', 'bezirksblaetter') . '">' . svg_use_icon('info-large') . '</a>'
. '<a class="info-link" href="' . $attachment_link . '" title="' . esc_attr__('More about video', 'bezirksblaetter') . '">' . svgUseIcon('info-large') . '</a>'
;
}
......@@ -227,6 +229,7 @@ function mediaGrid(string $gallery, array $attachments, string $size = 'medium')
* Return PhotoSwipe ID for given $url.
*
* @param string $url
*
* @return string
*/
function getPhotoSwipeId(string $url): string
......@@ -239,6 +242,7 @@ function getPhotoSwipeId(string $url): string
* Return an array with all parameters for construction of PhotoSwipe powered link.
*
* @param int $attachment_id
*
* @return array
*/
function getPhotoSwipeLinkAttributes(int $attachment_id): array
......@@ -271,6 +275,7 @@ function getPhotoSwipeLinkAttributes(int $attachment_id): array
* @param int $attachment_id Attachment ID of image the <a> element should link to.
* @param string $content Content to be wrapped in <a> element.
* @param array $attributes (optional) Additional attributes for <a> element.
*
* @return string
*/
function getPhotoSwipeLink(int $attachment_id, string $content, array $attributes = []): string
......@@ -294,10 +299,13 @@ function getPhotoSwipeLink(int $attachment_id, string $content, array $attribute
/**
* Return (class name for) aspect ratio for video with given $width and $height.
* @staticvar array $ratios
*
* @static array $ratios
*
* @param int $width
* @param int $height
* @param float $epsilon
*
* @return string
*/
function getVideoRatio(int $width, int $height, float $epsilon = 0.01): string
......@@ -325,16 +333,18 @@ function getVideoRatio(int $width, int $height, float $epsilon = 0.01): string
/**
* Return <use /> tag with xlink:href referencing given $icon wrapped in <svg class="icon" /> tag.
*
* @param string $icon ID of SVG icon.
* @param bool|string $class Extra class to be added to <svg /> as "icon-$class". If true, ID of SVG icon is used.
*
* @return string
*/
function svg_use_icon(string $icon, $class = false): string
function svgUseIcon(string $icon, $class = false): string
{
return sprintf(
'<svg class="icon %s"><use xlink:href="%s#%s" /></svg>',
$class ? sprintf("icon-%s", is_bool($class) ? $icon : $class) : '',
asset_uri('icons.svg'),
getAssetUri('icons.svg'),
$icon
);
}
......@@ -344,12 +354,13 @@ function svg_use_icon(string $icon, $class = false): string
* @param string $content Content - can be HTML, but will be wrapped in <span/> element, so should be an inline element.
* @param string $icon_before
* @param string $icon_after
*
* @return string
*/
function content_with_svg_icon(string $content, string $icon_before = '', string $icon_after = ''): string
function contentWithSvgIcon(string $content, string $icon_before = '', string $icon_after = ''): string
{
return ($icon_before ? svg_use_icon($icon_before) : '')
return ($icon_before ? svgUseIcon($icon_before) : '')
. '<span class="label">' . $content . '</span>'
. ($icon_after ? svg_use_icon($icon_after) : '')
. ($icon_after ? svgUseIcon($icon_after) : '')
;
}
......@@ -19,7 +19,7 @@
*/
function previous_media_link(string $text)
{
adjacent_media_link($text, true);
adjacent_media_link($text, true);
}
/**
......@@ -33,7 +33,7 @@ function previous_media_link(string $text)
*/
function next_media_link(string $text)
{
adjacent_media_link($text, false);
adjacent_media_link($text, false);
}
/**
......@@ -48,8 +48,8 @@ function next_media_link(string $text)
*/
function adjacent_media_link(string $text, bool $prev = true)
{
$post = get_post();
$attachments = array_values(get_children([
$post = get_post();
$attachments = array_values(get_children([
'post_parent' => $post->post_parent,
'post_status' => 'inherit',
'post_type' => 'attachment',
......@@ -57,44 +57,44 @@ function adjacent_media_link(string $text, bool $prev = true)
'orderby' => 'menu_order ID',
]));
foreach ($attachments as $k => $attachment) {
if ($attachment->ID === $post->ID) {
break;
}
}
foreach ($attachments as $k => $attachment) {
if ($attachment->ID === $post->ID) {
break;
}
}
$output = '';
$attachment_id = 0;
$output = '';
$attachment_id = 0;
if ($attachments) {
$k = $prev ? $k - 1 : $k + 1;
if ($attachments) {
$k = $prev ? $k - 1 : $k + 1;
if (isset($attachments[$k])) {
$attachment_id = $attachments[$k]->ID;
$output = sprintf(
if (isset($attachments[$k])) {
$attachment_id = $attachments[$k]->ID;
$output = sprintf(
'<a href="%s" title="%s" rel="%s">%s</a>',
esc_url(get_attachment_link($attachment_id)),
esc_attr(get_the_title($attachment_id)),
$prev ? 'prev' : 'next',
$text
);
}
}
}
}
$adjacent = $prev ? 'previous' : 'next';
$adjacent = $prev ? 'previous' : 'next';
/**
* Filters the adjacent media link.
*
* The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency,
* either 'next', or 'previous'.
*
* @since 3.5.0
*
* @param string $output Adjacent media HTML markup.
* @param int $attachment_id Attachment ID
* @param string $size Image size.
* @param string $text Link text.
*/
echo apply_filters("{$adjacent}_media_link", $output, $attachment_id, $text);
/**
* Filters the adjacent media link.
*
* The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency,
* either 'next', or 'previous'.
*
* @since 3.5.0
*
* @param string $output Adjacent media HTML markup.
* @param int $attachment_id Attachment ID
* @param string $size Image size.
* @param string $text Link text.
*/
echo apply_filters("{$adjacent}_media_link", $output, $attachment_id, $text);
}
......@@ -6,7 +6,7 @@
* - date-based archive pages (date.php)
*
* @package Bezirksblätter
* @version 20170701
* @version 20200201
*/
/** @var \WP_Term */
......@@ -19,7 +19,7 @@ if (!empty($term->description)) {
// Section: term description
?>
<section>
<?php App\template_part('partials/term-description', ['term' => $term]); ?>
<?php \App\includeTemplatePart('partials/term-description', ['term' => $term]); ?>
</section>
<?php
}
......
......@@ -5,7 +5,7 @@
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Bezirksblätter
* @version 20190202
* @version 20200201
*/
// If instead of usual while - we're assuming only single post here.
......@@ -43,14 +43,14 @@ if (have_posts()) {
</header>
<nav class="adjacent">
<div class="container">
<?php \previous_media_link(\App\svg_use_icon('chevron-left')); ?>
<?php \next_media_link(\App\svg_use_icon('chevron-right')); ?>
<?php \previous_media_link(\App\svgUseIcon('chevron-left')); ?>
<?php \next_media_link(\App\svgUseIcon('chevron-right')); ?>
</div>
</nav>
<nav class="actions">
<div class="container">
<button id="zoom-in" class="zoom-in"><?= \App\svg_use_icon('zoom-in-outline'); ?></button>
<button id="zoom-out" class="zoom-out"><?= \App\svg_use_icon('zoom-out-outline'); ?></button>
<button id="zoom-in" class="zoom-in"><?= \App\svgUseIcon('zoom-in-outline'); ?></button>
<button id="zoom-out" class="zoom-out"><?= \App\svgUseIcon('zoom-out-outline'); ?></button>
</div>
</nav>
</div>
......
......@@ -6,7 +6,7 @@
* @link https://roots.io/sage/docs/theme-wrapper/
*
* @package Bezirksblätter
* @version 20200118
* @version 20200201
*/
?>
<!doctype html>
......@@ -19,12 +19,12 @@
get_template_part('partials/header');
?>
<main>
<?php include App\template()->main(); ?>
<?php include \App\getTemplate()->main(); ?>
</main>
<?php
do_action('get_footer');
get_template_part('partials/footer');
if (App\is_script_enqueued('photoswipe') ) {
if (\App\isScriptEnqueued('photoswipe') ) {
get_template_part('partials/photoswipe');
}
wp_footer();
......
......@@ -3,7 +3,7 @@
* Comments template: comments + form.
*
* @package Bezirksblätter
* @version 20171101
* @version 20200201
*/
if (post_password_required()) {
......@@ -23,10 +23,10 @@ if (post_password_required()) {
<nav class="comments-pager">
<ul>
<?php if (get_previous_comments_link()) { ?>
<li class="previous"><?= get_previous_comments_link(sprintf('%s<span class="label">%s</span>', \App\svg_use_icon('long-arrow-left'), __('Older comments', 'bezirksblaetter'))); ?></li>
<li class="previous"><?= get_previous_comments_link(sprintf('%s<span class="label">%s</span>', \App\svgUseIcon('long-arrow-left'), __('Older comments', 'bezirksblaetter'))); ?></li>
<?php } ?>
<?php if (get_next_comments_link()) { ?>
<li class="next"><?= get_next_comments_link(sprintf('<span class="label">%s</span>%s', __('Newer comments', 'bezirksblaetter'), \App\svg_use_icon('long-arrow-right'))); ?></li>
<li class="next"><?= get_next_comments_link(sprintf('<span class="label">%s</span>%s', __('Newer comments', 'bezirksblaetter'), \App\svgUseIcon('long-arrow-right'))); ?></li>
<?php } ?>
</ul>
</nav>
......
<?php
/**
* @package Bezirksblätter
* @version 20180217
* @version 20200201
*/
?>
<article <?php post_class(); ?>>
<?php
if ($post->post_type === 'attachment' && \App\is_image($post)) {
if ($post->post_type === 'attachment' && \App\isImage($post)) {
// Image attachment thumbnail
echo '<a class="thumbnail" href="' . get_permalink($post) . '">' . wp_get_attachment_image($post->ID, 'thumbnail') . '</a>';
} elseif ($post->post_type === 'post' && has_post_thumbnail($post)) {
......@@ -14,11 +14,11 @@
echo '<a class="thumbnail" href="' . get_permalink($post) . '">' . get_the_post_thumbnail($post, 'thumbnail') . '</a>';
} else {
// No thumbnail
echo '<a class="no-thumbnail" href="' . get_permalink($post) . '">' . \App\svg_use_icon('camera') . '</a>';
echo '<a class="no-thumbnail" href="' . get_permalink($post) . '">' . \App\svgUseIcon('camera') . '</a>';
}
?>
<header>
<h2 class="entry-title"><a href="<?= get_permalink(); ?>"><?= \App\content_with_svg_icon(get_the_title(), '', 'long-arrow-right'); ?></a></h2>
<h2 class="entry-title"><a href="<?= get_permalink(); ?>"><?= \App\contentWithSvgIcon(get_the_title(), '', 'long-arrow-right'); ?></a></h2>
<?php if ($post->post_type === 'post') { get_template_part('partials/entry-meta'); } ?>
</header>
<div class="entry-summary">
......
<?php
/**
* @package Bezirksblätter
* @version 20171101
* @version 20200201
*/
?>
<article <?php post_class(); ?>>
......@@ -9,11 +9,11 @@
if (has_post_thumbnail($post)) {
echo '<a class="thumbnail" href="' . get_permalink($post) . '">' . get_the_post_thumbnail($post, 'thumbnail') . '</a>';
} else {
echo '<a class="no-thumbnail" href="' . get_permalink($post) . '">' . \App\svg_use_icon('camera') . '</a>';
echo '<a class="no-thumbnail" href="' . get_permalink($post) . '">' . \App\svgUseIcon('camera') . '</a>';
}
?>
<header>
<h2 class="entry-title"><a href="<?= get_permalink(); ?>"><?= \App\content_with_svg_icon(get_the_title(), '', 'long-arrow-right'); ?></a></h2>
<h2 class="entry-title"><a href="<?= get_permalink(); ?>"><?= \App\contentWithSvgIcon(get_the_title(), '', 'long-arrow-right'); ?></a></h2>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-summary">
......
......@@ -3,7 +3,7 @@
* Template for site-wide primary header
*
* @package Bezirksblätter
* @version 20200118
* @version 20200201
*/
?>
<header class="primary">
......@@ -11,10 +11,10 @@
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<div class="container">
<label for="nav-trigger" class="nav-trigger-icon">
<?= \App\svg_use_icon('th-menu', 'open'); ?><?= \App\svg_use_icon('times-outline', 'close'); ?>
<?= \App\svgUseIcon('th-menu', 'open'); ?><?= \App\svgUseIcon('times-outline', 'close'); ?>
</label>
<button id="turn-lights-on" class="mod-switcher mod-switcher--lights-on"><?= \App\svg_use_icon('weather-sunny'); ?></button>
<button id="turn-lights-off" class="mod-switcher mod-switcher--lights-off"><?= \App\svg_use_icon('weather-night'); ?></button>
<button id="turn-lights-on" class="mod-switcher mod-switcher--lights-on"><?= \App\svgUseIcon('weather-sunny'); ?></button>
<button id="turn-lights-off" class="mod-switcher mod-switcher--lights-off"><?= \App\svgUseIcon('weather-night'); ?></button>
</div>
<nav class="primary" id="primary-nav">
......@@ -40,7 +40,7 @@
</nav>
<nav class="contextual">
<?php $contextual_menu = App\contextualMenu(); ?>
<?php $contextual_menu = \App\contextualMenu(); ?>
<ul class="<?= $contextual_menu['class']; ?>">
<?php
array_walk($contextual_menu['items'], function($item) {
......
......@@ -2,7 +2,7 @@
/**
* Template partial that renders attachment media meta data.
*
* @version 20190202
* @version 20200201
*/
global $post;
......@@ -16,11 +16,11 @@ $metadata = wp_get_attachment_metadata($post_id);
// Notes:
// 1) Some meta data are not available for both image and video.
// 2) Some meta data are not stored in the same way.
$is_image = \App\is_image($post);
$is_video = \App\is_video($post);
$is_image = \App\isImage($post);
$is_video = \App\isVideo($post);
// Image EXIF data:
$image_meta = \App\is_image($post) ? $metadata['image_meta'] : [];
$image_meta = \App\isImage($post) ? $metadata['image_meta'] : [];
// Timestamp of creation:
$timestamp = isset($image_meta['created_timestamp']) ? intval($image_meta['created_timestamp']) : null;
......@@ -53,45 +53,45 @@ $video_length = $is_video ? $metadata['length_formatted'] : null;
?>
<ul class="media-meta">
<?php if (!is_null($timestamp)) { ?>
<li title="<?= esc_attr__('Date', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(date('d.m.Y', $timestamp), 'calendar'); ?></li>
<li title="<?= esc_attr__('Time', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(date('H:i:s', $timestamp), 'clock-o'); ?></li>
<li title="<?= esc_attr__('Date', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(date('d.m.Y', $timestamp), 'calendar'); ?></li>
<li title="<?= esc_attr__('Time', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(date('H:i:s', $timestamp), 'clock-o'); ?></li>
<?php } ?>
<?php if (count($galleries) > 0) { ?>
<li title="<?= esc_attr__('Galleries', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(implode(', ', $galleries), 'folder-open'); ?></li>
<li title="<?= esc_attr__('Galleries', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(implode(', ', $galleries), 'folder-open'); ?></li>
<?php } ?>
<?php if (count($tags) > 0) { ?>
<li title="<?= esc_attr__('Tags', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(implode(', ', $tags), 'tags'); ?></li>
<li title="<?= esc_attr__('Tags', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(implode(', ', $tags), 'tags'); ?></li>
<?php } ?>
</ul>
<ul class="media-meta">
<?php if (!empty($file_size)) { ?>
<li title="<?= esc_attr__('Size', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf("%.1f MB", round($file_size / MB_IN_BYTES, 1)), $is_video ? 'film' : 'image'); ?></li>
<li title="<?= esc_attr__('Size', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf("%.1f MB", round($file_size / MB_IN_BYTES, 1)), $is_video ? 'film' : 'image'); ?></li>
<?php } ?>
<li title="<?= esc_attr__('Width', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf('%dpx', $metadata['width']), 'arrows-h'); ?></li>
<li title="<?= esc_attr__('Height', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf('%dpx', $metadata['height']), 'arrows-v'); ?></li>
<li title="<?= esc_attr__('Width', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf('%dpx', $metadata['width']), 'arrows-h'); ?></li>
<li title="<?= esc_attr__('Height', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf('%dpx', $metadata['height']), 'arrows-v'); ?></li>
<?php if (!empty($url) && !empty($filename)) { ?>
<li><a href="<?= esc_url($url); ?>" title="<?= esc_attr__('Save image on your hard drive.', 'bezirksblaetter'); ?>" download="<?= esc_attr(basename($filename)); ?>"><?= \App\svg_use_icon('floppy-o'); ?></a></li>
<li><a href="<?= esc_url($url); ?>" title="<?= esc_attr__('Save image on your hard drive.', 'bezirksblaetter'); ?>" download="<?= esc_attr(basename($filename)); ?>"><?= \App\svgUseIcon('floppy-o'); ?></a></li>
<?php } ?>
</ul>
<ul class="media-meta">
<?php if (isset($image_meta['camera'])) { ?>
<li title="<?= esc_attr__('Camera model', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(esc_html($image_meta['camera']), 'camera-fa'); ?></li>
<li title="<?= esc_attr__('Camera model', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(esc_html($image_meta['camera']), 'camera-fa'); ?></li>
<?php } ?>
<?php if (isset($image_meta['aperture'])) { ?>
<li title="<?= esc_attr__('Aperture', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf('f/%d', $image_meta['aperture']), 'sun-o'); ?></li>
<li title="<?= esc_attr__('Aperture', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf('f/%d', $image_meta['aperture']), 'sun-o'); ?></li>
<?php } ?>
<?php if (isset($image_meta['shutter_speed'])) { ?>
<li title="<?= esc_attr__('Shutter speed', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf(esc_html__('%s sec', 'bezirksblaetter'), $image_meta['shutter_speed']), 'tachometer'); ?></li>
<li title="<?= esc_attr__('Shutter speed', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf(esc_html__('%s sec', 'bezirksblaetter'), $image_meta['shutter_speed']), 'tachometer'); ?></li>
<?php } ?>
<?php if (isset($image_meta['focal_length'])) { ?>
<li title="<?= esc_attr__('Focal length', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf(esc_html__('%s mm', 'bezirksblaetter'), $image_meta['focal_length']), 'binoculars'); ?></li>
<li title="<?= esc_attr__('Focal length', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf(esc_html__('%s mm', 'bezirksblaetter'), $image_meta['focal_length']), 'binoculars'); ?></li>
<?php } ?>
<?php if (isset($image_meta['iso'])) { ?>
<li title="<?= esc_attr__('ISO speed', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(sprintf(esc_html__('%s ISO'), $image_meta['iso']), 'eye'); ?></li>
<li title="<?= esc_attr__('ISO speed', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(sprintf(esc_html__('%s ISO'), $image_meta['iso']), 'eye'); ?></li>
<?php } ?>
<?php if (!is_null($video_length)) { ?>
<li title="<?= esc_attr__('Video length', 'bezirksblaetter'); ?>"><?= \App\content_with_svg_icon(human_readable_duration($video_length), 'hourglass'); ?></li>
<li title="<?= esc_attr__('Video length', 'bezirksblaetter'); ?>"><?= \App\contentWithSvgIcon(human_readable_duration($video_length), 'hourglass'); ?></li>
<?php } ?>
</ul>
......@@ -6,7 +6,7 @@
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Bezirksblätter
* @version 20190204
* @version 20200201
*/
/** @var \WP_Term */
......@@ -19,7 +19,7 @@ get_template_part('partials/page-header');
<section>
<?php
// Get term description
App\template_part('partials/term-description', ['term' => $term]);
\App\includeTemplatePart('partials/term-description', ['term' => $term]);
// Fetch and print subgalleries:
$subgalleries = get_terms([
......@@ -82,7 +82,7 @@ if ($term->parent) {
else {
$gallery_page_id = get_option(B13R_GALLERY_PAGE);
if ($gallery_page_id) {
$prev_up_next[] = '<a href="' . get_permalink($gallery_page_id) . '">' . \App\svg_use_icon('long-arrow-up') . '<span class="label">' . get_the_title($gallery_page_id) . '</span>' . \App\svg_use_icon('long-arrow-up') . '</a>';
$prev_up_next[] = '<a href="' . get_permalink($gallery_page_id) . '">' . \App\svgUseIcon('long-arrow-up') . '<span class="label">' . get_the_title($gallery_page_id) . '</span>' . \App\svgUseIcon('long-arrow-up') . '</a>';
}
}
......
......@@ -6,7 +6,7 @@
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Bezirksblätter
* @version 20171124
* @version 20200201
*/
/** @var \WP_Term */
......@@ -19,7 +19,7 @@ get_template_part('partials/page-header');
<section>
<?php
// Get term description
App\template_part('partials/term-description', ['term' => $term]);
\App\includeTemplatePart('partials/term-description', ['term' => $term]);
?>
</section>
<section>
......
......@@ -5,7 +5,7 @@
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Bezirksblätter
* @version 20190202
* @version 20200201
*/
// If instead of usual while - we're assuming only single post here.
......@@ -41,13 +41,13 @@ if (have_posts()) {
</header>
<nav class="adjacent">
<div class="container">
<?php \previous_media_link(\App\svg_use_icon('chevron-left')); ?>
<?php \next_media_link(\App\svg_use_icon('chevron-right')); ?>
<?php \previous_media_link(\App\svgUseIcon('chevron-left')); ?>
<?php \next_media_link(\App\svgUseIcon('chevron-right')); ?>
</div>
</nav>
<nav class="actions">
<div class="container">
<button id="fullscreen-toggler" class="fullscreen-toggler"><?= \App\svg_use_icon('arrow-maximise'); ?></button>
<button id="fullscreen-toggler" class="fullscreen-toggler"><?= \App\svgUseIcon('arrow-maximise'); ?></button>
</div>
</nav>
</div>
......