5 Commits
1.3.2 ... 1.4.3

Author SHA1 Message Date
5a4824140c Set accent color to #F5A9B8, disabled custom-
colors from the editor
2025-05-13 23:26:18 -07:00
e085f5aee3 simple changes, fixed some issues 2025-05-13 01:38:42 -07:00
aafbabb209 Fix some js errors, see diff
set sophia_after_dark_enable_top_header always to false, as it would a a bar to the top of the page below the admin bar
also did some general fixing on php :)
2025-05-11 17:51:48 -07:00
5fd30040a4 Bump to 1.4.0, made some fixes for 8.2+ 2025-05-11 16:58:27 -07:00
75cbf48af8 fix reply box margin 2024-09-18 10:57:13 -07:00
25 changed files with 866 additions and 924 deletions

49
404.php
View File

@ -2,7 +2,7 @@
/** /**
* The template for displaying 404 pages (not found) * The template for displaying 404 pages (not found)
* *
* @link https://codex.wordpress.org/Creating_an_Error_404_Pag * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#404-not-found
* *
* @package Sophia After Dark * @package Sophia After Dark
* @since 1.0.0 * @since 1.0.0
@ -12,19 +12,24 @@ get_header();
$sophia_after_dark_pnf_latest_posts = get_theme_mod( 'sophia_after_dark_enable_pnf_latest_posts', true ); $sophia_after_dark_pnf_latest_posts = get_theme_mod( 'sophia_after_dark_enable_pnf_latest_posts', true );
?> ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<main id="main" class="site-main"> <main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( '404 Error Content', 'sophia-after-dark' ); ?>">
<section class="error-404 not-found"> <section class="error-404 not-found">
<div class="error-num"><span><?php esc_html_e( 'Error', 'sophia-after-dark' );?>&nbsp;</span><?php esc_html_e( '404', 'sophia-after-dark' ); ?></div> <div class="error-num">
<span><?php esc_html_e( 'Error', 'sophia-after-dark' ); ?>&nbsp;</span><?php esc_html_e( '404', 'sophia-after-dark' ); ?>
</div>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Oops! That page can&rsquo;t be found.', 'sophia-after-dark' ); ?></h1> <h1 class="page-title"><?php esc_html_e( 'Oops! That page cant be found.', 'sophia-after-dark' ); ?></h1>
</header> </header>
<div class="page-content"> <div class="page-content">
<p><?php esc_html_e( 'It looks like nothing was found at this location.', 'sophia-after-dark' ); ?></p> <p><?php esc_html_e( 'It looks like nothing was found at this location.', 'sophia-after-dark' ); ?></p>
</section> </div><!-- .page-content -->
</section><!-- .error-404 -->
<?php if ( true === $sophia_after_dark_pnf_latest_posts ) { ?> <?php if ( true === $sophia_after_dark_pnf_latest_posts ) : ?>
<div class="page-extra-content mt-404-latest-posts-wrapper"> <div class="page-extra-content mt-404-latest-posts-wrapper">
<?php <?php
$sophia_after_dark_pnf_latest_post_count = get_theme_mod( 'sophia_after_dark_pnf_latest_post_count', 3 ); $sophia_after_dark_pnf_latest_post_count = get_theme_mod( 'sophia_after_dark_pnf_latest_post_count', 3 );
@ -34,31 +39,27 @@ $sophia_after_dark_pnf_latest_posts = get_theme_mod( 'sophia_after_dark_enable_p
'ignore_sticky_posts' => 1, 'ignore_sticky_posts' => 1,
); );
$sophia_after_dark_pnf_query = new WP_Query( $sophia_after_dark_pnf_args ); $sophia_after_dark_pnf_query = new WP_Query( $sophia_after_dark_pnf_args );
if ( $sophia_after_dark_pnf_query->have_posts() ) {
if ( $sophia_after_dark_pnf_query->have_posts() ) :
echo '<div class="mt-pnf-latest-posts-wrapper mt-related-posts-wrapper">'; echo '<div class="mt-pnf-latest-posts-wrapper mt-related-posts-wrapper">';
$sophia_after_dark_404_latest_title = get_theme_mod( 'sophia_after_dark_pnf_latest_title', __( 'You May Like' ,'sophia-after-dark' ) ); $sophia_after_dark_404_latest_title = get_theme_mod( 'sophia_after_dark_pnf_latest_title', __( 'You May Like', 'sophia-after-dark' ) );
echo '<h2 class="section-title mt-related-post-title">'. esc_html( $sophia_after_dark_404_latest_title ) .'</h2>'; echo '<h2 class="section-title mt-related-post-title">' . esc_html( $sophia_after_dark_404_latest_title ) . '</h2>';
while ( $sophia_after_dark_pnf_query->have_posts() ) {
while ( $sophia_after_dark_pnf_query->have_posts() ) :
$sophia_after_dark_pnf_query->the_post(); $sophia_after_dark_pnf_query->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', 'related' ); get_template_part( 'template-parts/content', 'related' );
endwhile;
}
echo '</div>'; echo '</div>';
} endif;
wp_reset_postdata(); wp_reset_postdata();
?> ?>
</div> </div><!-- .mt-404-latest-posts-wrapper -->
<?php endif; ?>
<?php } ?> </main><!-- #main -->
</div><!-- #primary -->
</main>
</div>
<?php <?php
get_footer(); get_footer();

View File

@ -12,52 +12,59 @@ $archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--
get_header(); get_header();
?> ?>
<div class="mt-page-content-wrapper"> <div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area"> <div id="primary" class="content-area" itemscope itemtype="https://schema.org/CollectionPage">
<main id="main" class="site-main"> <main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Archive Content', 'sophia-after-dark' ); ?>">
<?php
if ( 'mt-archive--block-grid-style' === $archive_style ) { <?php if ( 'mt-archive--block-grid-style' === $archive_style ) : ?>
echo '<div class="archive-grid-post-wrapper">'; <div class="archive-grid-post-wrapper">
} <?php endif; ?>
if ( have_posts() ) :
if ( 'mt-archive--masonry-style' === $archive_style ) { <?php if ( have_posts() ) : ?>
?>
<?php if ( 'mt-archive--masonry-style' === $archive_style ) : ?>
<div class="sophia-after-dark-content-masonry"> <div class="sophia-after-dark-content-masonry">
<div id="mt-masonry"> <div id="mt-masonry">
<?php endif; ?>
<?php <?php
} // Start the Loop
/* Start the Loop */
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
/*
* Include the Post-Type-specific template for the content. // Load post template part
* 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() ); get_template_part( 'template-parts/content', get_post_type() );
endwhile; endwhile;
if ( 'mt-archive--masonry-style' === $archive_style ) {
?> ?>
</div>
</div> <?php if ( 'mt-archive--masonry-style' === $archive_style ) : ?>
</div><!-- #mt-masonry -->
</div><!-- .sophia-after-dark-content-masonry -->
<?php endif; ?>
<?php <?php
} // Archive pagination
the_posts_pagination( array(
the_posts_pagination(); 'prev_text' => __( 'Previous', 'sophia-after-dark' ),
else : 'next_text' => __( 'Next', 'sophia-after-dark' ),
get_template_part( 'template-parts/content', 'none' ); 'before_page_number' => '<span class="screen-reader-text">' . esc_html__( 'Page', 'sophia-after-dark' ) . ' </span>',
) );
endif;
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div>';
}
?> ?>
</main>
</div> <?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
<?php if ( 'mt-archive--block-grid-style' === $archive_style ) : ?>
</div><!-- .archive-grid-post-wrapper -->
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
</div> </div><!-- .mt-page-content-wrapper -->
<?php
get_footer(); <?php get_footer(); ?>

View File

@ -6,37 +6,36 @@
* Contains handlers to make Theme Customizer preview reload changes asynchronously. * Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/ */
( function( $ ) { (($) => {
const setText = (selector, text) => $(selector).text(text);
// Site title and description. const setVisibility = (isVisible, color) => {
wp.customize( 'blogname', function( value ) { const titleDesc = $('.site-title, .site-description');
value.bind( function( to ) { const titleLink = $('.site-title a, .site-description');
$( '.site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );
// Header text color. if (!isVisible) {
wp.customize( 'header_textcolor', function( value ) { titleDesc.css({
value.bind( function( to ) { clip: 'rect(1px, 1px, 1px, 1px)',
if ( 'blank' === to ) { position: 'absolute'
$( '.site-title, .site-description' ).css( { });
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else { } else {
$( '.site-title, .site-description' ).css( { titleDesc.css({
'clip': 'auto', clip: 'auto',
'position': 'relative' position: 'relative'
} ); });
$( '.site-title a, .site-description' ).css( { titleLink.css('color', color);
'color': to
} );
} }
} ); };
} );
} )( jQuery ); wp.customize('blogname', (value) => {
value.bind((to) => setText('.site-title a', to));
});
wp.customize('blogdescription', (value) => {
value.bind((to) => setText('.site-description', to));
});
wp.customize('header_textcolor', (value) => {
value.bind((to) => setVisibility(to !== 'blank', to));
});
})(jQuery);

View File

@ -1,73 +1,59 @@
/** /**
* Image up-loader functions * Image uploader functions
*/ */
var mtSelector;
function upload_media_image(mtSelector){
// ADD IMAGE LINK
jQuery('body').on( 'click', mtSelector , function( event ){
event.preventDefault();
var imgContainer = jQuery(this).closest('.attachment-media-view').find( '.thumbnail-image'), const initUploadMediaImage = (selector) => {
placeholder = jQuery(this).closest('.attachment-media-view').find( '.placeholder'), jQuery('body').on('click', selector, function(e) {
imgIdInput = jQuery(this).siblings('.upload-id'); e.preventDefault();
// Create a new media frame const $button = jQuery(this);
frame = wp.media({ const $mediaView = $button.closest('.attachment-media-view');
const $imgContainer = $mediaView.find('.thumbnail-image');
const $placeholder = $mediaView.find('.placeholder');
const $input = $button.siblings('.upload-id');
const frame = wp.media({
title: 'Select or Upload Image', title: 'Select or Upload Image',
button: { button: {
text: 'Use Image' text: 'Use Image'
}, },
multiple: false // Set to true to allow multiple files to be selected multiple: false
}); });
// When an image is selected in the media frame... frame.on('select', () => {
frame.on( 'select', function() { const attachment = frame.state().get('selection').first().toJSON();
$imgContainer.html(`<img src="${attachment.url}" style="max-width:100%;" />`);
// Get media attachment details from the frame state $placeholder.addClass('hidden');
var attachment = frame.state().get('selection').first().toJSON(); $input.val(attachment.url).trigger('change');
// Send the attachment URL to our custom image input field.
imgContainer.html( '<img src="'+attachment.url+'" style="max-width:100%;"/>' );
placeholder.addClass('hidden');
imgIdInput.val( attachment.url ).trigger('change');
}); });
// Finally, open the modal on click
frame.open(); frame.open();
}); });
} };
function delete_media_image(mtSelector){ const initDeleteMediaImage = (selector) => {
// DELETE IMAGE LINK jQuery('body').on('click', selector, function(e) {
jQuery('body').on( 'click', mtSelector, function( event ){ e.preventDefault();
event.preventDefault(); const $button = jQuery(this);
var imgContainer = jQuery(this).closest('.attachment-media-view').find( '.thumbnail-image'), const $mediaView = $button.closest('.attachment-media-view');
placeholder = jQuery(this).closest('.attachment-media-view').find( '.placeholder'), const $imgContainer = $mediaView.find('.thumbnail-image');
imgIdInput = jQuery(this).siblings('.upload-id'); const $placeholder = $mediaView.find('.placeholder');
const $input = $button.siblings('.upload-id');
// Clear out the preview image
imgContainer.find('img').remove();
placeholder.removeClass('hidden');
// Delete the image id from the hidden input
imgIdInput.val( '' ).trigger('change');
$imgContainer.find('img').remove();
$placeholder.removeClass('hidden');
$input.val('').trigger('change');
}); });
} };
jQuery(document).ready(function($){ jQuery(($) => {
"use strict"; 'use strict';
/** // Initialize jQuery UI buttonset for radio image controls
* Radio Image control in metabox $('.mt-meta-options-wrap .buttonset').buttonset();
*/
$( '.mt-meta-options-wrap .buttonset' ).buttonset();
/** // Initialize image upload/delete functionality
* Image up-loader initUploadMediaImage('.mt-upload-button');
*/ initDeleteMediaImage('.mt-delete-button');
upload_media_image('.mt-upload-button');
delete_media_image('.mt-delete-button');
}); });

View File

@ -5,63 +5,57 @@ jQuery(document).ready(function($) {
/** /**
* Sophia After Dark Preloader * Sophia After Dark Preloader
*/ */
if($('#preloader-background').length > 0) { if ($('#preloader-background').length) {
setTimeout(function(){$('#preloader-background').hide();}, 600); setTimeout(function() {
$('#preloader-background').hide();
}, 600);
} }
var grid = document.querySelector( /**
'.sophia-after-dark-content-masonry' * Masonry grid initialization
), */
masonry; const grid = document.querySelector('.sophia-after-dark-content-masonry');
if (grid && typeof Masonry !== 'undefined' && typeof imagesLoaded !== 'undefined') {
if ( imagesLoaded(grid, function() {
grid && new Masonry(grid, {
typeof Masonry !== undefined &&
typeof imagesLoaded !== undefined
) {
imagesLoaded( grid, function( instance ) {
masonry = new Masonry( grid, {
itemSelector: '.hentry' itemSelector: '.hentry'
} ); });
} ); });
} }
/** /**
* Header Search script * Header Search script
*/ */
$('.mt-menu-search .mt-search-icon').click(function() { const $searchIcon = $('.mt-menu-search .mt-search-icon');
$('.mt-form-wrap').toggleClass('search-activate'); $searchIcon.click(function() {
$('.mt-form-wrap .search-field').focus(); $('.mt-form-wrap').toggleClass('search-activate').find('.search-field').focus();
var element = document.querySelector( '.mt-form-wrap.search-activate' ); const $element = $('.mt-form-wrap.search-activate');
if( element ) { if ($element.length) {
$(document).on('keydown', function(e) { $(document).on('keydown', function(e) {
var focusable = element.querySelectorAll( 'input, button, [href], select, textarea, [tabindex]:not([tabindex="-1"])'); const focusable = $element.find('input, button, [href], select, textarea, [tabindex]:not([tabindex="-1"])');
var firstFocusable = focusable[0]; const firstFocusable = focusable[0];
var lastFocusable = focusable[focusable.length - 1]; const lastFocusable = focusable[focusable.length - 1];
sophia_after_dark_focus_trap( firstFocusable, lastFocusable, e ); sophia_after_dark_focus_trap(firstFocusable, lastFocusable, e);
}) });
} }
}); });
/** /**
* Focus trap in popup. * Focus trap in popup.
*/ */
var KEYCODE_TAB = 9; const KEYCODE_TAB = 9;
function sophia_after_dark_focus_trap( firstFocusable, lastFocusable, e ) {
function sophia_after_dark_focus_trap(firstFocusable, lastFocusable, e) {
if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) { if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) {
if ( e.shiftKey ) /* shift + tab */ { if (e.shiftKey && document.activeElement === firstFocusable) {
if (document.activeElement === firstFocusable) {
lastFocusable.focus(); lastFocusable.focus();
e.preventDefault(); e.preventDefault();
} } else if (!e.shiftKey && document.activeElement === lastFocusable) {
} else /* tab */ {
if ( document.activeElement === lastFocusable ) {
firstFocusable.focus(); firstFocusable.focus();
e.preventDefault(); e.preventDefault();
} }
} }
} }
}
$('.mt-form-wrap .mt-form-close').click(function() { $('.mt-form-wrap .mt-form-close').click(function() {
$('.mt-form-wrap').toggleClass('search-activate'); $('.mt-form-wrap').toggleClass('search-activate');
@ -71,38 +65,28 @@ jQuery(document).ready(function($) {
/** /**
* Close popups on escape key. * Close popups on escape key.
*/ */
$( document ).on( 'keydown', function( event ) { $(document).on('keydown', function(event) {
if ( event.keyCode === 27 ) { if (event.keyCode === 27) {
event.preventDefault(); event.preventDefault();
//$( '.primary-menu-wrap' ).removeClass( 'menu-active' ); $('.mt-menu-search .mt-form-wrap').removeClass('search-activate');
$( '.mt-menu-search .mt-form-wrap' ).removeClass( 'search-activate' );
} }
}); });
/** /**
* Settings about WOW animation * Settings about WOW animation
*/ */
var wowOption = sophia_after_darkObject.wow_effect; if (sophia_after_darkObject.wow_effect === 'on') {
if( wowOption === 'on' ) {
new WOW().init(); new WOW().init();
} }
/** /**
* Settings about sticky menu * Settings about sticky menu
*/ */
var stickyOption = sophia_after_darkObject.menu_sticky; if (sophia_after_darkObject.menu_sticky === 'on') {
if( stickyOption === 'on' ) { const wpAdminBar = $('#wpadminbar').length ? $('#wpadminbar') : 0;
var windowWidth = $( window ).width(); $(".mt-social-menu-wrapper").sticky({
if( windowWidth < 500 ) { topSpacing: wpAdminBar.length ? wpAdminBar.height() : 0
var wpAdminBar = 0; });
} else {
var wpAdminBar = $('#wpadminbar');
}
if ( wpAdminBar.length ) {
$(".mt-social-menu-wrapper").sticky({topSpacing:wpAdminBar.height()});
} else {
$(".mt-social-menu-wrapper").sticky({topSpacing:0});
}
} }
/** /**
@ -115,6 +99,7 @@ jQuery(document).ready(function($) {
$('#mt-scrollup').fadeOut('slow'); $('#mt-scrollup').fadeOut('slow');
} }
}); });
$('#mt-scrollup').click(function() { $('#mt-scrollup').click(function() {
$("html, body").animate({ $("html, body").animate({
scrollTop: 0 scrollTop: 0
@ -125,61 +110,52 @@ jQuery(document).ready(function($) {
/** /**
* Slider scripts * Slider scripts
*/ */
$('.front-slider').lightSlider({ function initializeSlider(selector, rtl = true) {
$(selector).lightSlider({
pager: false, pager: false,
auto: false, auto: false,
loop: true, loop: true,
item: 1, item: 1,
controls: true, controls: true,
slideMargin:0, slideMargin: 0,
rtl:true, rtl: rtl,
nextHtml: '<span class="icon-prev"><i class="fa fa-angle-left"></i></span>', nextHtml: '<span class="icon-prev"><i class="fa fa-angle-left"></i></span>',
prevHtml: '<span class="icon-next"><i class="fa fa-angle-right"></i></span>', prevHtml: '<span class="icon-next"><i class="fa fa-angle-right"></i></span>',
onSliderLoad: function() { onSliderLoad: function() {
$('.front-slider').removeClass('cS-hidden'); $(selector).removeClass('cS-hidden');
}
});
} }
}); initializeSlider('.front-slider');
initializeSlider('.mt-gallery-slider', false);
/**
* Slider scripts
*/
$('.mt-gallery-slider').lightSlider({
pager: false,
auto: false,
loop: true,
item: 1,
controls: true,
});
/** /**
* Responsive menu * Responsive menu
*/ */
$('.mt-social-menu-wrapper .menu-toggle').click(function() {
$('.mt-social-menu-wrapper .menu-toggle').click(function(event) { $('#site-navigation').toggleClass('isActive').slideToggle('slow');
$('.mt-social-menu-wrapper #site-navigation').toggleClass( 'isActive' ).slideToggle('slow'); const $element = $('.mt-header-menu-wrap');
var element = document.querySelector( '.mt-header-menu-wrap' ); if ($element.length) {
if( element ) {
$(document).on('keydown', function(e) { $(document).on('keydown', function(e) {
if( element.querySelectorAll( '.mt-social-menu-wrapper #site-navigation.isActive' ).length === 1 ) { if ($('#site-navigation.isActive').length) {
var focusable = element.querySelectorAll( 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'); const focusable = $element.find('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
var firstFocusable = focusable[0]; const firstFocusable = focusable[0];
var lastFocusable = focusable[focusable.length - 1]; const lastFocusable = focusable[focusable.length - 1];
sophia_after_dark_focus_trap( firstFocusable, lastFocusable, e ); sophia_after_dark_focus_trap(firstFocusable, lastFocusable, e);
} }
}) });
} }
}); });
/** /**
* responsive sub menu toggle * Responsive sub menu toggle
*/ */
$('<a href="javascript:void(0);" class="sub-toggle"><i class="fa fa-angle-right"></i></a>').insertAfter('#site-navigation .menu-item-has-children>a, #site-navigation .page_item_has_children>a'); $('<a href="javascript:void(0);" class="sub-toggle"><i class="fa fa-angle-right"></i></a>').insertAfter('#site-navigation .menu-item-has-children>a, #site-navigation .page_item_has_children>a');
$('#site-navigation .sub-toggle').click(function() { $('#site-navigation .sub-toggle').click(function() {
$(this).parent('.menu-item-has-children').children('ul.sub-menu').first().slideToggle('1000'); $(this).parent('.menu-item-has-children').children('ul.sub-menu').first().slideToggle(1000);
jQuery(this).parent('.page_item_has_children').children('ul.children').first().slideToggle('1000'); $(this).parent('.page_item_has_children').children('ul.children').first().slideToggle(1000);
$(this).children('.fa-angle-right').first().toggleClass('fa-angle-down'); $(this).children('.fa-angle-right').first().toggleClass('fa-angle-down');
}); });
@ -189,9 +165,8 @@ jQuery(document).ready(function($) {
$(window).on('load', function() { $(window).on('load', function() {
if ($(window).width() > 839) { if ($(window).width() > 839) {
$(".front-slider-wrapper").each(function() { $(".front-slider-wrapper").each(function() {
var imageHeight = $(this).height(); const imageHeight = $(this).height();
$(this).find(".slider-post-wrap").css('height', imageHeight); $(this).find(".slider-post-wrap, .front-slider").css('height', imageHeight);
$(this).find(".front-slider ").css('height', imageHeight);
}); });
} }
}); });

View File

@ -4,27 +4,32 @@
* Handles toggling the navigation menu for small screens and enables TAB key * Handles toggling the navigation menu for small screens and enables TAB key
* navigation support for dropdown menus. * navigation support for dropdown menus.
*/ */
( function() { (function() {
var container, button, menu, links, i, len; var container, button, menu, links, i, len;
container = document.getElementById( 'site-navigation' ); container = document.getElementById('site-navigation');
if ( ! container ) { if (!container) {
return; return;
} }
menu = container.getElementsByTagName( 'ul' )[0]; menu = container.getElementsByTagName('ul')[0];
menu.setAttribute( 'aria-expanded', 'false' ); if (!menu) {
if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { return;
}
menu.setAttribute('aria-expanded', 'false');
if (-1 === menu.className.indexOf('nav-menu')) {
menu.className += ' nav-menu'; menu.className += ' nav-menu';
} }
// Get all the link elements within the menu. // Get all the link elements within the menu.
links = menu.getElementsByTagName( 'a' ); links = menu.getElementsByTagName('a');
// Each time a menu link is focused or blurred, toggle focus. // Each time a menu link is focused or blurred, toggle focus.
for ( i = 0, len = links.length; i < len; i++ ) { for (i = 0, len = links.length; i < len; i++) {
links[i].addEventListener( 'focus', toggleFocus, true ); links[i].addEventListener('focus', toggleFocus, true);
links[i].addEventListener( 'blur', toggleFocus, true ); links[i].addEventListener('blur', toggleFocus, true);
} }
/** /**
@ -34,12 +39,12 @@
var self = this; var self = this;
// Move up through the ancestors of the current link until we hit .nav-menu. // Move up through the ancestors of the current link until we hit .nav-menu.
while ( -1 === self.className.indexOf( 'nav-menu' ) ) { while (self && -1 === self.className.indexOf('nav-menu')) {
// On li elements toggle the class .focus. // On li elements toggle the class .focus.
if ( 'li' === self.tagName.toLowerCase() ) { if ('li' === self.tagName.toLowerCase()) {
if ( -1 !== self.className.indexOf( 'focus' ) ) { if (-1 !== self.className.indexOf('focus')) {
self.className = self.className.replace( ' focus', '' ); self.className = self.className.replace(' focus', '');
} else { } else {
self.className += ' focus'; self.className += ' focus';
} }
@ -52,31 +57,32 @@
/** /**
* Toggles `focus` class to allow submenu access on tablets. * Toggles `focus` class to allow submenu access on tablets.
*/ */
( function( container ) { (function(container) {
var touchStartFn, i, var touchStartFn, i,
parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); parentLink = container.querySelectorAll('.menu-item-has-children > a, .page_item_has_children > a');
if ( 'ontouchstart' in window ) { if ('ontouchstart' in window) {
touchStartFn = function( e ) { touchStartFn = function(e) {
var menuItem = this.parentNode, i; var menuItem = this.parentNode,
j;
if ( ! menuItem.classList.contains( 'focus' ) ) { if (!menuItem.classList.contains('focus')) {
e.preventDefault(); e.preventDefault();
for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { for (j = 0; j < menuItem.parentNode.children.length; ++j) {
if ( menuItem === menuItem.parentNode.children[i] ) { if (menuItem === menuItem.parentNode.children[j]) {
continue; continue;
} }
menuItem.parentNode.children[i].classList.remove( 'focus' ); menuItem.parentNode.children[j].classList.remove('focus');
} }
menuItem.classList.add( 'focus' ); menuItem.classList.add('focus');
} else { } else {
menuItem.classList.remove( 'focus' ); menuItem.classList.remove('focus');
} }
}; };
for ( i = 0; i < parentLink.length; ++i ) { for (i = 0; i < parentLink.length; ++i) {
parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); parentLink[i].addEventListener('touchstart', touchStartFn, false);
} }
} }
}( container ) ); }(container));
} )(); })();

View File

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

View File

@ -20,23 +20,29 @@ if ( post_password_required() ) {
return; return;
} }
// Remove URL field from comments // Remove URL field from comment form
function sophia_after_dark_remove_url_comments($fields) { function sophia_after_dark_remove_url_comments($fields) {
unset($fields['url']); unset($fields['url']);
return $fields; return $fields;
} }
add_filter('comment_form_default_fields', 'sophia_after_dark_remove_url_comments'); add_filter('comment_form_default_fields', 'sophia_after_dark_remove_url_comments');
// Edit Cookie consent text from comments // Modify cookie consent field
function sophia_after_dark_comment_form_change_cookies($fields) { function sophia_after_dark_comment_form_change_cookies($fields) {
$commenter = wp_get_current_commenter(); $commenter = wp_get_current_commenter();
$consent = empty($commenter['comment_author_email']) ? '' : ' checked="checked"'; $consent = ! empty( $commenter['comment_author_email'] );
$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . esc_attr($consent) . ' /><label for="wp-comment-cookies-consent">' . esc_html__('Save my Name & Email for the next time I comment.', 'sophia-after-dark') . '</label></p>';
$fields['cookies'] = sprintf(
'<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" %s /> <label for="wp-comment-cookies-consent">%s</label></p>',
checked( $consent, true, false ),
esc_html__( 'Save my Name & Email for the next time I comment.', 'sophia-after-dark' )
);
return $fields; return $fields;
} }
add_filter('comment_form_default_fields', 'sophia_after_dark_comment_form_change_cookies'); add_filter('comment_form_default_fields', 'sophia_after_dark_comment_form_change_cookies');
// Edit comment-notes text from comments // Add comment notes above form
function sophia_after_dark_modify_text_before_comment_form($arg) { function sophia_after_dark_modify_text_before_comment_form($arg) {
$arg['comment_notes_before'] = wp_kses_post( $arg['comment_notes_before'] = wp_kses_post(
'<p class="comment-notes">' . '<p class="comment-notes">' .
@ -49,13 +55,17 @@ function sophia_after_dark_modify_text_before_comment_form($arg) {
} }
add_filter('comment_form_defaults', 'sophia_after_dark_modify_text_before_comment_form'); add_filter('comment_form_defaults', 'sophia_after_dark_modify_text_before_comment_form');
// Add note below comment form about privacy policy consent // Add privacy policy consent note below form
function sophia_after_dark_modify_text_comment_form($post_id) { function sophia_after_dark_modify_text_comment_form($post_id) {
$link = '<a href="/privacy-policy">' . esc_html__( 'Privacy Policy', 'sophia-after-dark' ) . '</a>';
printf( printf(
'<span class="submit-comment-note">%s</span>', '<span class="submit-comment-note">%s</span>',
sprintf(
wp_kses( wp_kses(
__('By commenting, you consent to our <a href="/privacy-policy">Privacy Policy</a>', 'sophia-after-dark'), __( 'By commenting, you consent to our %s.', 'sophia-after-dark' ),
array('a' => array('href' => array())) array( 'a' => array( 'href' => array() ) )
),
$link
) )
); );
} }
@ -64,24 +74,22 @@ add_action('comment_form', 'sophia_after_dark_modify_text_comment_form');
?> ?>
<div id="comments" class="comments-area"> <div id="comments" class="comments-area">
<?php <?php if ( have_comments() ) : ?>
if ( have_comments() ) : <h2 class="comments-title" aria-label="<?php esc_attr_e( 'Comments Section', 'sophia-after-dark' ); ?>">
?>
<h2 class="comments-title">
<?php <?php
$sophia_after_dark_comment_count = get_comments_number(); $sophia_after_dark_comment_count = get_comments_number();
if ( '1' === $sophia_after_dark_comment_count ) { if ( '1' === $sophia_after_dark_comment_count ) {
printf( printf(
/* translators: 1: title. */ /* translators: %s: Post title */
esc_html__( 'One Comment on &ldquo;%1$s&rdquo;', 'sophia-after-dark' ), esc_html__( 'One Comment on “%s”', 'sophia-after-dark' ),
'<span>' . esc_html(get_the_title()) . '</span>' '<span>' . esc_html( get_the_title() ) . '</span>'
); );
} else { } else {
printf( printf(
/* translators: 1: comment count number, 2: title. */ /* translators: 1: Comment count, 2: Post title */
esc_html( _nx( '%1$s Comments on &ldquo;%2$s&rdquo;', '%1$s Comments on &ldquo;%2$s&rdquo;', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ), esc_html( _nx( '%1$s Comment on “%2$s”', '%1$s Comments on “%2$s”', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ),
number_format_i18n( $sophia_after_dark_comment_count ), number_format_i18n( $sophia_after_dark_comment_count ),
'<span>' . esc_html(get_the_title()) . '</span>' '<span>' . esc_html( get_the_title() ) . '</span>'
); );
} }
?> ?>
@ -94,22 +102,17 @@ add_action('comment_form', 'sophia_after_dark_modify_text_comment_form');
wp_list_comments( array( wp_list_comments( array(
'style' => 'ol', 'style' => 'ol',
'short_ping' => true, 'short_ping' => true,
'reply_text' => __( 'Reply', 'sophia-after-dark' ),
) ); ) );
?> ?>
</ol> </ol>
<?php <?php the_comments_navigation(); ?>
the_comments_navigation();
if ( ! comments_open() ) : <?php if ( ! comments_open() ) : ?>
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'sophia-after-dark' ); ?></p> <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'sophia-after-dark' ); ?></p>
<?php <?php endif; ?>
endif; <?php endif; ?>
endif;
comment_form();
?>
<?php comment_form(); ?>
</div> </div>

View File

@ -68,10 +68,11 @@ if ( ! function_exists( 'sophia_after_dark_setup' ) ) :
) ); ) );
// Set up the WordPress core custom background feature. // Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'sophia_after_dark_custom_background_args', array( // Disabled in V1.4.3
'default-color' => 'ffffff', //add_theme_support( 'custom-background', apply_filters( 'sophia_after_dark_custom_background_args', array(
'default-image' => '', //'default-color' => 'ffffff',
) ) ); //'default-image' => '',
//) ) );
// Add theme support for selective refresh for widgets. // Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'customize-selective-refresh-widgets' );
@ -146,8 +147,9 @@ add_filter( 'walker_nav_menu_start_el', 'sophia_after_dark_nav_description', 10,
/** /**
* Implement the Custom Header feature. * Implement the Custom Header feature.
* Disabled in V1.4.3
*/ */
require get_template_directory() . '/inc/custom-header.php'; //require get_template_directory() . '/inc/custom-header.php';
/** /**
* Custom template tags for this theme. * Custom template tags for this theme.
@ -197,3 +199,40 @@ require get_template_directory() . '/inc/metaboxes/mt-post-sidebar-meta.php';
if ( ! function_exists( 'breadcrumb_trail' ) ) { if ( ! function_exists( 'breadcrumb_trail' ) ) {
require get_template_directory() . '/inc/mt-class-breadcrumbs.php'; require get_template_directory() . '/inc/mt-class-breadcrumbs.php';
} }
// Function to allow images in WordPress comments
function allow_images_in_comments($comment_content) {
// Allow only specific HTML tags, including <img>
$allowed_tags = array(
'a' => array('href' => array(), 'title' => array()),
'em' => array(),
'strong' => array(),
'img' => array(
'src' => array(),
'alt' => array(),
'width' => array(),
'height' => array(),
'class' => array(),
),
);
// Strip out disallowed tags but keep allowed ones
return wp_kses($comment_content, $allowed_tags);
}
// Hook to filter the comment text before displaying it
add_filter('comment_text', 'allow_images_in_comments');
// Function to make URLs for images clickable in comments
function clickable_images_in_comments($comment_content) {
// Automatically convert image URLs to HTML <img> tags
$comment_content = preg_replace(
'/(http:\/\/[^\s"]+\.(jpg|jpeg|png|gif))/i',
'<img src="$1" alt="" class="comment-image" />',
$comment_content
);
return $comment_content;
}
// Hook to make image URLs clickable
add_filter('comment_text', 'clickable_images_in_comments');

View File

@ -14,128 +14,74 @@
<!doctype html> <!doctype html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
<head> <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 <?php
$author_id = get_option('sophia_after_dark_home_og_user', 1); // Default to user ID 1 if not set // Set default author for home page OG metadata
$author_bio = get_the_author_meta('description', $author_id); $author_id = (int) get_option( 'sophia_after_dark_home_og_user', 1 );
$author_bio = get_the_author_meta( 'description', $author_id );
echo '<meta charset="' . get_bloginfo('charset') . '">' . "\n"; if ( is_front_page() ) {
echo '<meta name="viewport" content="width=device-width, initial-scale=1">' . "\n"; $home_og_image = get_option( 'sophia_after_dark_home_og_image' );
if (is_front_page()) { if ( $home_og_image ) {
$home_og_image = get_option('sophia_after_dark_home_og_image'); printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $home_og_image ) );
if ($home_og_image) {
echo '<meta property="og:image" content="' . esc_url($home_og_image) . '" />' . "\n";
} }
echo '<meta property="og:title" content="' . esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description')) . '" />' . "\n";
echo '<meta property="og:description" content="' . esc_attr($author_bio) . '" />' . "\n"; printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_bloginfo( 'name' ) . ' - ' . get_bloginfo( 'description' ) ) );
echo '<meta property="og:url" content="' . esc_url(home_url('/')) . '" />' . "\n"; printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( $author_bio ) );
} elseif (is_single() || is_page()) { printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( home_url( '/' ) ) );
} elseif ( is_singular() ) {
global $post; global $post;
if (has_post_thumbnail($post->ID)) { $thumbnail_url = get_template_directory_uri() . '/assets/images/default-og-image.webp';
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'og-image-size');
if ($thumbnail) { if ( has_post_thumbnail( $post?->ID ) ) {
echo '<meta property="og:image" content="' . esc_url($thumbnail[0]) . '" />' . "\n"; $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'og-image-size' );
// $thumbnail_url = esc_url($thumbnail[0]); if ( ! empty( $image[0] ) ) {
// $thumbnail_parts = pathinfo($thumbnail_url); $thumbnail_url = $image[0];
// $thumbnail_new_url = $thumbnail_parts['dirname'] . '/' . $thumbnail_parts['filename'] . '-1536x878.' . $thumbnail_parts['extension'];
// echo '<meta property="og:image" content="' . $thumbnail_new_url . '" />' . "\n";
} }
} else {
echo '<meta property="og:image" content="' . esc_url(get_template_directory_uri() . '/assets/images/default-og-image.webp') . '" />' . "\n";
} }
echo '<meta property="og:title" content="' . esc_attr(get_the_title()) . '" />' . "\n"; printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $thumbnail_url ) );
echo '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n"; printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_the_title() ) );
echo '<meta property="og:url" content="' . esc_url(get_permalink()) . '" />' . "\n"; printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( get_the_excerpt() ) );
} printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( get_permalink() ) );
echo '<link rel="profile" href="https://gmpg.org/xfn/11">' . "\n"; }
wp_head();
wp_head();
?> ?>
</head> </head>
<body <?php body_class(); ?>> <body <?php body_class(); ?>>
<?php <?php
if ( function_exists( 'wp_body_open' ) ) { if ( function_exists( 'wp_body_open' ) ) {
wp_body_open(); wp_body_open();
} else { } else {
/** do_action( 'wp_body_open' ); // Backwards compatibility for < WP 5.2
* Hook: wp_body_open }
*
* @since 1.1.0
*/
do_action( 'wp_body_open' );
}
/** do_action( 'sophia_after_dark_before_page' );
* sophia_after_dark before page hook
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_before_page' );
?> ?>
<div id="page" class="site"> <div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip To Content', 'sophia-after-dark' ) ?></a> <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'sophia-after-dark' ); ?></a>
<?php
/**
* sophia_after_dark before header
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_before_header' );
$sophia_after_dark_enable_top_header = get_theme_mod( 'sophia_after_dark_enable_top_header', true ); <?php
if ( true === $sophia_after_dark_enable_top_header ) { // Top Header
/** if ( get_theme_mod( 'sophia_after_dark_enable_top_header', false ) ) {
* hook - sophia_after_dark_top_header
*
* @hooked - sophia_after_dark_top_header_start - 5
* @hooked - sophia_after_dark_trending_section - 10
* @hooked - sophia_after_dark_top_header_nav - 20
* @hooked - sophia_after_dark_top_header_end - 50
*/
do_action( 'sophia_after_dark_top_header' ); do_action( 'sophia_after_dark_top_header' );
} }
/** // Main Header
* sophia_after_dark main header
*
* @hooked - sophia_after_dark_main_header_start - 5
* @hooked - sophia_after_dark_site_branding - 10
* @hooked - sophia_after_dark_menu_wrapper_start - 15
* @hooked - sophia_after_dark_header_main_menu - 20
* @hooked - sophia_after_dark_menu_icon_wrapper_start - 25
* @hooked - sophia_after_dark_menu_social_icons - 30
* @hooked - sophia_after_dark_menu_search_icon - 35
* @hooked - sophia_after_dark_menu_icon_wrapper_end - 40
* @hooked - sophia_after_dark_menu_wrapper_end - 45
* @hooked - sophia_after_dark_main_header_end - 50
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_main_header' ); do_action( 'sophia_after_dark_main_header' );
// Front page slider or inner page header
if ( is_front_page() ) { if ( is_front_page() ) {
/**
* hook - front_slider_section
* displays front top section before archive blogs.
*/
do_action( 'sophia_after_dark_front_slider_section' ); do_action( 'sophia_after_dark_front_slider_section' );
} } else {
if ( ! is_front_page() ) {
/**
* sophia_after_dark_innerpage_header hook
*
* @hooked - sophia_after_dark_innerpage_header_start - 5
* @hooked - sophia_after_dark_innerpage_header_title - 10
* @hooked - sophia_after_dark_breadcrumb_content - 15
* @hooked - sophia_after_dark_innerpage_header_end - 20
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_innerpage_header' ); do_action( 'sophia_after_dark_innerpage_header' );
} }
?> ?>

View File

@ -9,6 +9,7 @@
* *
* @package Sophia After Dark * @package Sophia After Dark
* @since 1.0.0 * @since 1.0.0
* @disabled 1.4.3
*/ */
/** /**

View File

@ -262,11 +262,11 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
* Icon field * Icon field
*/ */
case 'icon': case 'icon':
$sophia_after_dark_font_awesome_icon_array = sophia_after_dark_font_awesome_icon_array(); $sophia_after_dark_fork_awesome_icon_array = sophia_after_dark_fork_awesome_icon_array();
echo '<div class="mt-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="mt-repeater-icon-list mt-clearfix">'; echo '<div class="mt-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="mt-repeater-icon-list mt-clearfix">';
foreach ( $sophia_after_dark_font_awesome_icon_array as $sophia_after_dark_font_awesome_icon ) { foreach ( $sophia_after_dark_fork_awesome_icon_array as $sophia_after_dark_fork_awesome_icon ) {
$icon_class = $new_value == $sophia_after_dark_font_awesome_icon ? 'icon-active' : ''; $icon_class = $new_value == $sophia_after_dark_fork_awesome_icon ? 'icon-active' : '';
echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_font_awesome_icon ).'"></i></li>'; echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_fork_awesome_icon ).'"></i></li>';
} }
echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>'; echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>';
break; break;
@ -275,11 +275,11 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
* Social Icon field * Social Icon field
*/ */
case 'social_icon': case 'social_icon':
$sophia_after_dark_font_awesome_social_icon_array = sophia_after_dark_font_awesome_social_icon_array(); $sophia_after_dark_fork_awesome_social_icon_array = sophia_after_dark_fork_awesome_social_icon_array();
echo '<div class="mt-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="mt-repeater-icon-list mt-clearfix">'; echo '<div class="mt-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="mt-repeater-icon-list mt-clearfix">';
foreach ( $sophia_after_dark_font_awesome_social_icon_array as $sophia_after_dark_font_awesome_icon ) { foreach ( $sophia_after_dark_fork_awesome_social_icon_array as $sophia_after_dark_fork_awesome_icon ) {
$icon_class = $new_value == $sophia_after_dark_font_awesome_icon ? 'icon-active' : ''; $icon_class = $new_value == $sophia_after_dark_fork_awesome_icon ? 'icon-active' : '';
echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_font_awesome_icon ).'"></i></li>'; echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_fork_awesome_icon ).'"></i></li>';
} }
echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>'; echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>';
break; break;

View File

@ -72,9 +72,9 @@ add_action( 'wp_head', 'sophia_after_dark_pingback_header' );
if ( ! function_exists( 'sophia_after_dark_fonts_url' ) ) : if ( ! function_exists( 'sophia_after_dark_fonts_url' ) ) :
/** /**
* Register Google fonts for Sophia After Dark. * Register Bunny fonts for Sophia After Dark.
* *
* @return string Google fonts URL for the theme. * @return string Bunny fonts URL for the theme.
* @since 1.0.0 * @since 1.0.0
*/ */
function sophia_after_dark_fonts_url() { function sophia_after_dark_fonts_url() {
@ -132,56 +132,43 @@ function sophia_after_dark_admin_scripts( $hook ) {
/** /**
* Enqueue scripts and styles. * Enqueue scripts and styles.
*/ */
function sophia_after_dark_scripts() { function sophia_after_dark_scripts(): void {
global $sophia_after_dark_theme_version; $v = wp_get_theme()->get('Version');
$dir = get_template_directory_uri();
wp_enqueue_style( 'sophia-after-dark-fonts', sophia_after_dark_fonts_url(), array(), null ); wp_enqueue_style('sophia-after-dark-fonts', sophia_after_dark_fonts_url(), [], null);
wp_enqueue_style( 'lightslider-style', get_template_directory_uri() .'/assets/library/lightslider/css/lightslider.min.css', array(), '' ); wp_enqueue_style('lightslider-style', "$dir/assets/library/lightslider/css/lightslider.min.css", [], null);
wp_enqueue_style( 'animate', get_template_directory_uri(). '/assets/library/animate/animate.min.css', array(), '3.5.1' ); wp_enqueue_style('animate', "$dir/assets/library/animate/animate.min.css", [], '3.5.1');
wp_enqueue_style( 'sophia-after-dark-style', get_stylesheet_uri(), array(), esc_attr( $sophia_after_dark_theme_version) ); wp_enqueue_style('sophia-after-dark-style', get_stylesheet_uri(), [], $v);
wp_enqueue_style( 'sophia-after-dark-responsive-style', get_template_directory_uri(). '/assets/css/mt-responsive.css', array(), esc_attr( $sophia_after_dark_theme_version ) ); wp_enqueue_style('sophia-after-dark-responsive-style', "$dir/assets/css/mt-responsive.css", [], $v);
wp_enqueue_script( 'sophia-after-dark-combine-scripts', get_template_directory_uri() .'/assets/js/mt-combine-scripts.js', array('jquery'), esc_attr( $sophia_after_dark_theme_version ), true ); wp_enqueue_script('sophia-after-dark-combine-scripts', "$dir/assets/js/mt-combine-scripts.js", ['jquery'], $v, true);
wp_enqueue_script( 'sophia-after-dark-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), esc_attr( $sophia_after_dark_theme_version ), true ); wp_enqueue_script('sophia-after-dark-navigation', "$dir/assets/js/navigation.js", [], $v, true);
wp_enqueue_script( 'sophia-after-dark-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), esc_attr( $sophia_after_dark_theme_version ), true ); wp_enqueue_script('sophia-after-dark-skip-link-focus-fix', "$dir/assets/js/skip-link-focus-fix.js", [], $v, true);
wp_enqueue_script( 'sophia-after-dark-custom-scripts', get_template_directory_uri() .'/assets/js/mt-custom-scripts.js', array('jquery'), esc_attr( $sophia_after_dark_theme_version ), true ); wp_enqueue_script('sophia-after-dark-custom-scripts', "$dir/assets/js/mt-custom-scripts.js", ['jquery'], $v, true);
$sophia_after_dark_enable_sticky_menu = get_theme_mod( 'sophia_after_dark_enable_sticky_menu', true ); wp_localize_script('sophia-after-dark-custom-scripts', 'sophia_after_darkObject', [
if ( true === $sophia_after_dark_enable_sticky_menu ) { 'menu_sticky' => get_theme_mod('sophia_after_dark_enable_sticky_menu', true) ? 'on' : 'off',
$sticky_value = 'on'; 'wow_effect' => get_theme_mod('sophia_after_dark_enable_wow_animation', true) ? 'on' : 'off',
} else { ]);
$sticky_value = 'off';
}
$sophia_after_dark_enable_wow_animation = get_theme_mod( 'sophia_after_dark_enable_wow_animation', true ); if (is_singular() && comments_open() && get_option('thread_comments')) {
if ( true === $sophia_after_dark_enable_wow_animation ) { wp_enqueue_script('comment-reply');
$wow_value = 'on';
} else {
$wow_value = 'off';
}
wp_localize_script( 'sophia-after-dark-custom-scripts', 'sophia_after_darkObject', array(
'menu_sticky' => $sticky_value,
'wow_effect' => $wow_value
) );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
} }
} }
add_action( 'wp_enqueue_scripts', 'sophia_after_dark_scripts' ); add_action('wp_enqueue_scripts', 'sophia_after_dark_scripts');
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------*/
if ( ! function_exists( 'sophia_after_dark_font_awesome_social_icon_array' ) ) : if ( ! function_exists( 'sophia_after_dark_fork_awesome_social_icon_array' ) ) :
/** /**
* Define font awesome social media icons * Define fork awesome social media icons
* *
* @return array(); * @return array();
* @since 1.0.0 * @since 1.0.0
*/ */
function sophia_after_dark_font_awesome_social_icon_array() { function sophia_after_dark_fork_awesome_social_icon_array() {
return array( return array(
"fa fa-facebook-square","fa fa-facebook-f","fa fa-facebook","fa fa-facebook-official","fa fa-twitter-square","fa fa-twitter","fa fa-yahoo","fa fa-google","fa fa-google-wallet","fa fa-google-plus-circle","fa fa-google-plus-official","fa fa-instagram","fa fa-linkedin-square","fa fa-linkedin","fa fa-pinterest-p","fa fa-pinterest","fa fa-pinterest-square","fa fa-google-plus-square","fa fa-google-plus","fa fa-youtube-square","fa fa-youtube","fa fa-youtube-play","fa fa-vimeo","fa fa-vimeo-square", "fa fa-facebook-square","fa fa-facebook-f","fa fa-facebook","fa fa-facebook-official","fa fa-twitter-square","fa fa-twitter","fa fa-yahoo","fa fa-google","fa fa-google-wallet","fa fa-google-plus-circle","fa fa-google-plus-official","fa fa-instagram","fa fa-linkedin-square","fa fa-linkedin","fa fa-pinterest-p","fa fa-pinterest","fa fa-pinterest-square","fa fa-google-plus-square","fa fa-google-plus","fa fa-youtube-square","fa fa-youtube","fa fa-youtube-play","fa fa-vimeo","fa fa-vimeo-square",
); );

View File

@ -12,55 +12,55 @@
* @package Sophia After Dark * @package Sophia After Dark
* @since 1.0.0 * @since 1.0.0
*/ */
$archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--masonry-style' );
declare(strict_types=1);
get_header(); get_header();
$archive_style = get_theme_mod('sophia_after_dark_archive_style', 'mt-archive--masonry-style');
?> ?>
<div class="mt-page-content-wrapper"> <div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area"> <div itemscope id="primary" class="content-area">
<main id="main" class="site-main"> <main id="main" class="site-main">
<?php
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '<div class="archive-grid-post-wrapper">';
}
if ( have_posts() ) : <?php if ('mt-archive--block-grid-style' === $archive_style): ?>
if ( 'mt-archive--masonry-style' === $archive_style ) { <div class="archive-grid-post-wrapper">
?> <?php endif; ?>
<?php if (have_posts()): ?>
<?php if ('mt-archive--masonry-style' === $archive_style): ?>
<div class="sophia-after-dark-content-masonry"> <div class="sophia-after-dark-content-masonry">
<div id="mt-masonry"> <div id="mt-masonry">
<?php endif; ?>
<?php <?php
} while (have_posts()):
/* Start the Loop */
while ( have_posts() ) :
the_post(); the_post();
get_template_part('template-parts/content', get_post_format());
/*
* 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_format() );
endwhile; endwhile;
if ( 'mt-archive--masonry-style' === $archive_style ) {
?> ?>
</div>
</div>
<?php
}
the_posts_pagination(); <?php if ('mt-archive--masonry-style' === $archive_style): ?>
else : </div> <!-- #mt-masonry -->
get_template_part( 'template-parts/content', 'none' ); </div> <!-- .sophia-after-dark-content-masonry -->
endif; <?php endif; ?>
<?php the_posts_pagination(); ?>
<?php else: ?>
<?php get_template_part('template-parts/content', 'none'); ?>
<?php endif; ?>
<?php if ('mt-archive--block-grid-style' === $archive_style): ?>
</div> <!-- .archive-grid-post-wrapper -->
<?php endif; ?>
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div>';
}
?>
</main> </main>
</div> </div>
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
</div> </div>
<?php
get_footer(); <?php get_footer(); ?>

View File

@ -15,23 +15,27 @@
get_header(); get_header();
?> ?>
<div class="mt-page-content-wrapper"> <div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area"> <div id="primary" class="content-area" itemscope itemtype="https://schema.org/WebPage">
<main id="main" class="site-main"> <main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Page Content', 'sophia-after-dark' ); ?>">
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
get_template_part( 'template-parts/content', 'page' ); get_template_part( 'template-parts/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template. // Load comments if open or at least one exists.
if ( comments_open() || get_comments_number() ) : if ( comments_open() || get_comments_number() ) :
comments_template(); comments_template();
endif; endif;
endwhile; // End of the loop. endwhile;
?> ?>
</main>
</div> </main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
</div> </div><!-- .mt-page-content-wrapper -->
<?php <?php
get_footer(); get_footer();

View File

@ -12,47 +12,51 @@ get_header();
?> ?>
<div class="mt-page-content-wrapper"> <div class="mt-page-content-wrapper">
<section id="primary" class="content-area"> <section id="primary" class="content-area">
<main id="main" class="site-main"> <main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Search Results', 'sophia-after-dark' ); ?>">
<?php <?php
if ( 'mt-archive--block-grid-style' === $archive_style ) { if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '<div class="archive-grid-post-wrapper">'; echo '<div class="archive-grid-post-wrapper">';
} }
if ( have_posts() ) : if ( have_posts() ) :
if ( 'mt-archive--masonry-style' === $archive_style ) { if ( 'mt-archive--masonry-style' === $archive_style ) :
?> ?>
<div class="sophia-after-dark-content-masonry"> <div class="sophia-after-dark-content-masonry">
<div id="mt-masonry"> <div id="mt-masonry">
<?php <?php
} endif;
/* Start the Loop */ /* Start the Loop */
while ( have_posts() ) : while ( have_posts() ) :
the_post(); 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', 'search' ); get_template_part( 'template-parts/content', 'search' );
endwhile; endwhile;
if ( 'mt-archive--masonry-style' === $archive_style ) { if ( 'mt-archive--masonry-style' === $archive_style ) :
?> ?>
</div> </div><!-- #mt-masonry -->
</div> </div><!-- .sophia-after-dark-content-masonry -->
<?php <?php
} endif;
the_posts_pagination(); the_posts_pagination();
else : else :
get_template_part( 'template-parts/content', 'none' ); get_template_part( 'template-parts/content', 'none' );
endif; endif;
if ( 'mt-archive--block-grid-style' === $archive_style ) { if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div>'; echo '</div><!-- .archive-grid-post-wrapper -->';
} }
?> ?>
</main>
</section> </main><!-- #main -->
</section><!-- #primary -->
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
</div> </div><!-- .mt-page-content-wrapper -->
<?php <?php
get_footer(); get_footer();

View File

@ -20,34 +20,42 @@ if ( ! is_active_sidebar( 'footer-sidebar' ) &&
return; return;
} }
$sophia_after_dark_widget_area_layout = get_theme_mod( 'sophia_after_dark_widget_area_layout', 'column-three' ); $layout = get_theme_mod( 'sophia_after_dark_widget_area_layout', 'column-three' );
?> ?>
<div id="top-footer" class="footer-widgets-wrapper footer-<?php echo esc_attr( $sophia_after_dark_widget_area_layout ); ?> mt-clearfix"> <div id="top-footer" class="footer-widgets-wrapper footer-<?php echo esc_attr( $layout ); ?> mt-clearfix">
<div class="mt-container"> <div class="mt-container">
<div class="footer-widgets-area mt-clearfix"> <div class="footer-widgets-area mt-clearfix">
<div class="mt-footer-widget-wrapper mt-column-wrapper mt-clearfix"> <div class="mt-footer-widget-wrapper mt-column-wrapper mt-clearfix">
<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="0.3s">
<?php dynamic_sidebar( 'footer-sidebar' ); ?>
</div>
<?php if ( $sophia_after_dark_widget_area_layout != 'column-one' ){ ?> <?php
<div class="mt-footer-widget wow fadeInLeft" data-woww-duration="0.6s"> // Footer widget 1 (always shown)
<?php dynamic_sidebar( 'footer-sidebar-2' ); ?> echo '<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="0.3s">';
</div> dynamic_sidebar( 'footer-sidebar' );
<?php } ?> echo '</div>';
<?php if ( $sophia_after_dark_widget_area_layout == 'column-three' || $sophia_after_dark_widget_area_layout == 'column-four' ){ ?> // Footer widget 2 (shown in all but column-one layout)
<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="0.9s"> if ( $layout !== 'column-one' ) {
<?php dynamic_sidebar( 'footer-sidebar-3' ); ?> echo '<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="0.6s">';
</div> dynamic_sidebar( 'footer-sidebar-2' );
<?php } ?> echo '</div>';
}
// Footer widget 3 (only for three or four column layouts)
if ( in_array( $layout, [ 'column-three', 'column-four' ], true ) ) {
echo '<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="0.9s">';
dynamic_sidebar( 'footer-sidebar-3' );
echo '</div>';
}
// Footer widget 4 (only for four column layout)
if ( $layout === 'column-four' ) {
echo '<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="1.2s">';
dynamic_sidebar( 'footer-sidebar-4' );
echo '</div>';
}
?>
<?php if ( $sophia_after_dark_widget_area_layout == 'column-four' ){ ?>
<div class="mt-footer-widget wow fadeInLeft" data-wow-duration="1.2s">
<?php dynamic_sidebar( 'footer-sidebar-4' ); ?>
</div>
<?php } ?>
</div> </div>
</div> </div>
</div> </div>

View File

@ -11,8 +11,8 @@
get_header(); get_header();
?> ?>
<div class="mt-page-content-wrapper"> <div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area"> <div id="primary" class="content-area" itemscope itemtype="https://schema.org/Article">
<main id="main" class="site-main"> <main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Single Post Content', 'sophia-after-dark' ); ?>">
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
@ -21,20 +21,24 @@ get_header();
the_post_navigation(); the_post_navigation();
// If comments are open or we have at least one comment, load up the comment template. // Load comments template if comments are open or exist.
if ( comments_open() || get_comments_number() ) : if ( comments_open() || get_comments_number() ) :
comments_template(); comments_template();
endif; endif;
endwhile; // End of the loop. endwhile;
// Load related posts section if enabled in theme settings.
$related_posts_option = get_theme_mod( 'sophia_after_dark_enable_related_posts', true ); $related_posts_option = get_theme_mod( 'sophia_after_dark_enable_related_posts', true );
if ( true === $related_posts_option && 'post' === get_post_type() ) { if ( true === $related_posts_option && 'post' === get_post_type() ) {
get_template_part( 'template-parts/related/related', 'posts' ); get_template_part( 'template-parts/related/related', 'posts' );
} }
?> ?>
</main>
</div> </main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?> <?php get_sidebar(); ?>
</div> </div><!-- .mt-page-content-wrapper -->
<?php <?php
get_footer(); get_footer();

118
style.css
View File

@ -3,9 +3,9 @@ Theme Name: Sophia After Dark
Author: Sophia Atkinson, Mystery Themes Author: Sophia Atkinson, Mystery Themes
Author URI: https://sophia.wtf Author URI: https://sophia.wtf
Description: Sophia After Dark is a page builder based and colorful free blog style WordPress theme fit for writers and bloggers. With the help of live customizer option makes your site own and present your content in an attractive way. It comes up with an amazing creative blog layouts, fully RTL and translation ready, and also compatible with Gutenberg. The theme works perfectly with Elementor that helps to create a beautiful and unique website faster. As its name suggests, it added staggering variety of color and makes your site attractive and elegant. Description: Sophia After Dark is a page builder based and colorful free blog style WordPress theme fit for writers and bloggers. With the help of live customizer option makes your site own and present your content in an attractive way. It comes up with an amazing creative blog layouts, fully RTL and translation ready, and also compatible with Gutenberg. The theme works perfectly with Elementor that helps to create a beautiful and unique website faster. As its name suggests, it added staggering variety of color and makes your site attractive and elegant.
Version: 1.3.2 Version: 1.4.3
Requires at least: 4.7 Requires at least: 4.7
Tested up to: 6.0.2 Tested up to: 6.8.1
Requires PHP: 5.2.4 Requires PHP: 5.2.4
License: GNU General Public License v3 or later License: GNU General Public License v3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -116,10 +116,6 @@ html {
box-sizing: border-box; box-sizing: border-box;
} }
body {
background: #fff;
}
article, article,
aside, aside,
details, details,
@ -231,6 +227,7 @@ h6 {
} }
p { p {
font-size: 15px;
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -443,7 +440,9 @@ input[type="submit"] {
border: 1px solid #e1e1e1; border: 1px solid #e1e1e1;
background: none; background: none;
} }
button{
padding: none!important;
}
.navigation .nav-links a:hover, .navigation .nav-links a:hover,
.bttn:hover, .bttn:hover,
button, button,
@ -517,7 +516,7 @@ Links
--------------------------------------------------------------*/ --------------------------------------------------------------*/
a { a {
color: #dd3333; color: #F5A9B8;
text-decoration: none; text-decoration: none;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out; -webkit-transition: all 0.3s ease-in-out;
@ -529,7 +528,7 @@ a:visited {}
a:hover, a:hover,
a:focus, a:focus,
a:active { a:active {
color: #dd3333; color: #F5A9B8;
} }
a:focus { a:focus {
@ -668,7 +667,7 @@ Posts and pages
h1.entry-title { h1.entry-title {
color: #353535; color: #353535;
font-weight: 700; font-weight: 600;
padding-bottom: 0; padding-bottom: 0;
text-transform: capitalize; text-transform: capitalize;
} }
@ -725,7 +724,7 @@ h1.entry-title a {
.entry-cat a:hover, .entry-cat a:hover,
.byline a:hover, .byline a:hover,
.posted-on a:hover { .posted-on a:hover {
color: #dd3333; color: #F5A9B8;
} }
.cat-links { .cat-links {
@ -748,7 +747,7 @@ h1.entry-title a {
} }
.edit-link .post-edit-link { .edit-link .post-edit-link {
background: #dd3333; background: #F5A9B8;
padding: 4px 10px; padding: 4px 10px;
color: #FFF !important; color: #FFF !important;
line-height: 1; line-height: 1;
@ -789,6 +788,7 @@ article.hentry .entry-footer>span {
.page-header .page-title { .page-header .page-title {
color: #ffffff; color: #ffffff;
padding-bottom: 15px; padding-bottom: 15px;
font-weight: 600;
} }
.updated { .updated {
@ -804,7 +804,7 @@ article.hentry .entry-footer>span {
} }
.entry-footer a:hover { .entry-footer a:hover {
color: #dd3333 color: #F5A9B8
} }
.nav-links .meta-nav { .nav-links .meta-nav {
@ -956,7 +956,7 @@ Comments
#comments h3 { #comments h3 {
margin: 0 0 10px; margin: 0 0 10px;
color: #141414; color: #fff;
font-weight: 600; font-weight: 600;
display: inline-block; display: inline-block;
line-height: 22px; line-height: 22px;
@ -1032,7 +1032,7 @@ textarea#comment {
} }
.comment-author .fn .url:hover { .comment-author .fn .url:hover {
color: #dd3333; color: #F5A9B8;
} }
.comment-author .says { .comment-author .says {
@ -1052,7 +1052,7 @@ textarea#comment {
} }
.commentmetadata .comment-edit-link { .commentmetadata .comment-edit-link {
color: #dd3333; color: #F5A9B8;
} }
.commentmetadata+.clear { .commentmetadata+.clear {
@ -1060,7 +1060,7 @@ textarea#comment {
} }
.reply .comment-reply-link { .reply .comment-reply-link {
background: none repeat scroll 0 0 #dd3333; background: none repeat scroll 0 0 #F5A9B8;
color: #FFFFFF; color: #FFFFFF;
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
@ -1071,6 +1071,7 @@ textarea#comment {
#respond { #respond {
padding: 20px; padding: 20px;
margin: 20px 0 0; margin: 20px 0 0;
margin-bottom: 20px !important;
color: #ffffff; color: #ffffff;
border: 1px solid rgba(255, 255, 255, 0.5); border: 1px solid rgba(255, 255, 255, 0.5);
} }
@ -1081,7 +1082,7 @@ textarea#comment {
#cancel-comment-reply-link { #cancel-comment-reply-link {
font-style: italic; font-style: italic;
color: #dd3333; color: #F5A9B8;
} }
#cancel-comment-reply-link:before { #cancel-comment-reply-link:before {
@ -1089,11 +1090,11 @@ textarea#comment {
content: "\f057"; content: "\f057";
margin: 0 5px 0 20px; margin: 0 5px 0 20px;
font-style: normal; font-style: normal;
color: #dd3333; color: #F5A9B8;
} }
.logged-in-as a { .logged-in-as a {
color: #dd3333; color: #F5A9B8;
} }
@ -1338,7 +1339,7 @@ Default widget css
.widget a:hover, .widget a:hover,
.widget a:hover::before, .widget a:hover::before,
.widget li:hover::before { .widget li:hover::before {
color: #dd3333; color: #F5A9B8;
} }
.widget_archive a::before, .widget_archive a::before,
@ -1408,8 +1409,8 @@ Default widget css
.widget_search .search-submit { .widget_search .search-submit {
height: 36px; height: 36px;
width: 25%; width: 25%;
background: #dd3333; background: #F5A9B8;
border-color: #dd3333; border-color: #F5A9B8;
color: #ffffff; color: #ffffff;
} }
@ -1444,8 +1445,8 @@ Default widget css
.widget_search .search-submit:hover { .widget_search .search-submit:hover {
height: 36px; height: 36px;
width: 25%; width: 25%;
background: #dd3333; background: #F5A9B8;
border-color: #dd3333; border-color: #F5A9B8;
color: #ffffff; color: #ffffff;
padding: 0; padding: 0;
} }
@ -1463,9 +1464,9 @@ Default widget css
.widget_tag_cloud .tagcloud a:hover, .widget_tag_cloud .tagcloud a:hover,
.widget.widget_tag_cloud a:hover { .widget.widget_tag_cloud a:hover {
background: #dd3333; background: #F5A9B8;
color: #fff; color: #fff;
border-color: #dd3333; border-color: #F5A9B8;
} }
.wp-block-search__button { .wp-block-search__button {
@ -1474,6 +1475,7 @@ Default widget css
width: 80px; width: 80px;
margin: 0; margin: 0;
height: 36px; height: 36px;
padding: unset!important;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
@ -1670,7 +1672,7 @@ Header CSS
} }
#top-navigation ul li a:hover { #top-navigation ul li a:hover {
color: #dd3333; color: #F5A9B8;
} }
#masthead .widget { #masthead .widget {
@ -1753,7 +1755,7 @@ Header CSS
} }
.mt-social-icon-wrap li a:hover { .mt-social-icon-wrap li a:hover {
color: #dd3333; color: #F5A9B8;
} }
.mt-header-extra-icons { .mt-header-extra-icons {
@ -1790,7 +1792,6 @@ Header CSS
.is-sticky .mt-social-menu-wrapper { .is-sticky .mt-social-menu-wrapper {
background: #0B0B0B; background: #0B0B0B;
z-index: 9999; z-index: 9999;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
} }
#site-navigation { #site-navigation {
@ -1852,7 +1853,7 @@ Search CSS
} }
.mt-search-icon:hover { .mt-search-icon:hover {
color: #dd3333; color: #F5A9B8;
} }
.mt-search-icon i { .mt-search-icon i {
@ -1913,13 +1914,13 @@ Search CSS
} }
.mt-menu-search .mt-form-wrap .search-form .search-field:focus { .mt-menu-search .mt-form-wrap .search-form .search-field:focus {
outline: 2px solid #DD3333; outline: 2px solid #F5A9B8;
} }
.mt-menu-search .mt-form-wrap .search-form .search-submit { .mt-menu-search .mt-form-wrap .search-form .search-submit {
margin-top: 30px; margin-top: 30px;
padding: 16px 60px; padding: 16px 60px;
background: #dd3333; background: #F5A9B8;
border: none; border: none;
color: #fff; color: #fff;
font-size: 18px; font-size: 18px;
@ -1929,11 +1930,6 @@ Search CSS
transition: 0.3s ease; transition: 0.3s ease;
} }
.mt-menu-search .mt-form-wrap .search-form .search-submit:hover {
background: #dd3333;
border-radius: 30px;
}
.mt-form-close { .mt-form-close {
position: absolute; position: absolute;
right: 40px; right: 40px;
@ -1948,7 +1944,7 @@ Search CSS
} }
.mt-form-close:hover { .mt-form-close:hover {
color: #dd3333; color: #F5A9B8;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
@ -1974,7 +1970,7 @@ Menu CSS
} }
.menu-toggle:hover { .menu-toggle:hover {
color: #dd3333; color: #F5A9B8;
} }
.menu-toggle i { .menu-toggle i {
@ -2049,7 +2045,7 @@ Menu CSS
#site-navigation ul li.current_page_item>a, #site-navigation ul li.current_page_item>a,
#site-navigation ul li.current-menu-parent>a, #site-navigation ul li.current-menu-parent>a,
#site-navigation ul li.focus>a { #site-navigation ul li.focus>a {
color: #dd3333; color: #F5A9B8;
} }
#site-navigation ul li .sub-menu, #site-navigation ul li .sub-menu,
@ -2156,7 +2152,7 @@ Menu CSS
position: absolute; position: absolute;
top: -15px; top: -15px;
right: -20px; right: -20px;
background: #dd3333; background: #F5A9B8;
line-height: 24px; line-height: 24px;
font-size: 12px; font-size: 12px;
padding: 0 10px; padding: 0 10px;
@ -2173,7 +2169,7 @@ Menu CSS
height: 0; height: 0;
border-style: solid; border-style: solid;
border-width: 3px 3px 0 0; border-width: 3px 3px 0 0;
border-color: #dd3333 transparent transparent transparent; border-color: #F5A9B8 transparent transparent transparent;
-webkit-transition: all 0.3s ease; -webkit-transition: all 0.3s ease;
-o-transition: all 0.3s ease; -o-transition: all 0.3s ease;
transition: all 0.3s ease; transition: all 0.3s ease;
@ -2305,7 +2301,7 @@ Slider CSS
} }
.post-cats-list a { .post-cats-list a {
background: #dd3333; background: #F5A9B8;
font-size: 12px; font-size: 12px;
color: #fff; color: #fff;
padding: 1px 10px; padding: 1px 10px;
@ -2347,7 +2343,7 @@ Slider CSS
} }
.front-slider-block .lSAction>a:hover { .front-slider-block .lSAction>a:hover {
background: #dd3333; background: #F5A9B8;
} }
.features-post-title { .features-post-title {
@ -2397,7 +2393,7 @@ Slider CSS
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
color: #fff; color: #fff;
background: #dd3333; background: #F5A9B8;
text-align: center; text-align: center;
} }
@ -2438,7 +2434,7 @@ article {
.entry-title a:hover, .entry-title a:hover,
.cat-links a:hover { .cat-links a:hover {
color: #dd3333; color: #F5A9B8;
} }
.entry-meta a { .entry-meta a {
@ -2448,7 +2444,7 @@ article {
} }
.entry-meta a:hover { .entry-meta a:hover {
color: #dd3333; color: #F5A9B8;
} }
.entry-content { .entry-content {
@ -2482,7 +2478,7 @@ article {
.entry-footer .mt-readmore-btn:hover, .entry-footer .mt-readmore-btn:hover,
.btn-wrapper a:hover, .btn-wrapper a:hover,
.mt-readmore-btn:hover { .mt-readmore-btn:hover {
color: #dd3333; color: #F5A9B8;
} }
.entry-footer .mt-readmore-btn:hover i, .entry-footer .mt-readmore-btn:hover i,
@ -2518,7 +2514,7 @@ article.sticky::before {
display: block; display: block;
width: 40px; width: 40px;
height: 40px; height: 40px;
background: #dd3333; background: #F5A9B8;
color: #fff; color: #fff;
font-size: 15px; font-size: 15px;
line-height: 40px; line-height: 40px;
@ -2588,14 +2584,14 @@ article.page .post-thumbnail::before,
.navigation.pagination .nav-links .page-numbers.current, .navigation.pagination .nav-links .page-numbers.current,
.navigation.pagination .nav-links a.page-numbers:hover { .navigation.pagination .nav-links a.page-numbers:hover {
border: 1px solid #dd3333; border: 1px solid #F5A9B8;
padding: 12px 15px; padding: 12px 15px;
vertical-align: top; vertical-align: top;
display: inline-block; display: inline-block;
margin: 0 5px; margin: 0 5px;
font-size: 14px; font-size: 14px;
line-height: 13px; line-height: 13px;
color: #dd3333; color: #F5A9B8;
} }
.archive-grid-post-wrapper, .archive-grid-post-wrapper,
@ -2650,7 +2646,7 @@ Sidebar CSS
content: ""; content: "";
width: 25px; width: 25px;
height: 3px; height: 3px;
background: #dd3333; background: #F5A9B8;
top: 10px; top: 10px;
} }
@ -2726,7 +2722,7 @@ Error 404 styles
.error-404.not-found { .error-404.not-found {
text-align: center; text-align: center;
width: 900px; width: 900px;
border: 5px solid #dd3333; border: 5px solid #F5A9B8;
margin: 0 auto; margin: 0 auto;
padding: 30px 0 40px 0; padding: 30px 0 40px 0;
} }
@ -2759,7 +2755,7 @@ Custom Header styles
background-attachment: fixed; background-attachment: fixed;
margin-bottom: 50px; margin-bottom: 50px;
position: relative; position: relative;
border-top: 4px solid #dd3333; border-top: 4px solid #F5A9B8;
background-position: center center; background-position: center center;
} }
@ -2908,7 +2904,7 @@ Footer CSS
} }
#footer-menu li a:hover { #footer-menu li a:hover {
color: #dd3333; color: #F5A9B8;
} }
#bottom-footer { #bottom-footer {
@ -2933,7 +2929,7 @@ Footer CSS
} }
#top-footer a:hover { #top-footer a:hover {
color: #dd3333; color: #F5A9B8;
} }
#top-footer .posted-on a::before { #top-footer .posted-on a::before {
@ -3009,7 +3005,7 @@ sophia-after-dark Widget CSS
} }
.mt-latest-posts-wrapper .mt-post-title a:hover { .mt-latest-posts-wrapper .mt-post-title a:hover {
color: #dd3333; color: #F5A9B8;
} }
.mt-latest-posts-wrapper .entry-cat { .mt-latest-posts-wrapper .entry-cat {
@ -3044,9 +3040,9 @@ sophia-after-dark Widget CSS
} }
.sophia-after-dark_social_media a:hover { .sophia-after-dark_social_media a:hover {
background: #dd3333; background: #F5A9B8;
color: #ffffff !important; color: #ffffff !important;
border-color: #dd3333; border-color: #F5A9B8;
} }
.mt-single-related-posts { .mt-single-related-posts {
@ -3110,7 +3106,7 @@ Scroll To Top styles
} }
#mt-scrollup:hover { #mt-scrollup:hover {
color: #dd3333; color: #F5A9B8;
} }
.single article .post-thumbnail:hover img { .single article .post-thumbnail:hover img {

View File

@ -14,30 +14,32 @@ $author_url = get_the_author_meta( 'user_url' );
?> ?>
<div class="mt-author-box"> <div class="mt-author-box">
<?php if ( $author_avatar ) { ?> <?php if ( $author_avatar ) : ?>
<div itemprop="image" class="mt-author__avatar"> <div itemprop="image" class="mt-author__avatar">
<?php echo wp_kses_post( $author_avatar ); ?> <?php echo wp_kses_post( $author_avatar ); ?>
</div> </div>
<?php } ?> <?php endif; ?>
<div class="mt-author-info"> <div class="mt-author-info">
<?php if ( $author_post_link ) { ?> <?php if ( $author_post_link ) : ?>
<h5 itemprop="name" class="mt-author-name"><?php echo wp_kses_post( $author_post_link ); ?></h5> <h5 itemprop="name" class="mt-author-name"><?php echo wp_kses_post( $author_post_link ); ?></h5>
<?php } ?> <?php endif; ?>
<?php if ( $author_bio ) { ?> <?php if ( $author_bio ) : ?>
<div class="mt-author-bio"> <div class="mt-author-bio">
<?php echo wp_kses_post( $author_bio ); ?> <?php echo wp_kses_post( $author_bio ); ?>
</div> </div>
<?php } ?> <?php endif; ?>
<?php if ( $author_url ) : ?>
<div class="mt-author-meta"> <div class="mt-author-meta">
<?php if ( $author_url ) { ?>
<div class="mt-author-website"> <div class="mt-author-website">
<span><?php esc_html_e( 'Website', 'sophia-after-dark' ); ?>&#58;</span> <span><?php esc_html_e( 'Website', 'sophia-after-dark' ); ?>:</span>
<a href="<?php echo esc_url( $author_url ); ?>" target="_blank"><?php echo esc_url( $author_url ); ?></a> <a href="<?php echo esc_url( $author_url ); ?>" target="_blank" rel="noopener noreferrer">
<?php echo esc_url( $author_url ); ?>
</a>
</div> </div>
<?php } ?>
</div> </div>
<?php endif; ?>
</div> </div>
</div> </div>

View File

@ -8,55 +8,55 @@
* @since 1.0.0 * @since 1.0.0
*/ */
$post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' ); $post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' );
if ( has_post_thumbnail() ) { $post_class = has_post_thumbnail() ? 'has-thumbnail wow fadeInUp' : 'no-thumbnail wow fadeInUp';
$post_class = 'has-thumbnail wow fadeInUp';
} else {
$post_class = 'no-thumbnail wow fadeInUp';
}
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
<div class="thumb-cat-wrap">
<?php <?php
echo '<div class="thumb-cat-wrap">';
sophia_after_dark_post_thumbnail(); sophia_after_dark_post_thumbnail();
sophia_after_dark_article_categories_list(); sophia_after_dark_article_categories_list();
echo '</div>';
if ( 'post' === get_post_type() ) {
?> ?>
</div>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-cat"> <div class="entry-cat">
<?php <?php
sophia_after_dark_posted_on(); sophia_after_dark_posted_on();
sophia_after_dark_posted_by(); sophia_after_dark_posted_by();
?> ?>
</div> </div>
<?php } ?> <?php endif; ?>
<header class="entry-header"> <header class="entry-header">
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?> <?php the_title(
sprintf(
'<h2 class="entry-title"><a href="%s" rel="bookmark">',
esc_url( get_permalink() )
),
'</a></h2>'
); ?>
</header> </header>
<div class="entry-content"> <div class="entry-content">
<?php if ( 'excerpt' === $post_content_type ) : ?>
<?php the_excerpt(); ?>
<?php elseif ( 'content' === $post_content_type ) : ?>
<?php <?php
if ( 'excerpt' === $post_content_type ) {
the_excerpt();
} elseif ( 'content' === $post_content_type ) {
the_content( sprintf( the_content( sprintf(
wp_kses( wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ), __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
array( [ 'span' => [ 'class' => [] ] ]
'span' => array(
'class' => array(),
),
)
), ),
get_the_title() get_the_title()
) ); ) );
}
?> ?>
<?php endif; ?>
</div> </div>
<footer class="entry-footer"> <footer class="entry-footer">
<?php sophia_after_dark_entry_footer(); ?> <?php sophia_after_dark_entry_footer(); ?>
</footer> </footer>
</article> </article>

View File

@ -8,20 +8,14 @@
* @since 1.0.0 * @since 1.0.0
*/ */
if ( has_post_thumbnail() ) { $post_class = has_post_thumbnail() ? 'has-thumbnail' : 'no-thumbnail';
$post_class = 'has-thumbnail';
} else {
$post_class = 'no-thumbnail';
}
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
<?php if ( has_post_thumbnail() ) : ?>
<div class="post-thumbnail"> <div class="post-thumbnail">
<?php <?php the_post_thumbnail( 'full' ); ?>
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'full' );
}
?>
<div class="post-info-wrap"> <div class="post-info-wrap">
<div class="post-cat"><?php sophia_after_dark_article_categories_list(); ?></div> <div class="post-cat"><?php sophia_after_dark_article_categories_list(); ?></div>
<div class="entry-meta"> <div class="entry-meta">
@ -33,30 +27,29 @@ if ( has_post_thumbnail() ) {
<?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); ?> <?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); ?>
</div> </div>
</div> </div>
<?php endif; ?>
<div class="entry-content"> <div class="entry-content">
<?php <?php
the_content( sprintf( the_content( sprintf(
wp_kses( wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ), __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
array( [ 'span' => [ 'class' => [] ] ]
'span' => array(
'class' => array(),
),
)
), ),
get_the_title() get_the_title()
) ); ) );
wp_link_pages( array(
wp_link_pages( [
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'sophia-after-dark' ), 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'sophia-after-dark' ),
'after' => '</div>', 'after' => '</div>',
) ); ] );
?> ?>
</div> </div>
<footer class="entry-footer"> <footer class="entry-footer">
<?php sophia_after_dark_entry_footer(); ?> <?php sophia_after_dark_entry_footer(); ?>
</footer> </footer>
<?php get_template_part( 'template-parts/author/post', 'author-box' ); ?> <?php get_template_part( 'template-parts/author/post', 'author-box' ); ?>
</article> </article>

View File

@ -13,32 +13,29 @@ $current_post = $wp_query->current_post;
$archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--masonry-style' ); $archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--masonry-style' );
$post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' ); $post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' );
if ( has_post_thumbnail() ) { // Determine post class
$post_class = 'has-thumbnail'; $post_class = has_post_thumbnail() ? 'has-thumbnail' : 'no-thumbnail';
} else { if ( $current_post >= 3 || 'mt-archive--masonry-style' !== $archive_style ) {
$post_class = 'no-thumbnail';
}
if ( $current_post < 3 && 'mt-archive--masonry-style' === $archive_style ) {
$post_class .= '';
} else {
$post_class .= ' wow fadeInUp'; $post_class .= ' wow fadeInUp';
} }
?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
<div class="thumb-cat-wrap">
<?php <?php
echo '<div class="thumb-cat-wrap">';
sophia_after_dark_post_thumbnail(); sophia_after_dark_post_thumbnail();
sophia_after_dark_article_categories_list(); sophia_after_dark_article_categories_list();
echo '</div>';
if ( 'post' === get_post_type() ) {
?> ?>
</div>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-cat"> <div class="entry-cat">
<?php <?php
sophia_after_dark_posted_on(); sophia_after_dark_posted_on();
sophia_after_dark_posted_by(); sophia_after_dark_posted_by();
?> ?>
</div> </div>
<?php } ?> <?php endif; ?>
<header class="entry-header"> <header class="entry-header">
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?> <?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
@ -51,13 +48,8 @@ if ( $current_post < 3 && 'mt-archive--masonry-style' === $archive_style ) {
} elseif ( 'content' === $post_content_type ) { } elseif ( 'content' === $post_content_type ) {
the_content( sprintf( the_content( sprintf(
wp_kses( wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ), __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
array( [ 'span' => [ 'class' => [] ] ]
'span' => array(
'class' => array(),
),
)
), ),
get_the_title() get_the_title()
) ); ) );

View File

@ -6,39 +6,31 @@
* @since 1.0.0 * @since 1.0.0
*/ */
if (has_post_thumbnail()) { $post_class = has_post_thumbnail() ? "has-thumbnail wow fadeInUp" : "no-thumbnail wow fadeInUp";
$post_class = "has-thumbnail wow fadeInUp"; ?>
} else {
$post_class = "no-thumbnail wow fadeInUp";
} ?>
<article id="post-<?php the_ID(); ?>" <?php post_class($post_class); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
<?php <div class="thumb-cat-wrap">
echo '<div class="thumb-cat-wrap">'; <?php if ( has_post_thumbnail() ) : ?>
if (has_post_thumbnail()) { <a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
echo '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">'; <?php sophia_after_dark_post_thumbnail(); ?>
sophia_after_dark_post_thumbnail(); </a>
echo "</a>"; <?php endif; ?>
}
sophia_after_dark_article_categories_list(); <?php sophia_after_dark_article_categories_list(); ?>
echo "</div>"; </div>
if ("post" === get_post_type()) { ?>
<?php if ( "post" === get_post_type() ) : ?>
<div class="entry-cat"> <div class="entry-cat">
<?php <?php
sophia_after_dark_posted_on(); sophia_after_dark_posted_on();
sophia_after_dark_posted_by(); sophia_after_dark_posted_by();
?> ?>
</div> </div>
<?php } <?php endif; ?>
?>
<header class="entry-header"> <header class="entry-header">
<?php the_title( <?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
'<h2 class="entry-title"><a href="' .
esc_url(get_permalink()) .
'" rel="bookmark">',
"</a></h2>"
); ?>
</header> </header>
<footer class="entry-footer"> <footer class="entry-footer">

View File

@ -6,39 +6,36 @@
* @since 1.0.0 * @since 1.0.0
*/ */
global $post; global $post;
$related_post_id = get_the_id(); $related_post_id = get_the_ID();
$get_categories = get_the_terms( $related_post_id, 'category' ); $get_categories = get_the_terms( $related_post_id, 'category' );
$selected_cat = array(); $selected_cat = ! empty( $get_categories ) && is_array( $get_categories ) ? wp_list_pluck( $get_categories, 'term_id' ) : [];
// Get only category slug of current post.
if ( $get_categories && is_array( $get_categories ) ) {
foreach ( $get_categories as $category ) {
$selected_cat[] = $category->term_id;
}
}
$related_posts_count = apply_filters( 'sophia_after_dark_related_posts_count', 3 ); $related_posts_count = apply_filters( 'sophia_after_dark_related_posts_count', 3 );
$related_posts_title = apply_filters( 'sophia_after_dark_related_posts_section_title', __( 'Related Posts', 'sophia-after-dark' ) ); $related_posts_title = apply_filters( 'sophia_after_dark_related_posts_section_title', __( 'Related Posts', 'sophia-after-dark' ) );
$related_posts_args = array( $related_posts_args = [
'posts_per_page' => absint( $related_posts_count ), 'posts_per_page' => absint( $related_posts_count ),
'post__not_in' => array( $related_post_id ), 'post__not_in' => [ $related_post_id ],
'category__in' => $selected_cat, 'category__in' => $selected_cat,
); ];
$related_posts_query = new WP_Query( $related_posts_args ); $related_posts_query = new WP_Query( $related_posts_args );
if ( $related_posts_query->have_posts() ) {
if ( $related_posts_query->have_posts() ) :
?> ?>
<section class="mt-single-related-posts"> <section class="mt-single-related-posts">
<h2 class="mt-related-post-title"><?php echo esc_html( $related_posts_title ); ?></h2> <h2 class="mt-related-post-title"><?php echo esc_html( $related_posts_title ); ?></h2>
<div class="mt-related-posts-wrapper"> <div class="mt-related-posts-wrapper">
<?php <?php
while ( $related_posts_query->have_posts() ) { while ( $related_posts_query->have_posts() ) :
$related_posts_query->the_post(); $related_posts_query->the_post();
get_template_part( 'template-parts/related/content', 'related' ); get_template_part( 'template-parts/related/content', 'related' );
} endwhile;
?> ?>
</div> </div>
</section> </section>
<?php <?php
} endif;
wp_reset_postdata(); wp_reset_postdata();