first commit without licensingg
This commit is contained in:
69
inc/actions.php
Normal file
69
inc/actions.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* All core theme actions.
|
||||
*
|
||||
* Please do not modify this file directly.
|
||||
* You may remove actions in your child theme by using remove_action().
|
||||
*
|
||||
* Please see /inc/partials.php for the list of partials,
|
||||
* added to actions.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Body
|
||||
*/
|
||||
|
||||
add_action( 'csco_site_before', 'csco_offcanvas' );
|
||||
add_action( 'csco_main_content_before', 'csco_theme_breadcrumbs', 100 );
|
||||
|
||||
/**
|
||||
* Main
|
||||
*/
|
||||
add_action( 'csco_main_content_before', 'csco_page_header', 100 );
|
||||
|
||||
/**
|
||||
* Singular
|
||||
*/
|
||||
add_action( 'csco_entry_content_before', 'csco_singular_post_type_before', 10 );
|
||||
add_action( 'csco_entry_content_after', 'csco_singular_post_type_after', 999 );
|
||||
|
||||
|
||||
/**
|
||||
* Home Hero
|
||||
*/
|
||||
add_action( 'csco_main_content_before', 'csco_home_hero_standard', 110 );
|
||||
add_action( 'csco_site_content_before', 'csco_home_hero_fullwidth', 10 );
|
||||
|
||||
/**
|
||||
* Entry Header
|
||||
*/
|
||||
add_action( 'csco_main_content_before', 'csco_entry_header', 110 );
|
||||
|
||||
/**
|
||||
* Entry Sections
|
||||
*/
|
||||
add_action( 'csco_entry_content_after', 'csco_page_pagination', 10 );
|
||||
add_action( 'csco_entry_content_after', 'csco_entry_tags', 20 );
|
||||
add_action( 'csco_entry_content_after', 'csco_entry_footer', 30 );
|
||||
add_action( 'csco_entry_content_after', 'csco_entry_prev_next', 40 );
|
||||
add_action( 'csco_entry_content_after', 'csco_entry_comments', 50 );
|
||||
add_action( 'csco_footer_before', 'csco_entry_read_next', 20 );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Entry Elements
|
||||
*/
|
||||
add_action( 'csco_entry_container_start', 'csco_entry_metabar', 10 );
|
||||
|
||||
/**
|
||||
* Home Post Categories
|
||||
*/
|
||||
add_action( 'csco_main_content_before', 'csco_post_categories', 120 );
|
||||
|
||||
/**
|
||||
* Subscribe
|
||||
*/
|
||||
add_action( 'csco_footer_before', 'csco_misc_subscribe', 30 );
|
||||
81
inc/assets.php
Normal file
81
inc/assets.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Assets
|
||||
*
|
||||
* All enqueues of scripts and styles.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_content_width' ) ) {
|
||||
/**
|
||||
* Set the content width in pixels, based on the theme's design and stylesheet.
|
||||
*
|
||||
* Priority 0 to make it available to lower priority callbacks.
|
||||
*
|
||||
* @global int $content_width
|
||||
*/
|
||||
function csco_content_width() {
|
||||
/**
|
||||
* The csco_content_width hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$GLOBALS['content_width'] = apply_filters( 'csco_content_width', 1200 );
|
||||
}
|
||||
}
|
||||
add_action( 'after_setup_theme', 'csco_content_width', 0 );
|
||||
|
||||
if ( ! function_exists( 'csco_enqueue_scripts' ) ) {
|
||||
/**
|
||||
* Enqueue scripts and styles.
|
||||
*/
|
||||
function csco_enqueue_scripts() {
|
||||
|
||||
$version = csco_get_theme_data( 'Version' );
|
||||
|
||||
// Register theme scripts.
|
||||
wp_register_script( 'csco-scripts', get_template_directory_uri() . '/assets/js/scripts.js', array(), $version, true );
|
||||
|
||||
// Localize the main theme scripts.
|
||||
wp_localize_script( 'csco-scripts', 'csLocalize', array(
|
||||
'siteSchemeMode' => get_theme_mod( 'color_scheme', 'system' ),
|
||||
'siteSchemeToogle' => get_theme_mod( 'color_scheme_toggle', true ),
|
||||
'subscribeProcess' => esc_html__('Processing your subscription...', 'revision'),
|
||||
'subscribeSuccess' => esc_html__('Thank you for subscribing!', 'revision'),
|
||||
'subscribeError' => esc_html__('Form submission error', 'revision'),
|
||||
) );
|
||||
|
||||
// Enqueue theme scripts.
|
||||
wp_enqueue_script( 'csco-scripts' );
|
||||
|
||||
// Enqueue comment reply script.
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
|
||||
wp_register_script( 'csco-comment-reply', get_template_directory_uri() . '/assets/static/js/comment-reply.js', array(), $version, true );
|
||||
wp_enqueue_script( 'csco-comment-reply' );
|
||||
}
|
||||
|
||||
wp_deregister_style( 'swiper' );
|
||||
wp_dequeue_style( 'swiper' );
|
||||
|
||||
wp_dequeue_script( sprintf( '%s-reply', 'comment' ) );
|
||||
|
||||
// Register theme styles.
|
||||
wp_register_style( 'csco-styles', csco_style( get_template_directory_uri() . '/style.css' ), array(), $version );
|
||||
|
||||
// Enqueue theme styles.
|
||||
wp_enqueue_style( 'csco-styles' );
|
||||
|
||||
// Enqueue typography styles.
|
||||
csco_enqueue_typography_styles( 'csco-styles' );
|
||||
|
||||
// Add RTL support.
|
||||
wp_style_add_data( 'csco-styles', 'rtl', 'replace' );
|
||||
|
||||
// Dequeue Contact Form 7 styles.
|
||||
wp_dequeue_style( 'contact-form-7' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'csco_enqueue_scripts', 99 );
|
||||
313
inc/categories.php
Normal file
313
inc/categories.php
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
/**
|
||||
* ==================================
|
||||
* Category Options
|
||||
*
|
||||
* @package Revision
|
||||
* ==================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add fields to Category
|
||||
*
|
||||
* @param string $taxonomy The taxonomy slug.
|
||||
*/
|
||||
function csco_mb_category_options_add( $taxonomy ) {
|
||||
wp_nonce_field( 'category_options', 'csco_mb_category_options' );
|
||||
?>
|
||||
<div class="form-field">
|
||||
<label><?php esc_html_e( 'Category Logo', 'revision' ); ?></label>
|
||||
<div class="category-upload-image upload-img-container" data-frame-title="<?php esc_attr_e( 'Select or upload image', 'revision' ); ?>" data-frame-btn-text="<?php esc_attr_e( 'Set image', 'revision' ); ?>">
|
||||
<p class="icon-description">
|
||||
<?php esc_html_e( 'The category logo is displayed in its original dimensions on your website. Please upload the 2x version of your icon via the Media Library with @2x suffix for Retina display support. For example, logo@2x.png. Recommended maximum size is 100px (200px for Retina version).', 'revision' ); ?>
|
||||
</p>
|
||||
<p class="uploaded-img-box">
|
||||
<span class="uploaded-image"></span>
|
||||
<input id="csco_category_logo" class="uploaded-img-id" name="csco_category_logo" type="hidden"/>
|
||||
</p>
|
||||
<p class="hide-if-no-js">
|
||||
<a class="upload-img-link button button-primary" href="#"><?php esc_html_e( 'Upload image', 'revision' ); ?></a>
|
||||
<a class="delete-img-link button button-secondary hidden" href="#"><?php esc_html_e( 'Remove image', 'revision' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div><br>
|
||||
<hr>
|
||||
<div class="form-field">
|
||||
<label><?php esc_html_e( 'Icon', 'revision' ); ?></label>
|
||||
<div class="category-icon-image upload-img-container" data-frame-title="<?php esc_attr_e( 'Select or upload image', 'revision' ); ?>" data-frame-btn-text="<?php esc_attr_e( 'Set image', 'revision' ); ?>">
|
||||
<p class="icon-description">
|
||||
<?php esc_html_e( 'The category icon is displayed in its original dimensions on your website. Please upload the 2x version of your icon via the Media Library with @2x suffix for Retina display support. For example, icon@2x.png. Recommended maximum size is 24px (48px for Retina version).', 'revision' ); ?>
|
||||
</p>
|
||||
<p class="uploaded-img-box">
|
||||
<span class="uploaded-image"></span>
|
||||
<input id="csco_category_icon" class="uploaded-img-id" name="csco_category_icon" type="hidden"/>
|
||||
</p>
|
||||
<p class="hide-if-no-js">
|
||||
<a class="upload-img-link button button-primary" href="#"><?php esc_html_e( 'Upload image', 'revision' ); ?></a>
|
||||
<a class="delete-img-link button button-secondary hidden" href="#"><?php esc_html_e( 'Remove image', 'revision' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div><br><br>
|
||||
<?php
|
||||
}
|
||||
add_action( 'category_add_form_fields', 'csco_mb_category_options_add', 10 );
|
||||
|
||||
/**
|
||||
* Edit fields from Category
|
||||
*
|
||||
* @param object $term Current taxonomy term object.
|
||||
* @param string $taxonomy Current taxonomy slug.
|
||||
*/
|
||||
function csco_mb_category_options_edit( $term, $taxonomy ) {
|
||||
wp_nonce_field( 'category_options', 'csco_mb_category_options' );
|
||||
|
||||
$csco_category_logo = get_term_meta( $term->term_id, 'csco_category_logo', true );
|
||||
$csco_category_logo_url = wp_get_attachment_image_url( $csco_category_logo, 'thumbnail' );
|
||||
|
||||
$csco_category_icon = get_term_meta( $term->term_id, 'csco_category_icon', true );
|
||||
$csco_category_icon_url = wp_get_attachment_image_url( $csco_category_icon, 'thumbnail' );
|
||||
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top"><label for="csco_category_logo"><?php esc_html_e( 'Category Logo', 'revision' ); ?></label></th>
|
||||
<td>
|
||||
<div class="category-upload-image upload-img-container" data-frame-title="<?php esc_attr_e( 'Select or upload image', 'revision' ); ?>" data-frame-btn-text="<?php esc_attr_e( 'Set image', 'revision' ); ?>">
|
||||
<p class="icon-description">
|
||||
<?php esc_html_e( 'The category logo is displayed in its original dimensions on your website. Please upload the 2x version of your icon via the Media Library with @2x suffix for Retina display support. For example, logo@2x.png. Recommended maximum size is 100px (200px for Retina version).', 'revision' ); ?>
|
||||
</p>
|
||||
<p class="uploaded-img-box">
|
||||
<span class="uploaded-image">
|
||||
<?php if ( $csco_category_logo_url ) { ?>
|
||||
<img src="<?php echo esc_url( $csco_category_logo_url ); ?>" style="max-width:100%;" />
|
||||
<?php } ?>
|
||||
</span>
|
||||
<input id="csco_category_logo" class="uploaded-img-id" name="csco_category_logo" type="hidden" value="<?php echo esc_attr( $csco_category_logo ); ?>" />
|
||||
</p>
|
||||
<p class="hide-if-no-js">
|
||||
<a class="upload-img-link button button-primary <?php echo esc_attr( $csco_category_logo_url ? 'hidden' : '' ); ?>" href="#"><?php esc_html_e( 'Upload image', 'revision' ); ?></a>
|
||||
<a class="delete-img-link button button-secondary <?php echo esc_attr( ! $csco_category_logo_url ? 'hidden' : '' ); ?>" href="#"><?php esc_html_e( 'Remove image', 'revision' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top"><label for="csco_category_icon"><?php esc_html_e( 'Category Icon', 'revision' ); ?></label></th>
|
||||
<td>
|
||||
<div class="category-icon-image upload-img-container" data-frame-title="<?php esc_attr_e( 'Select or upload image', 'revision' ); ?>" data-frame-btn-text="<?php esc_attr_e( 'Set image', 'revision' ); ?>">
|
||||
<p class="icon-description">
|
||||
<?php esc_html_e( 'The category icon is displayed in its original dimensions on your website. Please upload the 2x version of your icon via the Media Library with @2x suffix for Retina display support. For example, icon@2x.png. Recommended maximum size is 24px (48px for Retina version).', 'revision' ); ?>
|
||||
</p>
|
||||
<p class="uploaded-img-box">
|
||||
<span class="uploaded-image">
|
||||
<?php if ( $csco_category_icon_url ) { ?>
|
||||
<img src="<?php echo esc_url( $csco_category_icon_url ); ?>" style="max-width:100%;" />
|
||||
<?php } ?>
|
||||
</span>
|
||||
<input id="csco_category_icon" class="uploaded-img-id" name="csco_category_icon" type="hidden" value="<?php echo esc_attr( $csco_category_icon ); ?>" />
|
||||
</p>
|
||||
<p class="hide-if-no-js">
|
||||
<a class="upload-img-link button button-primary <?php echo esc_attr( $csco_category_icon_url ? 'hidden' : '' ); ?>" href="#"><?php esc_html_e( 'Upload image', 'revision' ); ?></a>
|
||||
<a class="delete-img-link button button-secondary <?php echo esc_attr( ! $csco_category_icon_url ? 'hidden' : '' ); ?>" href="#"><?php esc_html_e( 'Remove image', 'revision' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
add_action( 'category_edit_form_fields', 'csco_mb_category_options_edit', 10, 2 );
|
||||
|
||||
/**
|
||||
* Save meta box
|
||||
*
|
||||
* @param int $term_id ID of the term about to be edited.
|
||||
* @param string $taxonomy Taxonomy slug of the related term.
|
||||
*/
|
||||
function csco_mb_category_options_save( $term_id, $taxonomy ) {
|
||||
|
||||
// Bail if we're doing an auto save.
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if our nonce isn't there, or we can't verify it, bail.
|
||||
if ( ! isset( $_POST['csco_mb_category_options'] ) || ! wp_verify_nonce( $_POST['csco_mb_category_options'], 'category_options' ) ) { // Input var ok; sanitization ok.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $_POST['csco_category_logo'] ) ) { // Input var ok; sanitization ok.
|
||||
$csco_category_logo = sanitize_text_field( $_POST['csco_category_logo'] ); // Input var ok; sanitization ok.
|
||||
update_term_meta( $term_id, 'csco_category_logo', $csco_category_logo );
|
||||
update_term_meta( $term_id, '_csco_category_logo', wp_get_attachment_image_url( $csco_category_logo, 'full' ) );
|
||||
}
|
||||
|
||||
if ( isset( $_POST['csco_category_icon'] ) ) { // Input var ok; sanitization ok.
|
||||
$csco_category_icon = sanitize_text_field( $_POST['csco_category_icon'] ); // Input var ok; sanitization ok.
|
||||
update_term_meta( $term_id, 'csco_category_icon', $csco_category_icon );
|
||||
update_term_meta( $term_id, '_csco_category_icon', wp_get_attachment_image_url( $csco_category_icon, 'full' ) );
|
||||
}
|
||||
}
|
||||
add_action( 'created_category', 'csco_mb_category_options_save', 10, 2 );
|
||||
add_action( 'edited_category', 'csco_mb_category_options_save', 10, 2 );
|
||||
|
||||
/**
|
||||
* Meta box Enqunue Scripts
|
||||
*
|
||||
* @param string $page Current page.
|
||||
*/
|
||||
function csco_mb_category_enqueue_scripts( $page ) {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( null !== $screen && 'edit-category' !== $screen->id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<?php
|
||||
wp_enqueue_script( 'jquery' );
|
||||
|
||||
// Init Media Control.
|
||||
wp_enqueue_media();
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
jQuery( document ).ready(function( $ ) {
|
||||
|
||||
var powerkitMediaFrame;
|
||||
/* Set all variables to be used in scope */
|
||||
var metaBox = '.category-upload-image, .category-icon-image';
|
||||
|
||||
/* Add Image Link */
|
||||
$( metaBox ).find( '.upload-img-link' ).on( 'click', function( event ){
|
||||
event.preventDefault();
|
||||
|
||||
var parentContainer = $( this ).parents( metaBox );
|
||||
|
||||
// Options.
|
||||
var options = {
|
||||
title: parentContainer.data( 'frame-title' ) ? parentContainer.data( 'frame-title' ) : 'Select or Upload Media',
|
||||
button: {
|
||||
text: parentContainer.data( 'frame-btn-text' ) ? parentContainer.data( 'frame-btn-text' ) : 'Use this media',
|
||||
},
|
||||
library : { type : 'image' },
|
||||
multiple: false // Set to true to allow multiple files to be selected.
|
||||
};
|
||||
|
||||
// Create a new media frame
|
||||
powerkitMediaFrame = wp.media( options );
|
||||
|
||||
// When an image is selected in the media frame...
|
||||
powerkitMediaFrame.on( 'select', function() {
|
||||
|
||||
// Get media attachment details from the frame state.
|
||||
var attachment = powerkitMediaFrame.state().get('selection').first().toJSON();
|
||||
|
||||
// Send the attachment URL to our custom image input field.
|
||||
parentContainer.find( '.uploaded-image' ).html( '<img src="' + attachment.url + '" style="max-width:25%;"/>' );
|
||||
parentContainer.find( '.uploaded-img-id' ).val( attachment.id ).change();
|
||||
parentContainer.find( '.upload-img-link' ).addClass( 'hidden' );
|
||||
parentContainer.find( '.delete-img-link' ).removeClass( 'hidden' );
|
||||
|
||||
powerkitMediaFrame.close();
|
||||
});
|
||||
|
||||
// Finally, open the modal on click.
|
||||
powerkitMediaFrame.open();
|
||||
});
|
||||
|
||||
|
||||
/* Delete Image Link */
|
||||
$( metaBox ).find( '.delete-img-link' ).on( 'click', function( event ){
|
||||
event.preventDefault();
|
||||
|
||||
$( this ).parents( metaBox ).find( '.uploaded-image' ).html( '' );
|
||||
$( this ).parents( metaBox ).find( '.upload-img-link' ).removeClass( 'hidden' );
|
||||
$( this ).parents( metaBox ).find( '.delete-img-link' ).addClass( 'hidden' );
|
||||
$( this ).parents( metaBox ).find( '.uploaded-img-id' ).val( '' ).change();
|
||||
});
|
||||
});
|
||||
|
||||
jQuery( document ).ajaxSuccess(function(e, request, settings){
|
||||
let action = settings.data.indexOf( 'action=add-tag' );
|
||||
let screen = settings.data.indexOf( 'screen=edit-category' );
|
||||
let taxonomy = settings.data.indexOf( 'taxonomy=category' );
|
||||
|
||||
if( action > -1 && screen > -1 && taxonomy > -1 ){
|
||||
jQuery( '.delete-img-link' ).click();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
wp_add_inline_script( 'jquery', str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) );
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'csco_mb_category_enqueue_scripts' );
|
||||
|
||||
|
||||
if ( ! function_exists( 'csco_post_categories' ) ) {
|
||||
/**
|
||||
* Categories list with icon.
|
||||
*/
|
||||
function csco_post_categories() {
|
||||
|
||||
$home_show_categories = get_theme_mod( 'home_show_categories', false );
|
||||
$home_categories_heading = get_theme_mod( 'home_categories_heading', esc_html__( 'Explore Trending Topics', 'revision' ) );
|
||||
$home_categories_filter = get_theme_mod( 'home_categories_filter' );
|
||||
$home_categories_limit = get_theme_mod( 'home_categories_limit', 8 );
|
||||
$home_categories = ! empty( $home_categories_filter ) ? explode( ',', $home_categories_filter ) : array();
|
||||
|
||||
$args = array(
|
||||
'taxonomy' => 'category',
|
||||
'orderby' => 'count',
|
||||
'order' => 'DESC',
|
||||
'number' => $home_categories_limit,
|
||||
);
|
||||
|
||||
if ( ! empty( $home_categories ) ) {
|
||||
$args['slug'] = $home_categories;
|
||||
$args['orderby'] = 'slug__in';
|
||||
$args['order'] = 'ASC';
|
||||
$args['number'] = 0;
|
||||
}
|
||||
|
||||
$categories = get_categories( $args );
|
||||
|
||||
if ( $home_show_categories && ! empty( $categories ) && is_home() ) {
|
||||
?>
|
||||
<div class="cs-categories-list cs-categories-list-container">
|
||||
<?php if ( $home_categories_heading ) { ?>
|
||||
<h2 class="cs-categories-list__heading"><?php echo esc_html( $home_categories_heading ); ?></h2>
|
||||
<?php } ?>
|
||||
<div class="cs-categories-list__wrapper">
|
||||
<?php
|
||||
foreach ( $categories as $category ) {
|
||||
$csco_category_icon_id = get_term_meta( $category->term_id, 'csco_category_icon', true );
|
||||
?>
|
||||
<div class="cs-category-item">
|
||||
<?php if ( $csco_category_icon_id ) { ?>
|
||||
<div class="cs-category-item__icon-box">
|
||||
<div class="cs-category-item__icon">
|
||||
<?php
|
||||
csco_get_retina_image(
|
||||
$csco_category_icon_id,
|
||||
array(
|
||||
'alt' => esc_attr( $category->name ),
|
||||
'title' => esc_attr( $category->name ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="cs-category-item__title"><a href="<?php echo esc_url( get_term_link( $category->term_id ) ); ?>"><?php echo esc_html( $category->name ); ?></a></div>
|
||||
<a href="<?php echo esc_url( get_term_link( $category->term_id ) ); ?>" class="cs-category-item__link" title="<?php echo esc_attr( $category->name ); ?>"></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
250
inc/custom-content.php
Normal file
250
inc/custom-content.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* Additional Content.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define array of Additional Content Locations
|
||||
*/
|
||||
function csco_get_custom_content_locations() {
|
||||
$content = array(
|
||||
array(
|
||||
'slug' => 'header',
|
||||
'name' => esc_html__( 'Header', 'revision' ),
|
||||
'template' => array( 'home', 'front_page', 'single', 'page', 'archive' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'hero',
|
||||
'name' => esc_html__( 'Hero', 'revision' ),
|
||||
'template' => array( 'home' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'site_content',
|
||||
'name' => esc_html__( 'Site Content', 'revision' ),
|
||||
'template' => array( 'home', 'front_page', 'single', 'page', 'archive' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'main',
|
||||
'name' => esc_html__( 'Main', 'revision' ),
|
||||
'template' => array( 'home', 'front_page', 'single', 'page', 'archive' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'post',
|
||||
'name' => esc_html__( 'Post', 'revision' ),
|
||||
'template' => array( 'single' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'post_content',
|
||||
'name' => esc_html__( 'Post Content', 'revision' ),
|
||||
'template' => array( 'single' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'page',
|
||||
'name' => esc_html__( 'Page', 'revision' ),
|
||||
'template' => array( 'page' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'page_content',
|
||||
'name' => esc_html__( 'Page Content', 'revision' ),
|
||||
'template' => array( 'page' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'author',
|
||||
'name' => esc_html__( 'Post Author', 'revision' ),
|
||||
'template' => array( 'single' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'pagination',
|
||||
'name' => esc_html__( 'Post Pagination', 'revision' ),
|
||||
'template' => array( 'single' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'comments',
|
||||
'name' => esc_html__( 'Comments', 'revision' ),
|
||||
'template' => array( 'single', 'page' ),
|
||||
),
|
||||
array(
|
||||
'slug' => 'footer',
|
||||
'name' => esc_html__( 'Footer', 'revision' ),
|
||||
'template' => array( 'home', 'front_page', 'single', 'page', 'archive' ),
|
||||
),
|
||||
);
|
||||
return apply_filters( 'csco_custom_content_locations', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Define array of Additional Content Pages
|
||||
*/
|
||||
function csco_get_custom_content_pages() {
|
||||
$pages = array(
|
||||
'home' => esc_html__( 'Homepage', 'revision' ),
|
||||
'front_page' => esc_html__( 'Front Page', 'revision' ),
|
||||
'single' => esc_html__( 'Post', 'revision' ),
|
||||
'page' => esc_html__( 'Page', 'revision' ),
|
||||
'archive' => esc_html__( 'Archive', 'revision' ),
|
||||
);
|
||||
return $pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Additional Content
|
||||
*/
|
||||
function csco_init_custom_content() {
|
||||
|
||||
$locations = csco_get_custom_content_locations();
|
||||
$pages = csco_get_custom_content_pages();
|
||||
|
||||
/**
|
||||
* Customizer Settings
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_panel(
|
||||
'custom_content',
|
||||
array(
|
||||
'title' => esc_html__( 'Additional Content', 'revision' ),
|
||||
'priority' => 200,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'custom_content_general',
|
||||
array(
|
||||
'title' => esc_html__( 'General', 'revision' ),
|
||||
'panel' => 'custom_content',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'custom_content_adsense',
|
||||
'label' => esc_html__( 'Load Google AdSense scripts', 'revision' ),
|
||||
'description' => esc_html__( 'Enable this if you\'re using Google AdSense.', 'revision' ),
|
||||
'section' => 'custom_content_general',
|
||||
'default' => false,
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $pages as $page_slug => $page_name ) {
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'custom_content_' . $page_slug,
|
||||
array(
|
||||
'title' => $page_name,
|
||||
'panel' => 'custom_content',
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $locations as $location ) {
|
||||
|
||||
// Check if ads location is supported by the current page template.
|
||||
if ( in_array( $page_slug, $location['template'], true ) ) {
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'settings' => 'custom_content_' . $page_slug . '_' . $location['slug'] . '_before',
|
||||
'label' => esc_html__( 'Before', 'revision' ) . ' ' . $location['name'],
|
||||
'section' => 'custom_content_' . $page_slug,
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'csco_unsanitize',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'settings' => 'custom_content_' . $page_slug . '_' . $location['slug'] . '_after',
|
||||
'label' => esc_html__( 'After', 'revision' ) . ' ' . $location['name'],
|
||||
'section' => 'custom_content_' . $page_slug,
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'csco_unsanitize',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes Sanitizing
|
||||
*
|
||||
* @param string $content Initial content.
|
||||
*/
|
||||
function csco_unsanitize( $content ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Google AdSense scripts
|
||||
*/
|
||||
function csco_custom_content_enqueue_scripts() {
|
||||
|
||||
if ( get_theme_mod( 'custom_content_adsense', false ) ) {
|
||||
// Register Google AdSense scripts.
|
||||
wp_register_script( 'csco_adsense', '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' );
|
||||
|
||||
// Enqueue Google AdSense.
|
||||
wp_enqueue_script( 'csco_adsense' );
|
||||
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'csco_custom_content_enqueue_scripts' );
|
||||
|
||||
/**
|
||||
* Actions
|
||||
*/
|
||||
function csco_custom_content_display() {
|
||||
|
||||
// Get current action name.
|
||||
$current = current_filter();
|
||||
|
||||
// Get ads pages.
|
||||
$pages = csco_get_custom_content_pages();
|
||||
|
||||
foreach ( $pages as $page_slug => $page_name ) {
|
||||
|
||||
$location = "is_$page_slug";
|
||||
|
||||
// On normal pages only.
|
||||
if ( 'is_page' === $location ) {
|
||||
$location = is_front_page() || is_home() ? null : $location;
|
||||
}
|
||||
|
||||
if ( $location && function_exists( $location ) && $location() ) {
|
||||
|
||||
// Get ads locations.
|
||||
$locations = csco_get_custom_content_locations();
|
||||
|
||||
// Loop through all locations.
|
||||
foreach ( $locations as $location ) {
|
||||
// Check if ads location is supported by the current page template.
|
||||
if ( in_array( $page_slug, $location['template'], true ) ) {
|
||||
// Before.
|
||||
if ( 'csco_' . $location['slug'] . '_before' === $current ) {
|
||||
$code = get_theme_mod( 'custom_content_' . $page_slug . '_' . $location['slug'] . '_before' );
|
||||
if ( $code ) {
|
||||
echo '<section class="cs-custom-content cs-custom-content-' . esc_html( $location['slug'] ) . '-before">' . do_blocks( do_shortcode( $code ) ) . '</section>';
|
||||
}
|
||||
}
|
||||
// After.
|
||||
if ( 'csco_' . $location['slug'] . '_after' === $current ) {
|
||||
$code = get_theme_mod( 'custom_content_' . $page_slug . '_' . $location['slug'] . '_after' );
|
||||
if ( $code ) {
|
||||
echo '<section class="cs-custom-content cs-custom-content-' . esc_html( $location['slug'] ) . '-after">' . do_blocks( do_shortcode( $code ) ) . '</section>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $locations as $location ) {
|
||||
add_action( 'csco_' . $location['slug'] . '_before', 'csco_custom_content_display', 5 );
|
||||
add_action( 'csco_' . $location['slug'] . '_after', 'csco_custom_content_display', 999 );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'init', 'csco_init_custom_content' );
|
||||
61
inc/deprecated.php
Normal file
61
inc/deprecated.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Deprecated features and migration functions
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check Theme Version
|
||||
*/
|
||||
function csco_check_theme_version() {
|
||||
|
||||
// Get Theme info.
|
||||
$theme_name = get_template();
|
||||
$theme = wp_get_theme( $theme_name );
|
||||
$theme_ver = $theme->get( 'Version' );
|
||||
|
||||
// Get Theme option.
|
||||
$csco_theme_version = get_option( 'csco_theme_version_' . $theme_name );
|
||||
|
||||
// Get old version.
|
||||
if ( $theme_name && isset( $csco_theme_version ) ) {
|
||||
$old_theme_ver = $csco_theme_version;
|
||||
}
|
||||
|
||||
// First start.
|
||||
if ( ! isset( $old_theme_ver ) ) {
|
||||
$old_theme_ver = 0;
|
||||
}
|
||||
|
||||
// If versions don't match.
|
||||
if ( $old_theme_ver !== $theme_ver ) {
|
||||
|
||||
/**
|
||||
* If different versions call a special hook.
|
||||
*
|
||||
* @param string $old_theme_ver Old theme version.
|
||||
* @param string $theme_ver New theme version.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_theme_deprecated', $old_theme_ver, $theme_ver );
|
||||
|
||||
update_option( 'csco_theme_version_' . $theme_name, $theme_ver );
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'csco_check_theme_version', 30 );
|
||||
|
||||
/**
|
||||
* Run migration.
|
||||
*
|
||||
* @param string $old_theme_ver Old Theme version.
|
||||
* @param string $theme_ver Current Theme version.
|
||||
*/
|
||||
function csco_run_migration( $old_theme_ver, $theme_ver ) {
|
||||
// Version 1.0.1.
|
||||
if ( version_compare( '1.0.1', $old_theme_ver, '>' ) ) {
|
||||
delete_option( 'csco_elementor_init' );
|
||||
}
|
||||
}
|
||||
add_action( 'csco_theme_deprecated', 'csco_run_migration', 10, 2 );
|
||||
956
inc/filters.php
Normal file
956
inc/filters.php
Normal file
@@ -0,0 +1,956 @@
|
||||
<?php
|
||||
/**
|
||||
* Filters
|
||||
*
|
||||
* Filtering native WordPress and third-party plugins' functions.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_body_class' ) ) {
|
||||
/**
|
||||
* Adds classes to <body> tag
|
||||
*
|
||||
* @param array $classes is an array of all body classes.
|
||||
*/
|
||||
function csco_body_class( $classes ) {
|
||||
|
||||
// Page Layout.
|
||||
$classes[] = 'cs-page-layout-' . csco_get_page_sidebar();
|
||||
|
||||
// Sticky Navbar.
|
||||
if ( get_theme_mod( 'navbar_sticky', true ) ) {
|
||||
$classes['navbar_sticky'] = 'cs-navbar-sticky-enabled';
|
||||
|
||||
// Smart Navbar.
|
||||
if ( get_theme_mod( 'navbar_smart_sticky', true ) ) {
|
||||
$classes['navbar_sticky'] = 'cs-navbar-smart-enabled';
|
||||
}
|
||||
}
|
||||
|
||||
// Sticky Sidebar.
|
||||
if ( get_theme_mod( 'misc_sticky_sidebar', true ) ) {
|
||||
$classes[] = 'cs-sticky-sidebar-enabled';
|
||||
|
||||
$classes[] = get_theme_mod( 'misc_sticky_sidebar_method', 'cs-stick-to-top' );
|
||||
} else {
|
||||
$classes[] = 'cs-sticky-sidebar-disabled';
|
||||
}
|
||||
|
||||
// Single Page Header Type.
|
||||
if ( is_single() ) {
|
||||
$classes[] = 'cs-single-header-type-' . csco_get_page_header_type();
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
add_filter( 'body_class', 'csco_body_class' );
|
||||
|
||||
if ( ! function_exists( 'csco_kses_allowed_html' ) ) {
|
||||
/**
|
||||
* Filters the HTML that is allowed for a given context.
|
||||
*
|
||||
* @param array $tags Tags by.
|
||||
* @param string $context Context name.
|
||||
*/
|
||||
function csco_kses_allowed_html( $tags, $context ) {
|
||||
|
||||
if ( 'content' === $context ) {
|
||||
$tags = array(
|
||||
'a' => array(
|
||||
'class' => true,
|
||||
'href' => true,
|
||||
'title' => true,
|
||||
'target' => true,
|
||||
'rel' => true,
|
||||
),
|
||||
'div' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'span' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'img' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'src' => true,
|
||||
'rel' => true,
|
||||
'srcset' => true,
|
||||
'size' => true,
|
||||
),
|
||||
'br' => array(),
|
||||
'b' => array(),
|
||||
'strong' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'i' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'p' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'h1' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'h2' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'h3' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'h4' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'h5' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
'h6' => array(
|
||||
'class' => true,
|
||||
'id' => true,
|
||||
'style' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( 'common' === $context ) {
|
||||
$tags = wp_kses_allowed_html( 'post' );
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'wp_kses_allowed_html', 'csco_kses_allowed_html', 10, 2 );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_sitecontent_class' ) ) {
|
||||
/**
|
||||
* Adds the classes for the site-content element.
|
||||
*
|
||||
* @param array $classes Classes to add to the class list.
|
||||
*/
|
||||
function csco_sitecontent_class( $classes ) {
|
||||
|
||||
// Page Sidebar.
|
||||
if ( 'disabled' !== csco_get_page_sidebar() ) {
|
||||
$classes[] = 'cs-sidebar-enabled cs-sidebar-' . csco_get_page_sidebar();
|
||||
} else {
|
||||
$classes[] = 'cs-sidebar-disabled';
|
||||
}
|
||||
|
||||
// Post Metabar.
|
||||
if ( true === get_theme_mod( 'post_metabar', true ) && is_singular( 'post' ) ) {
|
||||
$classes[] = 'cs-metabar-enabled';
|
||||
} else {
|
||||
$classes[] = 'cs-metabar-disabled';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
add_filter( 'csco_site_content_class', 'csco_sitecontent_class' );
|
||||
|
||||
if ( ! function_exists( 'csco_add_entry_class' ) ) {
|
||||
/**
|
||||
* Add entry class to post_class
|
||||
*
|
||||
* @param array $classes One or more classes to add to the class list.
|
||||
*/
|
||||
function csco_add_entry_class( $classes ) {
|
||||
array_push( $classes, 'cs-entry' );
|
||||
|
||||
return $classes;
|
||||
}
|
||||
}
|
||||
add_filter( 'post_class', 'csco_add_entry_class' );
|
||||
|
||||
if ( ! function_exists( 'csco_remove_hentry_class' ) ) {
|
||||
/**
|
||||
* Remove hentry from post_class
|
||||
*
|
||||
* @param array $classes One or more classes to add to the class list.
|
||||
*/
|
||||
function csco_remove_hentry_class( $classes ) {
|
||||
return array_diff( $classes, array( 'hentry' ) );
|
||||
}
|
||||
}
|
||||
add_filter( 'post_class', 'csco_remove_hentry_class' );
|
||||
|
||||
if ( ! function_exists( 'csco_max_srcset_image_width' ) ) {
|
||||
/**
|
||||
* Changes max image width in srcset attribute
|
||||
*
|
||||
* @param int $max_width The maximum image width to be included in the 'srcset'. Default '1600'.
|
||||
* @param array $size_array Array of width and height values in pixels (in that order).
|
||||
*/
|
||||
function csco_max_srcset_image_width( $max_width, $size_array ) {
|
||||
return 3840;
|
||||
}
|
||||
}
|
||||
add_filter( 'max_srcset_image_width', 'csco_max_srcset_image_width', 10, 2 );
|
||||
|
||||
if ( ! function_exists( 'csco_get_the_archive_title' ) ) {
|
||||
/**
|
||||
* Archive Title
|
||||
*
|
||||
* Removes default prefixes, like "Category:" from archive titles.
|
||||
*
|
||||
* @param string $title Archive title.
|
||||
*/
|
||||
function csco_get_the_archive_title( $title ) {
|
||||
if ( is_category() ) {
|
||||
|
||||
$title = single_cat_title( '', false );
|
||||
|
||||
} elseif ( is_tag() ) {
|
||||
|
||||
$title = single_tag_title( '', false );
|
||||
|
||||
} elseif ( is_author() ) {
|
||||
|
||||
$title = get_the_author( '', false );
|
||||
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
add_filter( 'get_the_archive_title', 'csco_get_the_archive_title' );
|
||||
|
||||
if ( ! function_exists( 'csco_excerpt_length' ) ) {
|
||||
/**
|
||||
* Excerpt Length
|
||||
*
|
||||
* @param string $length of the excerpt.
|
||||
*/
|
||||
function csco_excerpt_length( $length ) {
|
||||
return 18;
|
||||
}
|
||||
}
|
||||
add_filter( 'excerpt_length', 'csco_excerpt_length' );
|
||||
|
||||
if ( ! function_exists( 'csco_strip_shortcode_from_excerpt' ) ) {
|
||||
/**
|
||||
* Strip shortcodes from excerpt
|
||||
*
|
||||
* @param string $content Excerpt.
|
||||
*/
|
||||
function csco_strip_shortcode_from_excerpt( $content ) {
|
||||
$content = strip_shortcodes( $content );
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
add_filter( 'the_excerpt', 'csco_strip_shortcode_from_excerpt' );
|
||||
|
||||
if ( ! function_exists( 'csco_strip_tags_from_excerpt' ) ) {
|
||||
/**
|
||||
* Strip HTML from excerpt
|
||||
*
|
||||
* @param string $content Excerpt.
|
||||
*/
|
||||
function csco_strip_tags_from_excerpt( $content ) {
|
||||
$content = wp_strip_all_tags( $content );
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
add_filter( 'the_excerpt', 'csco_strip_tags_from_excerpt' );
|
||||
|
||||
if ( ! function_exists( 'csco_excerpt_more' ) ) {
|
||||
/**
|
||||
* Excerpt Suffix
|
||||
*
|
||||
* @param string $more suffix for the excerpt.
|
||||
*/
|
||||
function csco_excerpt_more( $more ) {
|
||||
return '…';
|
||||
}
|
||||
}
|
||||
add_filter( 'excerpt_more', 'csco_excerpt_more' );
|
||||
|
||||
if ( ! function_exists( 'csco_post_meta_process' ) ) {
|
||||
/**
|
||||
* Pre processing post meta choices
|
||||
*
|
||||
* @param array $data Post meta list.
|
||||
*/
|
||||
function csco_post_meta_process( $data ) {
|
||||
if ( csco_post_views_enabled() ) {
|
||||
$data['views'] = esc_html__( 'Views', 'revision' );
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
add_filter( 'csco_post_meta_choices', 'csco_post_meta_process' );
|
||||
|
||||
if ( ! function_exists( 'csco_search_only_posts' ) ) {
|
||||
/**
|
||||
* Search only posts.
|
||||
*
|
||||
* @param object $query The WP_Query instance (passed by reference).
|
||||
*/
|
||||
function csco_search_only_posts( $query ) {
|
||||
if ( ! is_admin() && $query->is_main_query() && $query->is_search ) {
|
||||
$query->set( 'post_type', 'post' );
|
||||
}
|
||||
}
|
||||
add_action( 'pre_get_posts', 'csco_search_only_posts' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_comment_form_defaults' ) ) {
|
||||
/**
|
||||
* Pre processing post meta choices
|
||||
*
|
||||
* @param array $defaults The default comment form arguments.
|
||||
*/
|
||||
function csco_comment_form_defaults( $defaults ) {
|
||||
|
||||
$label = esc_html__( 'Your Message', 'revision' ) . ( ' <span class="required">*</span>' );
|
||||
$placeholder = esc_html__( 'Text', 'revision' );
|
||||
|
||||
$defaults['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . $label . '</label><textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required" placeholder="' . $placeholder . '"></textarea></p>';
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
}
|
||||
add_filter( 'comment_form_defaults', 'csco_comment_form_defaults' );
|
||||
|
||||
if ( ! function_exists( 'csco_register_block_styles' ) ) {
|
||||
/**
|
||||
* Register block styles.
|
||||
*/
|
||||
function csco_register_block_styles() {
|
||||
if ( ! function_exists( 'register_block_style' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
register_block_style(
|
||||
'core/heading',
|
||||
array(
|
||||
'name' => 'cs-heading-gradient',
|
||||
'label' => esc_html__( 'Inline Gradient', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-about',
|
||||
'label' => esc_html__( 'About Widget', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-about-page',
|
||||
'label' => esc_html__( 'About Page', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-contact-form',
|
||||
'label' => esc_html__( 'Contact Form', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-technologies',
|
||||
'label' => esc_html__( 'Technologies', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/columns',
|
||||
array(
|
||||
'name' => 'cs-work-experience',
|
||||
'label' => esc_html__( 'Work Experience', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-posts-slider',
|
||||
'label' => esc_html__( 'Posts Slider', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-category-grid',
|
||||
'label' => esc_html__( 'Category Grid', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/group',
|
||||
array(
|
||||
'name' => 'cs-work-experience-layout',
|
||||
'label' => esc_html__( 'Experience Grid', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/categories',
|
||||
array(
|
||||
'name' => 'cs-tiles',
|
||||
'label' => esc_html__( 'Tiles', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/latest-posts',
|
||||
array(
|
||||
'name' => 'cs-tile-layout',
|
||||
'label' => esc_html__( 'Tile', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/heading',
|
||||
array(
|
||||
'name' => 'cs-link',
|
||||
'label' => esc_html__( 'Link Style', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
register_block_style(
|
||||
'core/heading',
|
||||
array(
|
||||
'name' => 'cs-location',
|
||||
'label' => esc_html__( 'Location Style', 'revision' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'init', 'csco_register_block_styles' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_comment_form_default_fields' ) ) {
|
||||
/**
|
||||
* Pre processing post meta choices
|
||||
*
|
||||
* @param string[] $fields Array of the default comment fields.
|
||||
*/
|
||||
function csco_comment_form_default_fields( $fields ) {
|
||||
$commenter = wp_get_current_commenter();
|
||||
$user = wp_get_current_user();
|
||||
$req = get_option( 'require_name_email' );
|
||||
$html_req = ( $req ? " required='required'" : '' );
|
||||
|
||||
$label_author = esc_html__( 'Your Name', 'revision' ) . ( $req ? ' <span class="required">*</span>' : '' );
|
||||
$label_email = esc_html__( 'Email Address', 'revision' ) . ( $req ? ' <span class="required">*</span>' : '' );
|
||||
$label_url = esc_html__( 'Website', 'revision' );
|
||||
|
||||
$fields['author'] = '<p class="comment-form-author"><label for="author">' . $label_author . '</label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245" ' . wp_kses( $html_req, 'csco' ) . '></p>';
|
||||
$fields['email'] = '<p class="comment-form-email"><label for="email">' . $label_email . '</label><input id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" ' . wp_kses( $html_req, 'csco' ) . '></p>';
|
||||
$fields['url'] = '<p class="comment-form-url"><label for="url">' . $label_url . '</label><input id="url" name="url" type="url" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200"></p>';
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
add_filter( 'comment_form_default_fields', 'csco_comment_form_default_fields' );
|
||||
|
||||
if ( ! function_exists( 'csco_singular_register_options' ) ) {
|
||||
/**
|
||||
* Register options for single and page
|
||||
*/
|
||||
function csco_singular_register_options() {
|
||||
$function = sprintf( 'add_meta_%s', 'box' );
|
||||
|
||||
$function(
|
||||
'csco_singular_options',
|
||||
esc_html__( 'Singular Options', 'revision' ),
|
||||
function () {
|
||||
return __return_empty_string();
|
||||
},
|
||||
array( 'post', 'page' ),
|
||||
'side'
|
||||
);
|
||||
}
|
||||
add_action( sprintf( 'add_meta_%s', 'boxes' ), 'csco_singular_register_options' );
|
||||
}
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------------
|
||||
* [ Primary Menu ]
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_primary_menu_item_args' ) ) {
|
||||
/**
|
||||
* Filters the arguments for a single nav menu item.
|
||||
*
|
||||
* @param object $args An object of wp_nav_menu() arguments.
|
||||
* @param object $item (WP_Post) Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
function csco_primary_menu_item_args( $args, $item, $depth ) {
|
||||
$args->link_before = '';
|
||||
$args->link_after = '';
|
||||
if ( 'primary' === $args->theme_location && 0 === $depth ) {
|
||||
$args->link_before = '<span>';
|
||||
$args->link_after = '</span>';
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
add_filter( 'nav_menu_item_args', 'csco_primary_menu_item_args', 10, 3 );
|
||||
}
|
||||
|
||||
if ( version_compare( get_bloginfo( 'version' ), '5.4', '>=' ) ) {
|
||||
/**
|
||||
* Add badge custom fields to menu item
|
||||
*
|
||||
* @param int $id object id.
|
||||
*/
|
||||
function csco_menu_item_badge_fields( $id ) {
|
||||
|
||||
wp_nonce_field( 'csco_menu_meta_nonce', 'csco_menu_meta_nonce_name' );
|
||||
|
||||
$badge_text = get_post_meta( $id, '_csco_menu_badge_text', true );
|
||||
?>
|
||||
<p class="description description-thin">
|
||||
<label><?php esc_html_e( 'Badge Text', 'revision' ); ?><br>
|
||||
<input type="text" class="widefat <?php echo esc_attr( $id ); ?>" name="csco_menu_badge_text[<?php echo esc_attr( $id ); ?>]" value="<?php echo esc_attr( $badge_text ); ?>">
|
||||
</label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_nav_menu_item_custom_fields', 'csco_menu_item_badge_fields' );
|
||||
|
||||
/**
|
||||
* Save the badge menu item meta
|
||||
*
|
||||
* @param int $menu_id menu id.
|
||||
* @param int $menu_item_db_id menu item db id.
|
||||
*/
|
||||
function csco_menu_item_badge_fields_update( $menu_id, $menu_item_db_id ) {
|
||||
|
||||
// Check ajax.
|
||||
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Security.
|
||||
check_admin_referer( 'csco_menu_meta_nonce', 'csco_menu_meta_nonce_name' );
|
||||
|
||||
// Save badge text.
|
||||
if ( isset( $_POST['csco_menu_badge_text'][ $menu_item_db_id ] ) ) {
|
||||
$sanitized_data = sanitize_text_field( $_POST['csco_menu_badge_text'][ $menu_item_db_id ] );
|
||||
update_post_meta( $menu_item_db_id, '_csco_menu_badge_text', $sanitized_data );
|
||||
} else {
|
||||
delete_post_meta( $menu_item_db_id, '_csco_menu_badge_text' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_update_nav_menu_item', 'csco_menu_item_badge_fields_update', 10, 2 );
|
||||
|
||||
/**
|
||||
* Displays badge text on the front-end.
|
||||
*
|
||||
* @param string $title The menu item's title.
|
||||
* @param WP_Post $item The current menu item.
|
||||
* @return string
|
||||
*/
|
||||
function csco_badge_menu_item( $title, $item ) {
|
||||
// Add badge code after title text.
|
||||
if ( is_object( $item ) && isset( $item->ID ) ) {
|
||||
|
||||
$badge_text = get_post_meta( $item->ID, '_csco_menu_badge_text', true );
|
||||
|
||||
if ( ! empty( $badge_text ) ) {
|
||||
$title .= ' <span class="csco-badge csco-badge-primary">' . esc_html( $badge_text ) . '</span>';
|
||||
}
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
add_filter( 'nav_menu_item_title', 'csco_badge_menu_item', 8, 2 );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_exclude_hero_posts_from_query' ) ) {
|
||||
/**
|
||||
* Exclude Hero from the Main Query
|
||||
*
|
||||
* @param array $query Default query.
|
||||
*/
|
||||
function csco_exclude_hero_posts_from_query( $query ) {
|
||||
if ( is_admin() ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
if ( false === get_theme_mod( 'home_hero', false ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
if ( ! $query->is_home ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
if ( false === get_theme_mod( 'home_hero_exclude', false ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
if ( ! $query->is_main_query() ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
if ( 'hero-type-1' === get_theme_mod( 'home_hero_layout', 'hero-type-1' ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$args = csco_get_hero_query_args();
|
||||
|
||||
$args['fields'] = 'ids';
|
||||
|
||||
$query_to_exclude = new WP_Query( $args );
|
||||
|
||||
if ( isset( $query_to_exclude->posts ) && $query_to_exclude->posts ) {
|
||||
$post_ids = $query_to_exclude->posts;
|
||||
}
|
||||
|
||||
if ( ! isset( $post_ids ) || ! $post_ids ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$query->set( 'post__not_in', array_merge( $query->get( 'post__not_in' ), $post_ids ) );
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
add_action( 'pre_get_posts', 'csco_exclude_hero_posts_from_query', 9999 );
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------------
|
||||
* Render Blocks
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_custom_render_block_categories' ) ) {
|
||||
/**
|
||||
* Block Render Categories
|
||||
*
|
||||
* @param string $block_content The content.
|
||||
* @param array $block The block.
|
||||
*/
|
||||
function csco_custom_render_block_categories( $block_content, $block ) {
|
||||
|
||||
if ( 'core/categories' === $block['blockName'] && false !== strpos( $block_content, 'is-style-cs-tiles' ) ) {
|
||||
$block_content = preg_replace_callback(
|
||||
'|<a(.*?)href="(.*?)">(.*?)<\/a> \((.*?)\)|',
|
||||
function ( $matches ) {
|
||||
return '<a' . $matches[1] . 'href="' . $matches[2] . '">' . $matches[3] . ' <span>' . $matches[4] . '</span></a>';
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
}
|
||||
|
||||
return $block_content;
|
||||
}
|
||||
}
|
||||
add_filter( 'render_block', 'csco_custom_render_block_categories', 10, 2 );
|
||||
|
||||
if ( ! function_exists( 'csco_custom_render_block_social_links' ) ) {
|
||||
/**
|
||||
* Block Render Social Links
|
||||
*
|
||||
* @param string $block_content The content.
|
||||
* @param array $block The block.
|
||||
*/
|
||||
function csco_custom_render_block_social_links( $block_content, $block ) {
|
||||
|
||||
if ( 'core/social-links' === $block['blockName'] ) {
|
||||
$block_content = preg_replace_callback(
|
||||
'|<a(.*?)href="([^"]+)"|',
|
||||
function ( $matches ) {
|
||||
|
||||
$domain = parse_url( $matches[2], PHP_URL_HOST );
|
||||
|
||||
$title = explode( '.', str_replace( 'www.', '', $domain ) )[0];
|
||||
|
||||
return '<a' . $matches[1] . 'href="' . $matches[2] . '"' . ( $title ? ' title="' . ucfirst( $title ) . '"' : '' );
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
}
|
||||
|
||||
return $block_content;
|
||||
}
|
||||
}
|
||||
add_filter( 'render_block', 'csco_custom_render_block_social_links', 10, 2 );
|
||||
|
||||
if ( ! function_exists( 'csco_custom_render_block_latest_posts' ) ) {
|
||||
/**
|
||||
* Block Render Latest Posts
|
||||
*
|
||||
* @param string $block_content The content.
|
||||
* @param array $block The block.
|
||||
*/
|
||||
function csco_custom_render_block_latest_posts( $block_content, $block ) {
|
||||
|
||||
if ( 'core/latest-posts' === $block['blockName'] ) {
|
||||
|
||||
$has_tile_layout_class = isset( $block['attrs']['className'] ) && strpos( $block['attrs']['className'], 'is-style-cs-tile-layout' ) !== false;
|
||||
|
||||
if ( $has_tile_layout_class ) {
|
||||
|
||||
$has_dates = preg_match( '/has-dates/', $block_content );
|
||||
$has_author = preg_match( '/has-author/', $block_content );
|
||||
|
||||
$meta_pattern = '|(<div class="wp-block-latest-posts__post-author">.*?<\/div><time datetime=".*?" class="wp-block-latest-posts__post-date">)(.*?)(<\/time>)|';
|
||||
|
||||
if ( $has_dates && $has_author ) {
|
||||
$container_pattern = '|(<div class="wp-block-latest-posts__category">.*?</div><a class="wp-block-latest-posts__post-title" href="([^<]*?)">.*?</a><div class="wp-block-latest-posts__meta">.*?<time datetime=".*?" class="wp-block-latest-posts__post-date">.*?</time></div>)|';
|
||||
} elseif ( $has_author && ! $has_dates ) {
|
||||
$container_pattern = '|(<div class="wp-block-latest-posts__category">.*?</div><a class="wp-block-latest-posts__post-title" href="([^<]*?)">.*?</a><div class="wp-block-latest-posts__meta">.*?<div class="wp-block-latest-posts__post-author">.*?</div></div>)|';
|
||||
$meta_pattern = '|(<div class="wp-block-latest-posts__post-author">.*?<\/div>)|';
|
||||
} elseif ( $has_dates && ! $has_author ) {
|
||||
$container_pattern = '|(<div class="wp-block-latest-posts__category">.*?</div><a class="wp-block-latest-posts__post-title" href="([^<]*?)">.*?</a><div class="wp-block-latest-posts__meta">.*?<time datetime=".*?" class="wp-block-latest-posts__post-date">.*?</time></div>)|';
|
||||
$meta_pattern = '|(<time datetime=".*?" class="wp-block-latest-posts__post-date">)(.*?)(<\/time>)|';
|
||||
} else {
|
||||
$container_pattern = '|(<div class="wp-block-latest-posts__category">.*?</div><a class="wp-block-latest-posts__post-title" href="([^<]*?)">.*?</a>)|';
|
||||
}
|
||||
|
||||
// Change Ul & li to div, add swiper elements.
|
||||
$block_content = preg_replace_callback(
|
||||
'/<ul(.*?)>(.*?)<\/ul>/is',
|
||||
function ( $matches ) {
|
||||
$pagination = '<div class="cs-latest-posts-slider__pagination"></div>';
|
||||
$arrows = '<div class="cs-latest-posts-slider__button-prev"></div><div class="cs-latest-posts-slider__button-next"></div>';
|
||||
|
||||
$inner_content = preg_replace( '/<li(.*?)>(.*?)<\/li>/is', '<div$1 class="cs-latest-posts-slider__item">$2</div>', $matches[2] );
|
||||
$inner_content_with_parent = '<div class="cs-latest-posts-slider__wrapper">' . $inner_content . '</div>' . $arrows;
|
||||
|
||||
return '<div class="cs-latest-posts-slider"><div' . $matches[1] . '>' . $inner_content_with_parent . '</div>' . $pagination . '</div>';
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
|
||||
// Add author link to latest posts block.
|
||||
$block_content = preg_replace_callback(
|
||||
'|<div class="wp-block-latest-posts__post-author">([^<]*?)<\/div>|',
|
||||
function ( $matches ) {
|
||||
$author_name = trim( str_replace( 'by', '', $matches[1] ) );
|
||||
|
||||
$users = get_users(
|
||||
array(
|
||||
'search' => '*' . esc_sql( $author_name ) . '*',
|
||||
'search_columns' => array( 'display_name' ),
|
||||
'number' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $users ) ) {
|
||||
$author = $users[0];
|
||||
$author_url = get_author_posts_url( $author->ID );
|
||||
|
||||
if ( $author_url ) {
|
||||
return sprintf( '<div class="wp-block-latest-posts__post-author">by <a href="%s">%s</a></div>', esc_url( $author_url ), esc_html( $author->display_name ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $matches[0];
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
|
||||
// Add Meta container.
|
||||
$block_content = preg_replace_callback(
|
||||
$meta_pattern,
|
||||
function ( $matches ) {
|
||||
$time_string = '<span>' . __( 'on', 'revision' ) . '</span>';
|
||||
$output = trim( str_replace( 'by', '', $matches[1] ) );
|
||||
|
||||
if ( $matches[2] && $matches[3] ) {
|
||||
$output = trim( str_replace( 'by', '', $matches[1] ) ) . $time_string . trim( $matches[2] ) . $matches[3];
|
||||
}
|
||||
|
||||
$items = get_posts(
|
||||
array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $items ) ) {
|
||||
$output = '<div class="wp-block-latest-posts__meta">' . $output . '</div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
|
||||
// Add Category.
|
||||
$block_content = preg_replace_callback(
|
||||
'|(<a class="wp-block-latest-posts__post-title" href=".*?">([^<]*?)</a>)|',
|
||||
function ( $matches ) {
|
||||
|
||||
$output = $matches[0];
|
||||
$post_title = html_entity_decode( $matches[1] );
|
||||
|
||||
$items = get_posts(
|
||||
array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'name' => sanitize_title( $post_title ),
|
||||
'posts_per_page' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $items ) ) {
|
||||
// Fetch current post category.
|
||||
$categories = get_the_category( $items[0]->ID );
|
||||
$post_category_url = ! empty( $categories ) ? get_category_link( $categories[0]->term_id ) : '';
|
||||
$post_category = ! empty( $categories ) ? '<div class="wp-block-latest-posts__category"><a href="' . $post_category_url . '">' . $categories[0]->name . '</a></div>' : '';
|
||||
|
||||
$output = $post_category . $output;
|
||||
}
|
||||
|
||||
return $output;
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
|
||||
// Add Content container & overlay link.
|
||||
$block_content = preg_replace_callback(
|
||||
$container_pattern,
|
||||
function ( $matches ) {
|
||||
$output = $matches[0];
|
||||
|
||||
$items = get_posts(
|
||||
array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
if ( ! empty( $items ) ) {
|
||||
$post_permalink = $matches[2];
|
||||
|
||||
$link_label = sprintf(
|
||||
/* translators: %s: Post Title */
|
||||
__( 'Read More: %s', 'revision' ),
|
||||
$items[0]->post_title
|
||||
);
|
||||
|
||||
$output = '<div class="wp-block-latest-posts__content" data-scheme="inverse"><a class="wp-block-latest-posts__link" href="' . esc_url( $post_permalink ) . '" title="' . esc_attr( $link_label ) . '"></a><div class="wp-block-latest-posts__content-inner">' . $output . '</div></div>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
},
|
||||
$block_content
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $block_content;
|
||||
}
|
||||
}
|
||||
add_filter( 'render_block', 'csco_custom_render_block_latest_posts', 10, 2 );
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------------
|
||||
* Breadcrumbs separator
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
if ( ! function_exists( 'csco_replace_breadcrumb_separator' ) ) {
|
||||
/**
|
||||
* Change the breadcrumbs HTML output.
|
||||
*
|
||||
* @param string $html HTML output.
|
||||
*/
|
||||
function csco_replace_breadcrumb_separator( $html ) {
|
||||
$breadcrumbs_separators = array(
|
||||
'#<span class="separator">(.*?)</span>#',
|
||||
'#<span class="aioseo-breadcrumb-separator">(.*?)</span>#',
|
||||
);
|
||||
|
||||
$html = preg_replace( $breadcrumbs_separators, '<span class="cs-separator"></span>', $html );
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
add_filter( 'rank_math/frontend/breadcrumb/html', 'csco_replace_breadcrumb_separator' );
|
||||
add_filter( 'aioseo_breadcrumbs_separator', 'csco_replace_breadcrumb_separator' );
|
||||
|
||||
if ( ! function_exists( 'csco_comment_form' ) ) {
|
||||
/**
|
||||
* Customize the comment form fields.
|
||||
*
|
||||
* @param array $args The default comment form fields.
|
||||
*/
|
||||
function csco_comment_form( $args ) {
|
||||
|
||||
$commenter = wp_get_current_commenter();
|
||||
$req = get_option( 'require_name_email' );
|
||||
$aria_req = ( $req ? " aria-required='true'" : '' );
|
||||
|
||||
// Remove the website field.
|
||||
unset( $args['fields']['url'] );
|
||||
|
||||
$args['fields']['author'] = '<p class="comment-form-author">' .
|
||||
'<label for="author">' . esc_attr__( 'Name', 'revision' ) . ' *</label><input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
|
||||
'" size="30"' . $aria_req . ' placeholder="' . esc_attr__( 'Name', 'revision' ) . ( $req ? ' *' : '' ) . '" /></p>';
|
||||
|
||||
$args['fields']['email'] = '<p class="comment-form-email">' .
|
||||
'<label for="email">' . esc_attr__( 'Email', 'revision' ) . ' *</label><input id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) .
|
||||
'" size="30"' . $aria_req . ' placeholder="' . esc_attr__( 'Email', 'revision' ) . ' *" /></p>';
|
||||
|
||||
$args['comment_field'] = '<p class="comment-form-comment">' .
|
||||
'<label for="comment">' . esc_attr__( 'Your Comment', 'revision' ) . ' *</label></label><textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required" aria-required="true" placeholder="' . esc_attr__( 'Your Comment', 'revision' ) . ' *"></textarea>' .
|
||||
'</p>';
|
||||
|
||||
$args['fields']['cookies'] = '<p class="comment-form-cookies-consent">' .
|
||||
'<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes">' .
|
||||
'<label for="wp-comment-cookies-consent">' . esc_html__( 'Save my name and email in this browser for the next time I comment.', 'revision' ) . '</label>' .
|
||||
'</p>';
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
add_filter( 'comment_form_defaults', 'csco_comment_form' );
|
||||
|
||||
|
||||
if ( ! function_exists( 'csco_update_post_reading_time' ) ) {
|
||||
/**
|
||||
* Update Post Reading Time on Post Save
|
||||
*
|
||||
* @param int $post_id The post ID.
|
||||
*/
|
||||
function csco_update_post_reading_time( $post_id ) {
|
||||
if ( ! $post_id ) {
|
||||
$post_id = get_the_ID();
|
||||
}
|
||||
$reading_time = csco_calculate_post_reading_time( $post_id );
|
||||
|
||||
update_post_meta( $post_id, '_csco_reading_time', $reading_time );
|
||||
}
|
||||
}
|
||||
add_action( 'save_post', 'csco_update_post_reading_time', 10, 1 );
|
||||
|
||||
// Remove p tags from Contact Form 7.
|
||||
add_filter( 'wpcf7_autop_or_not', '__return_false' );
|
||||
26
inc/gutenberg.php
Normal file
26
inc/gutenberg.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Gutenberg compatibility functions.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Assets.
|
||||
*/
|
||||
require get_template_directory() . '/inc/gutenberg/assets.php';
|
||||
|
||||
/**
|
||||
* Panels.
|
||||
*/
|
||||
require get_template_directory() . '/inc/gutenberg/panels.php';
|
||||
|
||||
/**
|
||||
* Filters.
|
||||
*/
|
||||
require get_template_directory() . '/inc/gutenberg/filters.php';
|
||||
|
||||
/**
|
||||
* Editor Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/gutenberg/editor.php';
|
||||
60
inc/gutenberg/assets.php
Normal file
60
inc/gutenberg/assets.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Assets
|
||||
*
|
||||
* All enqueues of scripts and styles.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_editor_style' ) ) {
|
||||
/**
|
||||
* Add callback for custom editor stylesheets.
|
||||
*/
|
||||
function csco_editor_style() {
|
||||
// Add support for editor styles.
|
||||
add_theme_support( 'editor-styles' );
|
||||
}
|
||||
}
|
||||
add_action( 'current_screen', 'csco_editor_style' );
|
||||
|
||||
if ( ! function_exists( 'csco_enqueue_block_editor_assets' ) ) {
|
||||
/**
|
||||
* Enqueue block editor specific scripts.
|
||||
*/
|
||||
function csco_enqueue_block_editor_assets() {
|
||||
if ( ! ( is_admin() && ! is_customize_preview() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$version = csco_get_theme_data( 'Version' );
|
||||
|
||||
// Register theme scripts.
|
||||
wp_register_script( 'cs-scripts', get_template_directory_uri() . '/assets/js/scripts.js', array( 'jquery', 'imagesloaded' ), $version, true );
|
||||
|
||||
// Localization array.
|
||||
$localize = array(
|
||||
'siteSchemeMode' => 'light',
|
||||
'siteSchemeToogle' => false,
|
||||
);
|
||||
|
||||
// Localize the main theme scripts.
|
||||
wp_localize_script( 'cs-scripts', 'csLocalize', $localize );
|
||||
|
||||
// Enqueue theme scripts.
|
||||
wp_enqueue_script( 'cs-scripts' );
|
||||
|
||||
// Register theme styles.
|
||||
wp_register_style( 'cs-editor', csco_style( get_template_directory_uri() . '/assets/css/editor-style.css' ), false, $version );
|
||||
|
||||
// Enqueue typography styles.
|
||||
csco_enqueue_typography_styles( 'cs-editor' );
|
||||
|
||||
// Add RTL support.
|
||||
wp_style_add_data( 'cs-editor', 'rtl', 'replace' );
|
||||
|
||||
// Enqueue theme styles.
|
||||
wp_enqueue_style( 'cs-editor' );
|
||||
}
|
||||
add_action( 'enqueue_block_assets', 'csco_enqueue_block_editor_assets' );
|
||||
}
|
||||
188
inc/gutenberg/editor.php
Normal file
188
inc/gutenberg/editor.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/**
|
||||
* Editor Settings.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enqueue editor scripts
|
||||
*/
|
||||
function csco_block_editor_scripts() {
|
||||
wp_enqueue_script(
|
||||
'cs-editor-scripts',
|
||||
get_template_directory_uri() . '/assets/jsx/editor-scripts.js',
|
||||
array(
|
||||
'wp-editor',
|
||||
'wp-element',
|
||||
'wp-compose',
|
||||
'wp-data',
|
||||
'wp-plugins',
|
||||
),
|
||||
csco_get_theme_data( 'Version' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action( 'enqueue_block_editor_assets', 'csco_block_editor_scripts' );
|
||||
|
||||
/**
|
||||
* Adds classes to <div class="editor-styles-wrapper"> tag
|
||||
*/
|
||||
function csco_block_editor_wrapper() {
|
||||
$script_handle = 'cs-editor-wrapper';
|
||||
$script_file = 'editor-wrapper.js';
|
||||
|
||||
if ( 'enqueue_block_assets' === current_filter() ) {
|
||||
if ( ! ( is_admin() && ! is_customize_preview() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$script_handle = 'cs-editor-iframe';
|
||||
$script_file = 'editor-iframe.js';
|
||||
}
|
||||
|
||||
$post_id = get_the_ID();
|
||||
|
||||
if ( ! $post_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set post type.
|
||||
$post_type = sprintf( 'post-type-%s', get_post_type( $post_id ) );
|
||||
|
||||
// Set page layout.
|
||||
$default_layout = csco_get_page_sidebar( $post_id, 'default' );
|
||||
$page_layout = csco_get_page_sidebar( $post_id, false );
|
||||
|
||||
if ( 'disabled' === $default_layout ) {
|
||||
$default_layout = 'cs-sidebar-disabled';
|
||||
} else {
|
||||
$default_layout = 'cs-sidebar-enabled';
|
||||
}
|
||||
|
||||
if ( 'disabled' === $page_layout ) {
|
||||
$page_layout = 'cs-sidebar-disabled';
|
||||
} else {
|
||||
$page_layout = 'cs-sidebar-enabled';
|
||||
}
|
||||
|
||||
// Set breakpoints.
|
||||
$breakpoints = array(
|
||||
'cs-breakpoint-up-576px' => 576,
|
||||
'cs-breakpoint-up-768px' => 768,
|
||||
'cs-breakpoint-up-992px' => 992,
|
||||
'cs-breakpoint-up-1200px' => 1200,
|
||||
'cs-breakpoint-up-1336px' => 1336,
|
||||
'cs-breakpoint-up-1920px' => 1920,
|
||||
);
|
||||
|
||||
wp_enqueue_script(
|
||||
$script_handle,
|
||||
get_template_directory_uri() . '/assets/jsx/' . $script_file,
|
||||
array(
|
||||
'wp-editor',
|
||||
'wp-element',
|
||||
'wp-compose',
|
||||
'wp-data',
|
||||
'wp-plugins',
|
||||
),
|
||||
csco_get_theme_data( 'Version' ),
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
$script_handle,
|
||||
'cscoGWrapper',
|
||||
array(
|
||||
'post_type' => $post_type,
|
||||
'default_layout' => $default_layout,
|
||||
'page_layout' => $page_layout,
|
||||
'breakpoints' => $breakpoints,
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'enqueue_block_editor_assets', 'csco_block_editor_wrapper' );
|
||||
add_action( 'enqueue_block_assets', 'csco_block_editor_wrapper' );
|
||||
|
||||
/**
|
||||
* Change editor color palette.
|
||||
*/
|
||||
function csco_change_editor_color_palette() {
|
||||
// Editor Color Palette.
|
||||
add_theme_support(
|
||||
'editor-color-palette',
|
||||
array(
|
||||
array(
|
||||
'name' => esc_html__( 'Primary', 'revision' ),
|
||||
'slug' => 'primary',
|
||||
'color' => get_theme_mod( 'color_primary', '#29294B' ),
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Secondary', 'revision' ),
|
||||
'slug' => 'secondary',
|
||||
'color' => get_theme_mod( 'color_secondary', '#696981' ),
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Layout', 'revision' ),
|
||||
'slug' => 'layout',
|
||||
'color' => get_theme_mod( 'color_layout_background', '#F1F1F1' ),
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Accent', 'revision' ),
|
||||
'slug' => 'accent',
|
||||
'color' => get_theme_mod( 'color_accent', '#5955D1' ),
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Border', 'revision' ),
|
||||
'slug' => 'border',
|
||||
'color' => get_theme_mod( 'color_border', '#E1E1E8' ),
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Blue', 'revision' ),
|
||||
'slug' => 'blue',
|
||||
'color' => '#59BACC',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Green', 'revision' ),
|
||||
'slug' => 'green',
|
||||
'color' => '#58AD69',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Orange', 'revision' ),
|
||||
'slug' => 'orange',
|
||||
'color' => '#FFBC49',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Red', 'revision' ),
|
||||
'slug' => 'red',
|
||||
'color' => '#e32c26',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Pale Pink', 'revision' ),
|
||||
'slug' => 'pale-pink',
|
||||
'color' => '#f78da7',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'White', 'revision' ),
|
||||
'slug' => 'white',
|
||||
'color' => '#FFFFFF',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Gray 50', 'revision' ),
|
||||
'slug' => 'gray-50',
|
||||
'color' => '#f8f9fa',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Gray 100', 'revision' ),
|
||||
'slug' => 'gray-100',
|
||||
'color' => '#f8f9fa',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Gray 200', 'revision' ),
|
||||
'slug' => 'gray-200',
|
||||
'color' => '#E1E1E8',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'after_setup_theme', 'csco_change_editor_color_palette' );
|
||||
14
inc/gutenberg/filters.php
Normal file
14
inc/gutenberg/filters.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Filters.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Disable wp_check_widget_editor_deps.
|
||||
*/
|
||||
function csco_disable_wp_check_widget_editor_deps() {
|
||||
call_user_func( 'remove_filter', 'admin_head', 'wp_check_widget_editor_deps' );
|
||||
}
|
||||
add_filter( 'init', 'csco_disable_wp_check_widget_editor_deps' );
|
||||
210
inc/gutenberg/panels.php
Normal file
210
inc/gutenberg/panels.php
Normal file
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
/**
|
||||
* Adding New Panels.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register meta fields for gutenberg panels
|
||||
*/
|
||||
function csco_gutenberg_panels_register_meta() {
|
||||
|
||||
$post_types = array( 'post', 'page' );
|
||||
|
||||
// Loop Post Types.
|
||||
foreach ( $post_types as $post_type ) {
|
||||
|
||||
/**
|
||||
* ==================================
|
||||
* Layout Options
|
||||
* ==================================
|
||||
*/
|
||||
|
||||
register_post_meta(
|
||||
$post_type,
|
||||
'csco_singular_sidebar',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'type' => 'string',
|
||||
'single' => true,
|
||||
'auth_callback' => function () {
|
||||
return current_user_can( 'edit_posts' );
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
register_post_meta(
|
||||
$post_type,
|
||||
'csco_page_header_type',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'type' => 'string',
|
||||
'single' => true,
|
||||
'auth_callback' => function () {
|
||||
return current_user_can( 'edit_posts' );
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
register_post_meta(
|
||||
$post_type,
|
||||
'csco_page_load_nextpost',
|
||||
array(
|
||||
'show_in_rest' => true,
|
||||
'type' => 'string',
|
||||
'single' => true,
|
||||
'auth_callback' => function () {
|
||||
return current_user_can( 'edit_posts' );
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'csco_gutenberg_panels_register_meta' );
|
||||
|
||||
/**
|
||||
* Filters whether a meta key is considered protected.
|
||||
*
|
||||
* @param bool $protected Whether the key is considered protected.
|
||||
* @param string $meta_key Metadata key.
|
||||
* @param string $meta_type Type of object metadata is for.
|
||||
*/
|
||||
function csco_is_protected_meta( $protected, $meta_key, $meta_type ) {
|
||||
$hide_meta_keys = array(
|
||||
'csco_singular_sidebar',
|
||||
'csco_page_header_type',
|
||||
'csco_page_load_nextpost',
|
||||
);
|
||||
|
||||
if ( in_array( $meta_key, $hide_meta_keys, true ) ) {
|
||||
$protected = true;
|
||||
}
|
||||
|
||||
return $protected;
|
||||
}
|
||||
add_filter( 'is_protected_meta', 'csco_is_protected_meta', 10, 3 );
|
||||
|
||||
/**
|
||||
* Enqueue assets for gutenberg panels
|
||||
*/
|
||||
function csco_gutenberg_panels_assets() {
|
||||
|
||||
$post_id = get_the_ID();
|
||||
|
||||
if ( ! $post_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post = get_post( $post_id );
|
||||
|
||||
$page_static = array();
|
||||
|
||||
// Add pages static.
|
||||
$page_static[] = get_option( 'page_on_front' );
|
||||
$page_static[] = get_option( 'page_for_posts' );
|
||||
|
||||
// Set options.
|
||||
$singular_sidebar = array(
|
||||
array(
|
||||
'value' => 'default',
|
||||
'label' => esc_html__( 'Default', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'right',
|
||||
'label' => esc_html__( 'Right Sidebar', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'left',
|
||||
'label' => esc_html__( 'Left Sidebar', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'disabled',
|
||||
'label' => esc_html__( 'No Sidebar', 'revision' ),
|
||||
),
|
||||
);
|
||||
|
||||
$page_header_type = array();
|
||||
$page_load_nextpost = array();
|
||||
|
||||
if ( 'post' === $post->post_type || 'page' === $post->post_type ) {
|
||||
$page_header_type = array(
|
||||
array(
|
||||
'value' => 'default',
|
||||
'label' => esc_html__( 'Default', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'standard',
|
||||
'label' => esc_html__( 'Standard', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'split',
|
||||
'label' => esc_html__( 'Split', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'overlay',
|
||||
'label' => esc_html__( 'Overlay', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'title',
|
||||
'label' => esc_html__( 'Page Title Only', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'none',
|
||||
'label' => esc_html__( 'None', 'revision' ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( 'post' === $post->post_type ) {
|
||||
$page_load_nextpost = array(
|
||||
array(
|
||||
'value' => 'default',
|
||||
'label' => esc_html__( 'Default', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'enabled',
|
||||
'label' => esc_html__( 'Enabled', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'value' => 'disabled',
|
||||
'label' => esc_html__( 'Disabled', 'revision' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$panels_data = array(
|
||||
'postType' => $post->post_type,
|
||||
'singularSidebar' => $singular_sidebar,
|
||||
'pageHeaderType' => $page_header_type,
|
||||
'pageLoadNextpost' => apply_filters( 'csco_editor_page_load_nextpost', $page_load_nextpost ),
|
||||
);
|
||||
|
||||
// Enqueue scripts.
|
||||
wp_enqueue_script(
|
||||
'csco-editor-panels',
|
||||
get_template_directory_uri() . '/assets/jsx/panels.js',
|
||||
array(
|
||||
'wp-i18n',
|
||||
'wp-blocks',
|
||||
'wp-edit-post',
|
||||
'wp-element',
|
||||
'wp-editor',
|
||||
'wp-components',
|
||||
'wp-data',
|
||||
'wp-plugins',
|
||||
'wp-edit-post',
|
||||
'wp-hooks',
|
||||
),
|
||||
csco_get_theme_data( 'Version' ),
|
||||
true
|
||||
);
|
||||
|
||||
// Localize scripts.
|
||||
wp_localize_script(
|
||||
'csco-editor-panels',
|
||||
'csPanelsData',
|
||||
apply_filters( 'csco_panels_data', $panels_data, $post )
|
||||
);
|
||||
}
|
||||
add_action( 'enqueue_block_editor_assets', 'csco_gutenberg_panels_assets' );
|
||||
315
inc/load-more.php
Normal file
315
inc/load-more.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* Load More Posts via AJAX.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Processing data query for load more
|
||||
*
|
||||
* @param string $method Processing method $wp_query.
|
||||
* @param array $data Data array.
|
||||
*/
|
||||
function csco_load_more_query_data( $method = 'get', $data = array() ) {
|
||||
global $wp_query;
|
||||
|
||||
$output = array();
|
||||
|
||||
$vars = array(
|
||||
'in_the_loop',
|
||||
'is_single',
|
||||
'is_page',
|
||||
'is_archive',
|
||||
'is_author',
|
||||
'is_category',
|
||||
'is_tag',
|
||||
'is_tax',
|
||||
'is_home',
|
||||
'is_singular',
|
||||
'is_post_query',
|
||||
);
|
||||
|
||||
if ( 'get' === $method ) {
|
||||
$output = $data;
|
||||
}
|
||||
|
||||
foreach ( $vars as $variable ) {
|
||||
if ( ! isset( $wp_query->$variable ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'get' === $method ) {
|
||||
$output[ $variable ] = $wp_query->$variable;
|
||||
}
|
||||
if ( ! isset( $data[ $variable ] ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'init' === $method ) {
|
||||
$wp_query->$variable = $data[ $variable ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'get' === $method ) {
|
||||
/**
|
||||
* The ajax_query_args hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$output = apply_filters( 'ajax_query_args', $output );
|
||||
}
|
||||
|
||||
return wp_json_encode( $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get load more args.
|
||||
*
|
||||
* @param array $data The data.
|
||||
* @param array $options The options.
|
||||
*/
|
||||
function csco_get_load_more_args( $data, $options = false ) {
|
||||
// Ajax Type.
|
||||
$ajax_type = version_compare( get_bloginfo( 'version' ), '4.7', '>=' ) ? 'ajax_restapi' : 'ajax';
|
||||
|
||||
/**
|
||||
* The ajax_load_more_method hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$ajax_type = apply_filters( 'ajax_load_more_method', $ajax_type );
|
||||
|
||||
$args = array(
|
||||
'type' => $ajax_type,
|
||||
'nonce' => wp_create_nonce(),
|
||||
'url' => admin_url( 'admin-ajax.php' ),
|
||||
'rest_url' => esc_url( get_rest_url( null, '/csco/v1/more-posts' ) ),
|
||||
'posts_per_page' => get_query_var( 'posts_per_page' ), // phpcs:ignore.
|
||||
'query_data' => csco_load_more_query_data( 'get', $data ),
|
||||
'options' => wp_json_encode( $options ),
|
||||
'infinite_load' => $data['infinite_load'] ? 'true' : 'false',
|
||||
'translation' => array(
|
||||
'load_more' => esc_html__( 'Load More', 'revision' ),
|
||||
'loading' => esc_html__( 'Loading ...', 'revision' ),
|
||||
),
|
||||
'current_lang' => csco_get_current_language(),
|
||||
'current_locale' => get_locale(),
|
||||
);
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Localize the main theme scripts.
|
||||
*/
|
||||
function csco_load_more_js() {
|
||||
global $wp_query;
|
||||
|
||||
$paged = get_query_var( 'paged' );
|
||||
|
||||
if ( $wp_query->max_num_pages <= 1 || $paged > 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pagination_type = get_theme_mod( csco_get_archive_option( 'pagination_type' ), 'standard' );
|
||||
|
||||
if ( 'load-more' === $pagination_type || 'infinite' === $pagination_type ) {
|
||||
|
||||
// Pagination type.
|
||||
$wp_query->infinite = 'infinite' === $pagination_type ? true : false;
|
||||
|
||||
$query_vars = $wp_query->query_vars;
|
||||
|
||||
if ( is_home() && ( ! isset( $query_vars['post_type'] ) || ! $query_vars['post_type'] ) ) {
|
||||
$query_vars['post_type'] = 'post';
|
||||
}
|
||||
|
||||
// Theme data.
|
||||
$data = array(
|
||||
'first_post_count' => $wp_query->post_count,
|
||||
'infinite_load' => $wp_query->infinite,
|
||||
'query_vars' => $query_vars,
|
||||
);
|
||||
|
||||
$args = csco_get_load_more_args( $data, csco_get_archive_options() );
|
||||
|
||||
wp_localize_script( 'csco-scripts', 'csco_ajax_pagination', $args );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'csco_load_more_js', 100 );
|
||||
|
||||
/**
|
||||
* Get More Posts
|
||||
*/
|
||||
function csco_load_more_posts() {
|
||||
|
||||
$posts_end = false;
|
||||
|
||||
// Response default.
|
||||
$response = array(
|
||||
'page' => 2,
|
||||
'posts_per_page' => 10,
|
||||
);
|
||||
|
||||
if ( wp_doing_ajax() ) {
|
||||
check_ajax_referer();
|
||||
}
|
||||
|
||||
csco_set_ajax_lang();
|
||||
csco_set_ajax_locale();
|
||||
|
||||
// Set response values of ajax query.
|
||||
if ( isset( $_POST['page'] ) && sanitize_key( $_POST['page'] ) ) {
|
||||
$response['page'] = sanitize_key( $_POST['page'] );
|
||||
}
|
||||
if ( isset( $_POST['posts_per_page'] ) && sanitize_key( $_POST['posts_per_page'] ) ) {
|
||||
$response['posts_per_page'] = sanitize_key( $_POST['posts_per_page'] ); // phpcs:ignore.
|
||||
}
|
||||
if ( isset( $_POST['query_data'] ) && sanitize_text_field( $_POST['query_data'] ) ) {
|
||||
$response['query_data'] = sanitize_text_field( $_POST['query_data'] );
|
||||
}
|
||||
if ( isset( $_POST['options'] ) && sanitize_text_field( $_POST['options'] ) ) {
|
||||
$response['options'] = json_decode( stripslashes( sanitize_text_field( $_POST['options'] ) ), true );
|
||||
}
|
||||
|
||||
// Init Data.
|
||||
$query_data = json_decode( stripslashes( $response['query_data'] ), true );
|
||||
|
||||
// Set Query Vars.
|
||||
$query_vars = array_merge(
|
||||
(array) $query_data['query_vars'],
|
||||
array(
|
||||
'is_post_query' => true,
|
||||
'paged' => (int) $response['page'],
|
||||
'posts_per_page' => (int) $response['posts_per_page'],
|
||||
)
|
||||
);
|
||||
|
||||
// Suppress filtering for wp authors.
|
||||
if ( $query_data['is_author'] && $query_vars['author'] ) {
|
||||
$query_vars['suppress_filters'] = true;
|
||||
}
|
||||
|
||||
// Output only publish entries.
|
||||
$query_vars['post_status'] = 'publish';
|
||||
|
||||
// Get Posts.
|
||||
$the_query = new WP_Query( $query_vars );
|
||||
|
||||
$global_name = 'wp_query';
|
||||
|
||||
$GLOBALS[ $global_name ] = $the_query;
|
||||
|
||||
csco_load_more_query_data( 'init', $query_data );
|
||||
|
||||
if ( $the_query->have_posts() ) {
|
||||
|
||||
// Set query vars, so that we can get them across all templates.
|
||||
set_query_var( 'csco_query', $query_data );
|
||||
|
||||
// Get total number of posts.
|
||||
$total = $the_query->post_count;
|
||||
|
||||
// Get options.
|
||||
$options = $response['options'];
|
||||
|
||||
ob_start();
|
||||
|
||||
while ( $the_query->have_posts() ) {
|
||||
$the_query->the_post();
|
||||
|
||||
// Start counting posts.
|
||||
$current = $the_query->current_post + 1 + $query_vars['posts_per_page'] * $query_vars['paged'] - $query_vars['posts_per_page'];
|
||||
|
||||
// Check End of posts.
|
||||
if ( $the_query->found_posts - $current <= 0 ) {
|
||||
$posts_end = true;
|
||||
}
|
||||
|
||||
set_query_var( 'options', $options );
|
||||
|
||||
if ( isset( $options['layout'] ) && 'full' === $options['layout'] ) {
|
||||
|
||||
get_template_part( 'template-parts/archive/content-full' );
|
||||
|
||||
} elseif ( 'overlay' === $options['layout'] ) {
|
||||
|
||||
get_template_part( 'template-parts/archive/entry-overlay' );
|
||||
|
||||
} else {
|
||||
|
||||
get_template_part( 'template-parts/archive/entry' );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
if ( ! $content ) {
|
||||
$posts_end = true;
|
||||
}
|
||||
|
||||
// Return Result.
|
||||
$result = array(
|
||||
'posts_end' => $posts_end,
|
||||
'content' => $content,
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX Load More
|
||||
*/
|
||||
function csco_ajax_load_more() {
|
||||
|
||||
// Check Nonce.
|
||||
check_ajax_referer();
|
||||
|
||||
// Get Posts.
|
||||
$data = csco_load_more_posts();
|
||||
|
||||
// Return Result.
|
||||
wp_send_json_success( $data );
|
||||
}
|
||||
add_action( 'wp_ajax_csco_ajax_load_more', 'csco_ajax_load_more' );
|
||||
add_action( 'wp_ajax_nopriv_csco_ajax_load_more', 'csco_ajax_load_more' );
|
||||
|
||||
/**
|
||||
* More Posts API Response
|
||||
*
|
||||
* @param array $request REST API Request.
|
||||
*/
|
||||
function csco_more_posts_restapi( $request ) {
|
||||
|
||||
// Get Data.
|
||||
$data = array(
|
||||
'success' => true,
|
||||
'data' => csco_load_more_posts(),
|
||||
);
|
||||
|
||||
// Return Result.
|
||||
return rest_ensure_response( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register REST More Posts Routes
|
||||
*/
|
||||
function csco_register_more_posts_route() {
|
||||
|
||||
register_rest_route(
|
||||
'csco/v1',
|
||||
'/more-posts',
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
'callback' => 'csco_more_posts_restapi',
|
||||
'permission_callback' => function () {
|
||||
return true;
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'rest_api_init', 'csco_register_more_posts_route' );
|
||||
318
inc/load-nextpost.php
Normal file
318
inc/load-nextpost.php
Normal file
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
/**
|
||||
* Load Load Next Post via AJAX.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve next post that is adjacent to current post.
|
||||
*/
|
||||
function csco_nextpost_get_id() {
|
||||
global $post;
|
||||
|
||||
$next_post = null;
|
||||
|
||||
// Default arguments.
|
||||
$args = array(
|
||||
'fields' => 'ids',
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'ASC',
|
||||
'date_query' => array(
|
||||
'after' => get_the_time( 'Y-m-d H:i:s', get_queried_object_id() ),
|
||||
),
|
||||
'post__not_in' => array( get_queried_object_id() ),
|
||||
'ignore_sticky_posts' => true,
|
||||
);
|
||||
|
||||
if ( get_theme_mod( 'post_load_nextpost_reverse', false ) ) {
|
||||
$args['order'] = 'DESC';
|
||||
$args['date_query'] = array(
|
||||
'before' => get_the_time( 'Y-m-d H:i:s', get_queried_object_id() ),
|
||||
);
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'post_load_nextpost_same_category', false ) ) {
|
||||
$terms = wp_get_post_terms( $post->ID, 'category', array( 'fields' => 'ids' ) );
|
||||
if ( ! empty( $terms ) ) {
|
||||
$args['tax_query'] = array(
|
||||
array(
|
||||
'taxonomy' => 'category',
|
||||
'field' => 'term_id',
|
||||
'terms' => $terms,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Run custom query.
|
||||
$query = new WP_Query( $args );
|
||||
|
||||
if ( $query->have_posts() ) {
|
||||
$next_post = array_shift( $query->posts );
|
||||
}
|
||||
|
||||
wp_reset_postdata();
|
||||
|
||||
return $next_post;
|
||||
}
|
||||
|
||||
/**
|
||||
* Localize the main theme scripts.
|
||||
*/
|
||||
function csco_nextpost_more_js() {
|
||||
if ( ! csco_get_state_load_nextpost() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! is_singular( 'post' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$ajax_type = version_compare( get_bloginfo( 'version' ), '4.7', '>=' ) ? 'ajax_restapi' : 'ajax';
|
||||
$ajax_type = apply_filters( 'ajax_load_nextpost_method', $ajax_type );
|
||||
|
||||
$localize = array(
|
||||
'type' => $ajax_type,
|
||||
'not_in' => (array) get_queried_object_id(),
|
||||
'next_post' => csco_nextpost_get_id(),
|
||||
'current_user' => get_current_user_id(),
|
||||
'nonce' => wp_create_nonce( 'csco-load-nextpost-nonce' ),
|
||||
'rest_url' => esc_url( get_rest_url( null, '/csco/v1/more-nextpost' ) ),
|
||||
'url' => admin_url( 'admin-ajax.php' ),
|
||||
'current_lang' => csco_get_current_language(),
|
||||
'current_locale' => get_locale(),
|
||||
);
|
||||
|
||||
wp_localize_script( 'csco-scripts', 'csco_ajax_nextpost', $localize );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'csco_nextpost_more_js', 99 );
|
||||
|
||||
/**
|
||||
* Get More Post
|
||||
*/
|
||||
function csco_load_nextpost() {
|
||||
global $csco_related_not_in;
|
||||
global $wp_query;
|
||||
global $post;
|
||||
global $more;
|
||||
|
||||
// Check Nonce.
|
||||
wp_verify_nonce( null );
|
||||
|
||||
csco_set_ajax_lang();
|
||||
csco_set_ajax_locale();
|
||||
|
||||
$not_in = array();
|
||||
$next_post = null;
|
||||
|
||||
if ( isset( $_POST['not_in'] ) ) { // Input var ok.
|
||||
$not_in = (array) wp_unslash( $_POST['not_in'] ); // Input var ok.
|
||||
}
|
||||
|
||||
if ( isset( $_POST['next_post'] ) ) { // Input var ok.
|
||||
$post_id = (int) $_POST['next_post']; // Input var ok.
|
||||
}
|
||||
|
||||
if ( isset( $_POST['current_user'] ) ) { // Input var ok.
|
||||
wp_set_current_user( (int) $_POST['current_user'] ); // Input var ok.
|
||||
}
|
||||
|
||||
// Get Post.
|
||||
ob_start();
|
||||
|
||||
if ( isset( $post_id ) ) {
|
||||
|
||||
// Add post id for filter.
|
||||
array_push( $not_in, (string) $post_id );
|
||||
|
||||
// Set global filter.
|
||||
$csco_related_not_in = $not_in;
|
||||
|
||||
// Query Args.
|
||||
$args = array(
|
||||
'p' => $post_id,
|
||||
);
|
||||
|
||||
$query = new WP_Query( $args );
|
||||
|
||||
if ( $query->have_posts() ) :
|
||||
|
||||
while ( $query->have_posts() ) :
|
||||
$query->the_post();
|
||||
|
||||
// Set wp_query data.
|
||||
$wp_query = $query;
|
||||
$wp_query->is_single = true;
|
||||
$wp_query->is_singular = true;
|
||||
|
||||
// Set global more.
|
||||
$more = 1;
|
||||
?>
|
||||
<div class="cs-nextpost-section" data-title="<?php the_title_attribute(); ?>"
|
||||
data-url="<?php echo esc_url( get_permalink() ); ?>">
|
||||
|
||||
<?php do_action( 'csco_load_nextpost_before' ); ?>
|
||||
|
||||
<div <?php csco_site_content_class(); ?>>
|
||||
|
||||
<?php do_action( 'csco_site_content_start' ); ?>
|
||||
|
||||
<div class="cs-container">
|
||||
|
||||
<?php do_action( 'csco_main_content_before' ); ?>
|
||||
|
||||
<div id="content" class="cs-main-content">
|
||||
|
||||
<?php do_action( 'csco_main_content_start' ); ?>
|
||||
|
||||
<div id="primary" class="cs-content-area">
|
||||
|
||||
<?php do_action( 'csco_main_before' ); ?>
|
||||
|
||||
<?php
|
||||
// Single before hook.
|
||||
do_action( 'csco_post_before' );
|
||||
|
||||
// Include singular template.
|
||||
get_template_part( 'template-parts/content-singular' );
|
||||
|
||||
// Single after hook.
|
||||
do_action( 'csco_post_after' );
|
||||
|
||||
// Set next post.
|
||||
$next_post = csco_nextpost_get_id();
|
||||
?>
|
||||
|
||||
<?php do_action( 'csco_main_after' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action( 'csco_main_content_after' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action( 'csco_site_content_end' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php do_action( 'csco_load_nextpost_after' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
endwhile;
|
||||
|
||||
endif;
|
||||
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
$content = ob_get_clean();
|
||||
|
||||
if ( ! $content ) {
|
||||
$next_post = null;
|
||||
}
|
||||
|
||||
// Return Result.
|
||||
$result = array(
|
||||
'not_in' => $not_in,
|
||||
'next_post' => $next_post,
|
||||
'content' => $content,
|
||||
'title' => get_the_title(),
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX Load Nextpost
|
||||
*/
|
||||
function csco_ajax_load_nextpost() {
|
||||
|
||||
// Check Nonce.
|
||||
check_ajax_referer( 'csco-load-nextpost-nonce', 'nonce' );
|
||||
|
||||
// Get Post.
|
||||
$data = csco_load_nextpost();
|
||||
|
||||
// Return Result.
|
||||
wp_send_json_success( $data );
|
||||
}
|
||||
add_action( 'wp_ajax_csco_ajax_load_nextpost', 'csco_ajax_load_nextpost' );
|
||||
add_action( 'wp_ajax_nopriv_csco_ajax_load_nextpost', 'csco_ajax_load_nextpost' );
|
||||
|
||||
/**
|
||||
* Nextpost API Response
|
||||
*
|
||||
* @param array $request REST API Request.
|
||||
*/
|
||||
function csco_load_nextpost_restapi( $request ) {
|
||||
|
||||
$params = $request->get_params();
|
||||
|
||||
// Get Data.
|
||||
$data = array(
|
||||
'success' => true,
|
||||
'data' => csco_load_nextpost(),
|
||||
);
|
||||
|
||||
// Return Result.
|
||||
return rest_ensure_response( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register REST Nextpost Routes
|
||||
*/
|
||||
function csco_register_nextpost_route() {
|
||||
|
||||
register_rest_route(
|
||||
'csco/v1',
|
||||
'/more-nextpost',
|
||||
array(
|
||||
'methods' => WP_REST_Server::CREATABLE,
|
||||
'callback' => 'csco_load_nextpost_restapi',
|
||||
'permission_callback' => function () {
|
||||
return true;
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'rest_api_init', 'csco_register_nextpost_route' );
|
||||
|
||||
/**
|
||||
* Filter all auto load posts from related.
|
||||
*
|
||||
* @param object $data The query.
|
||||
*/
|
||||
function csco_nextpost_filter_related( $data ) {
|
||||
global $csco_related_not_in;
|
||||
|
||||
if ( ! is_single() ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ( isset( $data->query_vars['query_type'] ) && 'related' === $data->query_vars['query_type'] ) {
|
||||
// Exclude next post.
|
||||
if ( csco_get_state_load_nextpost() ) {
|
||||
$next_post = csco_nextpost_get_id();
|
||||
|
||||
$data->query_vars['post__not_in'][] = $next_post ? $next_post : false;
|
||||
}
|
||||
|
||||
// Exclude loaded posts.
|
||||
$data->query_vars['post__not_in'] = array_merge(
|
||||
(array) $data->query_vars['post__not_in'],
|
||||
(array) $csco_related_not_in
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
add_action( 'pre_get_posts', 'csco_nextpost_filter_related' );
|
||||
370
inc/partials.php
Normal file
370
inc/partials.php
Normal file
@@ -0,0 +1,370 @@
|
||||
<?php
|
||||
/**
|
||||
* These functions are used to load template parts (partials) or actions when used within action hooks,
|
||||
* and they probably should never be updated or modified.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_singular_post_type_before' ) ) {
|
||||
/**
|
||||
* Add Before Singular Hooks for specific post type.
|
||||
*/
|
||||
function csco_singular_post_type_before() {
|
||||
if ( 'post' === get_post_type() ) {
|
||||
/**
|
||||
* The csco_post_content_before hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_post_content_before' );
|
||||
}
|
||||
if ( 'page' === get_post_type() ) {
|
||||
/**
|
||||
* The csco_page_content_before hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_page_content_before' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_singular_post_type_after' ) ) {
|
||||
/**
|
||||
* Add After Singular Hooks for specific post type.
|
||||
*/
|
||||
function csco_singular_post_type_after() {
|
||||
if ( 'post' === get_post_type() ) {
|
||||
/**
|
||||
* The csco_post_content_after hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_post_content_after' );
|
||||
}
|
||||
if ( 'page' === get_post_type() ) {
|
||||
/**
|
||||
* The csco_page_content_after hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_page_content_after' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_home_hero_standard' ) ) {
|
||||
/**
|
||||
* Home Hero Type 1, Type 2.
|
||||
*/
|
||||
function csco_home_hero_standard() {
|
||||
if ( is_home() && get_theme_mod( 'home_hero', false ) && (
|
||||
'hero-type-1' === get_theme_mod( 'home_hero_layout', 'hero-type-1' ) ||
|
||||
'hero-type-2' === get_theme_mod( 'home_hero_layout', 'hero-type-1' )
|
||||
) ) {
|
||||
get_template_part( 'template-parts/hero' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_home_hero_fullwidth' ) ) {
|
||||
/**
|
||||
* Home Hero Type 2.
|
||||
*/
|
||||
function csco_home_hero_fullwidth() {
|
||||
if ( is_home() && get_theme_mod( 'home_hero', false ) && (
|
||||
'hero-type-3' === get_theme_mod( 'home_hero_layout', 'hero-type-1' )
|
||||
) ) {
|
||||
get_template_part( 'template-parts/hero' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_offcanvas' ) ) {
|
||||
/**
|
||||
* Off-canvas
|
||||
*/
|
||||
function csco_offcanvas() {
|
||||
get_template_part( 'template-parts/offcanvas' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_site_scheme' ) ) {
|
||||
/**
|
||||
* Site Scheme
|
||||
*/
|
||||
function csco_site_scheme() {
|
||||
$site_scheme = csco_site_scheme_data();
|
||||
|
||||
if ( ! $site_scheme ) {
|
||||
return;
|
||||
}
|
||||
|
||||
call_user_func( 'printf', '%s', "data-scheme='{$site_scheme}'" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_site_search' ) ) {
|
||||
/**
|
||||
* Site Search
|
||||
*/
|
||||
function csco_site_search() {
|
||||
if ( ! get_theme_mod( 'header_search_button', true ) ) {
|
||||
return;
|
||||
}
|
||||
get_template_part( 'template-parts/site-search' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_site_nav_mobile' ) ) {
|
||||
/**
|
||||
* Site Nav Mobile
|
||||
*/
|
||||
function csco_site_nav_mobile() {
|
||||
get_template_part( 'template-parts/site-nav-mobile' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_theme_breadcrumbs' ) ) {
|
||||
/**
|
||||
* Theme Breadcrumbs
|
||||
*/
|
||||
function csco_theme_breadcrumbs() {
|
||||
|
||||
$header_type = csco_get_page_header_type();
|
||||
|
||||
/**
|
||||
* The csco_theme_breadcrumbs hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
if ( ! apply_filters( 'csco_theme_breadcrumbs', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_front_page() || is_404() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! is_user_logged_in() && function_exists( 'is_account_page' ) && is_account_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
csco_breadcrumbs();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_page_header' ) ) {
|
||||
/**
|
||||
* Page Header
|
||||
*/
|
||||
function csco_page_header() {
|
||||
if ( ! ( is_home() || is_archive() || is_search() || is_404() ) ) {
|
||||
return;
|
||||
}
|
||||
get_template_part( 'template-parts/page-header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_page_pagination' ) ) {
|
||||
/**
|
||||
* Post Pagination
|
||||
*/
|
||||
function csco_page_pagination() {
|
||||
if ( ! is_singular() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* The csco_pagination_before hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_pagination_before' );
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="navigation pagination posts-navigation"><div class="nav-links">',
|
||||
'after' => '</div></div>',
|
||||
'link_before' => '<span class="page-number">',
|
||||
'link_after' => '</span>',
|
||||
'next_or_number' => 'number',
|
||||
'separator' => ' ',
|
||||
'nextpagelink' => esc_html__( 'Next page', 'revision' ),
|
||||
'previouspagelink' => esc_html__( 'Previous page', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The csco_pagination_after hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'csco_pagination_after' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_breadcrumbs' ) ) {
|
||||
/**
|
||||
* Entry Breadcrumbs
|
||||
*/
|
||||
function csco_entry_breadcrumbs() {
|
||||
csco_breadcrumbs();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_header' ) ) {
|
||||
/**
|
||||
* Entry Header Simple and Standard
|
||||
*/
|
||||
function csco_entry_header() {
|
||||
if ( ! is_singular() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'none' === csco_get_page_header_type() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'template-parts/entry/entry-header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_media' ) ) {
|
||||
/**
|
||||
* Entry Media
|
||||
*/
|
||||
function csco_entry_media() {
|
||||
if ( ! is_singular() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'none' === csco_get_page_header_type() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'template-parts/entry/entry-media' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_tags' ) ) {
|
||||
/**
|
||||
* Entry Tags
|
||||
*/
|
||||
function csco_entry_tags() {
|
||||
if ( ! is_singular( 'post' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( false === get_theme_mod( 'post_tags', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
the_tags( '<div class="cs-entry__tags"><ul><li>', '</li><li>', '</li></ul></div>' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_footer' ) ) {
|
||||
/**
|
||||
* Entry Footer
|
||||
*/
|
||||
function csco_entry_footer() {
|
||||
if ( ! is_singular( 'post' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( false === get_theme_mod( 'post_footer', true ) ) {
|
||||
return;
|
||||
}
|
||||
get_template_part( 'template-parts/entry/entry-footer' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_comments' ) ) {
|
||||
/**
|
||||
* Entry Comments
|
||||
*/
|
||||
function csco_entry_comments() {
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( comments_open() || get_comments_number() ) {
|
||||
comments_template();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_read_next' ) ) {
|
||||
/**
|
||||
* Entry Read Next
|
||||
*/
|
||||
function csco_entry_read_next() {
|
||||
if ( ! is_singular( 'post' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( false === get_theme_mod( 'post_read_next', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'template-parts/entry/entry-read-next' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_prev_next' ) ) {
|
||||
/**
|
||||
* Entry Prev Next
|
||||
*/
|
||||
function csco_entry_prev_next() {
|
||||
if ( ! is_singular( 'post' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( false === get_theme_mod( 'post_prev_next', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'template-parts/entry/entry-prev-next' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_entry_metabar' ) ) {
|
||||
/**
|
||||
* Entry Metabar
|
||||
*/
|
||||
function csco_entry_metabar() {
|
||||
if ( ! is_singular( 'post' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( false === get_theme_mod( 'post_metabar', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="cs-entry__metabar">
|
||||
<div class="cs-entry__metabar-inner">
|
||||
<?php if ( get_theme_mod( 'post_reading_time', true ) ) { ?>
|
||||
<div class="cs-entry__metabar-item cs-entry__metabar-reading_time">
|
||||
<?php csco_component( 'single_get_meta_reading_time' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="cs-entry__metabar-item cs-entry__metabar-share">
|
||||
<?php csco_component( 'share_links' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_misc_social_links' ) ) {
|
||||
/**
|
||||
* Social Links
|
||||
*/
|
||||
function csco_misc_social_links() {
|
||||
|
||||
if ( false === get_theme_mod( 'misc_social_links', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'template-parts/social-links' );
|
||||
}
|
||||
}
|
||||
315
inc/post-meta.php
Normal file
315
inc/post-meta.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* Post Meta Helper Functions
|
||||
*
|
||||
* These helper functions return post meta, if its enabled in WordPress Customizer.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_get_post_meta' ) ) {
|
||||
/**
|
||||
* Post Meta
|
||||
*
|
||||
* A wrapper function that returns all post meta types either
|
||||
* in an ordered list <ul> or as a single element <span>.
|
||||
*
|
||||
* @param mixed $meta Contains post meta types.
|
||||
* @param bool $output Output or return.
|
||||
* @param mixed $allowed Allowed meta types (array: list types, true: auto definition, option name: get value of option).
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_get_post_meta( $meta, $output = true, $allowed = null, $settings = array() ) {
|
||||
|
||||
// Return if no post meta types provided.
|
||||
if ( ! $meta ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$meta = (array) $meta;
|
||||
|
||||
// Set default settings.
|
||||
$settings = array_merge(
|
||||
array(
|
||||
'category_type' => 'default',
|
||||
'author_avatar' => false,
|
||||
),
|
||||
$settings
|
||||
);
|
||||
|
||||
if ( is_string( $allowed ) || true === $allowed ) {
|
||||
$option_default = null;
|
||||
|
||||
$option_name = is_string( $allowed ) ? $allowed : csco_get_archive_option( 'post_meta' );
|
||||
|
||||
if ( isset( CSCO_Customizer::$fields[ $option_name ]['default'] ) ) {
|
||||
$option_default = CSCO_Customizer::$fields[ $option_name ]['default'];
|
||||
}
|
||||
|
||||
$allowed = get_theme_mod( $option_name, $option_default );
|
||||
}
|
||||
|
||||
// Set default allowed post meta types.
|
||||
if ( ! is_array( $allowed ) && ! $allowed ) {
|
||||
/**
|
||||
* The csco_post_meta hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$allowed = apply_filters( 'csco_post_meta', array( 'category', 'author', 'comments', 'date', 'reading_time' ) );
|
||||
}
|
||||
|
||||
// Intersect provided and allowed meta types.
|
||||
if ( is_array( $meta ) ) {
|
||||
$meta = array_intersect( $meta, $allowed );
|
||||
}
|
||||
|
||||
// Build meta markup.
|
||||
$markup = __return_null();
|
||||
|
||||
if ( is_array( $meta ) && $meta ) {
|
||||
|
||||
// Add normal meta types to the list.
|
||||
foreach ( $meta as $type ) {
|
||||
$markup .= call_user_func( "csco_get_meta_$type", 'div', $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
* The csco_post_meta_scheme hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$scheme = apply_filters( 'csco_post_meta_scheme', null, $settings );
|
||||
|
||||
$markup = sprintf( '<div class="cs-entry__post-meta" %s>%s</div>', $scheme, $markup );
|
||||
|
||||
} elseif ( in_array( $meta, $allowed, true ) ) {
|
||||
// Markup single meta type.
|
||||
$markup .= call_user_func( "csco_get_meta_$meta", 'div', $settings );
|
||||
}
|
||||
|
||||
// If output is enabled.
|
||||
if ( $output ) {
|
||||
return call_user_func( 'printf', '%s', $markup );
|
||||
}
|
||||
|
||||
return $markup;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_get_meta_category' ) ) {
|
||||
/**
|
||||
* Post Сategory
|
||||
*
|
||||
* @param string $tag Element tag, i.e. div or span.
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_get_meta_category( $tag = 'div', $settings = array() ) {
|
||||
|
||||
if ( 'line' === $settings['category_type'] ) {
|
||||
$output = '<' . esc_html( $tag ) . ' class="cs-entry__category">';
|
||||
} else {
|
||||
$output = '<' . esc_html( $tag ) . ' class="cs-meta-category">';
|
||||
}
|
||||
|
||||
$output .= get_the_category_list( '', '', get_the_ID() );
|
||||
|
||||
$output .= '</' . esc_html( $tag ) . '>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_get_meta_date' ) ) {
|
||||
/**
|
||||
* Post Date
|
||||
*
|
||||
* @param string $tag Element tag, i.e. div or span.
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_get_meta_date( $tag = 'div', $settings = array() ) {
|
||||
|
||||
$output = '<' . esc_html( $tag ) . ' class="cs-meta-date">';
|
||||
|
||||
$output .= '<span class="cs-meta-date-on">' . esc_html__( 'on', 'revision' ) . '</span>';
|
||||
|
||||
$time_string = get_the_date();
|
||||
|
||||
if ( get_the_time( 'd.m.Y H:i' ) !== get_the_modified_time( 'd.m.Y H:i' ) ) {
|
||||
if ( ! get_theme_mod( 'misc_published_date', true ) ) {
|
||||
$time_string = get_the_modified_date();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The csco_post_meta_date_output hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$output .= apply_filters( 'csco_post_meta_date_output', $time_string );
|
||||
|
||||
$output .= '</' . esc_html( $tag ) . '>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_get_meta_author' ) ) {
|
||||
/**
|
||||
* Post Author
|
||||
*
|
||||
* @param string $tag Element tag, i.e. div or span.
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_get_meta_author( $tag = 'div', $settings = array() ) {
|
||||
|
||||
$author_avatar = null;
|
||||
|
||||
if ( is_single() && isset( $settings['author_avatar'] ) && $settings['author_avatar'] ) {
|
||||
$author_avatar = get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'csco_meta_avatar_size', 36 ) );
|
||||
}
|
||||
|
||||
$output = '<' . esc_attr( $tag ) . ' class="cs-meta-author">';
|
||||
|
||||
$output .= '<a class="cs-meta-author-link url fn n" href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '">';
|
||||
|
||||
if ( isset( $author_avatar ) && null !== $author_avatar ) {
|
||||
$output .= '<picture class="cs-meta-author-avatar">' . $author_avatar . '</picture>';
|
||||
}
|
||||
|
||||
$output .= '<span class="cs-meta-author-name">' . get_the_author_meta( 'display_name', get_the_author_meta( 'ID' ) ) . '</span>';
|
||||
|
||||
$output .= '</a>';
|
||||
|
||||
$output .= '</' . esc_html( $tag ) . '>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_get_meta_comments' ) ) {
|
||||
/**
|
||||
* Post Comments
|
||||
*
|
||||
* @param string $tag Element tag, i.e. div or span.
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_get_meta_comments( $tag = 'div', $settings = array() ) {
|
||||
|
||||
if ( ! comments_open( get_the_ID() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<' . esc_html( $tag ) . ' class="cs-meta-comments">';
|
||||
|
||||
ob_start();
|
||||
comments_popup_link( '0', '1', '%', 'comments-link', '' );
|
||||
$output .= ob_get_clean();
|
||||
|
||||
$output .= '</' . esc_html( $tag ) . '>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_get_meta_views' ) ) {
|
||||
/**
|
||||
* Post Views
|
||||
*
|
||||
* @param string $tag Element tag, i.e. div or span.
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_get_meta_views( $tag = 'div', $settings = array() ) {
|
||||
|
||||
switch ( csco_post_views_enabled() ) {
|
||||
case 'post_views':
|
||||
$views = pvc_get_post_views();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't display if minimum threshold is not met.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
if ( $views < apply_filters( 'csco_minimum_views', 1 ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<' . esc_html( $tag ) . ' class="cs-meta-views">';
|
||||
$output .= '<span class="cs-meta-icon"><i class="cs-icon cs-icon-eye"></i></span>';
|
||||
|
||||
$views_rounded = csco_get_round_number( $views );
|
||||
|
||||
if ( $views > 1000 ) {
|
||||
$output .= $views_rounded . ' ' . esc_html__( 'views', 'revision' );
|
||||
} else {
|
||||
/* translators: %s number of post views */
|
||||
$output .= esc_html( sprintf( _n( '%s view', '%s views', $views, 'revision' ), $views ) );
|
||||
}
|
||||
|
||||
$output .= '</' . esc_html( $tag ) . '>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_get_meta_reading_time' ) ) {
|
||||
/**
|
||||
* Post Reading Time
|
||||
*
|
||||
* @param string $tag Element tag, i.e. div or span.
|
||||
* @param bool $compact If compact version shall be displayed.
|
||||
*/
|
||||
function csco_get_meta_reading_time( $tag = 'div', $compact = false ) {
|
||||
|
||||
$reading_time = csco_get_post_reading_time();
|
||||
|
||||
$output = '<' . esc_html( $tag ) . ' class="cs-meta-reading-time">';
|
||||
|
||||
if ( true === $compact ) {
|
||||
$output .= intval( $reading_time ) . ' ' . esc_html__( 'min', 'revision' );
|
||||
} else {
|
||||
/* translators: %s number of minutes */
|
||||
$output .= esc_html( sprintf( _n( '%s Min Read', '%s Min Read', $reading_time, 'revision' ), $reading_time ) );
|
||||
}
|
||||
|
||||
$output .= '</' . esc_html( $tag ) . '>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_single_get_meta_reading_time' ) ) {
|
||||
/**
|
||||
* Post Reading Time
|
||||
*/
|
||||
function csco_single_get_meta_reading_time() {
|
||||
|
||||
$reading_time = csco_get_post_reading_time();
|
||||
?>
|
||||
<div class="cs-reading-time-item">
|
||||
<div class="cs-post-reading-time">
|
||||
<span class="cs-post-reading-time__label">
|
||||
<?php
|
||||
/* translators: %s number of minutes */
|
||||
echo esc_html( sprintf( _n( '%s min read', '%s min read', $reading_time, 'revision' ), $reading_time ) );
|
||||
?>
|
||||
</span>
|
||||
<div class="cs-post-reading-time__border">
|
||||
<svg width="80" height="80" viewBox="0 0 80 80">
|
||||
<path d="M40,2 a38,38 0 0,1 0,76 a38,38 0 0,1 0,-76" style="stroke-width: 2; fill: none;"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="cs-post-reading-time__progress">
|
||||
<svg width="80" height="80" viewBox="0 0 80 80">
|
||||
<path d="M40,2 a38,38 0 0,1 0,76 a38,38 0 0,1 0,-76" style="stroke-width: 2; fill: none;"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
244
inc/theme-demos.php
Normal file
244
inc/theme-demos.php
Normal file
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
/**
|
||||
* Theme Demos
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register Demos of Theme
|
||||
*/
|
||||
function csco_demos_list() {
|
||||
|
||||
$plugins = array(
|
||||
array(
|
||||
'name' => 'Regenerate Thumbnails',
|
||||
'slug' => 'regenerate-thumbnails',
|
||||
'path' => 'regenerate-thumbnails/regenerate-thumbnails.php',
|
||||
'required' => false,
|
||||
'desc' => esc_html__( 'Regenerate the thumbnails for one or more of your image uploads. Useful when changing their sizes or your theme.', 'revision' ),
|
||||
),
|
||||
array(
|
||||
'name' => 'Contact Form 7',
|
||||
'slug' => 'contact-form-7',
|
||||
'path' => 'contact-form-7/wp-contact-form-7.php',
|
||||
'required' => false,
|
||||
'desc' => esc_html__( 'Just another contact form plugin. Simple but flexible.', 'revision' ),
|
||||
),
|
||||
);
|
||||
|
||||
$demos = array(
|
||||
'classic-list' => array(
|
||||
'name' => esc_html__( 'Classic List', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/classic-list-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/classic-list-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'classic-grid' => array(
|
||||
'name' => esc_html__( 'Classic Grid', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=2',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/classic-grid-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/classic-grid-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'classic-overlay' => array(
|
||||
'name' => esc_html__( 'Classic Overlay', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=3',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/classic-overlay-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/classic-overlay-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'hero-slider' => array(
|
||||
'name' => esc_html__( 'Hero Slider', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=4',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/hero-slider-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/hero-slider-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'featured-posts' => array(
|
||||
'name' => esc_html__( 'Featured Posts', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=5',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/featured-posts-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/featured-posts-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'full-list' => array(
|
||||
'name' => esc_html__( 'Full List', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=6',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/full-list-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/full-list-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'full-grid' => array(
|
||||
'name' => esc_html__( 'Full Grid', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=7',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/full-grid-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/full-grid-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'full-overlay' => array(
|
||||
'name' => esc_html__( 'Full Overlay', 'revision' ),
|
||||
'preview' => 'https://revision.codesupply.co/revision/?homepage=8',
|
||||
'thumbnail' => get_template_directory_uri() . '/import/full-overlay-thumbnail.jpg',
|
||||
'plugins' => $plugins,
|
||||
'import' => array(
|
||||
'customizer' => 'https://cloud.codesupply.co/import/revision/full-overlay-customizer.dat',
|
||||
'widgets' => 'https://cloud.codesupply.co/import/revision/widgets.wie',
|
||||
'content' => array(
|
||||
array(
|
||||
'label' => esc_html__( 'Demo Content', 'revision' ),
|
||||
'url' => 'https://cloud.codesupply.co/import/revision/content.xml',
|
||||
'desc' => esc_html__( 'Enabling this option will import demo posts, categories, and secondary pages. It\'s recommended to disable this option for existing', 'revision' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return $demos;
|
||||
}
|
||||
add_filter( 'csco_register_demos_list', 'csco_demos_list' );
|
||||
|
||||
/**
|
||||
* Set terms and import associated images for each category.
|
||||
*
|
||||
* This function loops through all categories, checks for associated images (logos and icons),
|
||||
* and imports and assigns them to the corresponding taxonomy meta fields.
|
||||
*/
|
||||
function csco_import_terms_images_for_categories() {
|
||||
|
||||
$categories = get_terms( array(
|
||||
'taxonomy' => 'category',
|
||||
'hide_empty' => false,
|
||||
) );
|
||||
|
||||
$fields = array(
|
||||
'csco_category_logo' => '_csco_category_logo',
|
||||
'csco_category_icon' => '_csco_category_icon',
|
||||
);
|
||||
|
||||
foreach ( $categories as $category ) {
|
||||
|
||||
foreach ( $fields as $meta_key_id => $meta_key_url ) {
|
||||
|
||||
$meta_val = get_term_meta( $category->term_id, $meta_key_url, true );
|
||||
|
||||
if ( $meta_val && CSCO_Manager_Import::is_image_url( $meta_val ) ) {
|
||||
$data = CSCO_Manager_Import::import_custom_image( $meta_val );
|
||||
|
||||
if ( ! is_wp_error( $data ) ) {
|
||||
update_term_meta( $category->term_id, $meta_key_id, $data->attachment_id );
|
||||
update_term_meta( $category->term_id, $meta_key_url, $data->url );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish Import
|
||||
*/
|
||||
function csco_hook_finish_import() {
|
||||
|
||||
/* Set menu locations. */
|
||||
$nav_menu_locations = array();
|
||||
|
||||
$main_menu = get_term_by( 'name', 'Primary', 'nav_menu' );
|
||||
if ( $main_menu ) {
|
||||
$nav_menu_locations['primary'] = $main_menu->term_id;
|
||||
}
|
||||
|
||||
$offcanvas_menu = get_term_by( 'name', 'Mobile', 'nav_menu' );
|
||||
if ( $mobile_menu ) {
|
||||
$nav_menu_locations['mobile'] = $mobile_menu->term_id;
|
||||
}
|
||||
|
||||
$footer_menu = get_term_by( 'name', 'Footer', 'nav_menu' );
|
||||
if ( $footer_menu ) {
|
||||
$nav_menu_locations['footer'] = $footer_menu->term_id;
|
||||
}
|
||||
|
||||
if ( $nav_menu_locations ) {
|
||||
set_theme_mod( 'nav_menu_locations', $nav_menu_locations );
|
||||
}
|
||||
|
||||
// Call the function directly wherever needed.
|
||||
if ( ! get_option( 'once_finished_import' ) ) {
|
||||
csco_import_terms_images_for_categories();
|
||||
}
|
||||
|
||||
/* Add items to main menu */
|
||||
update_option( 'once_finished_import', true );
|
||||
}
|
||||
add_action( 'csco_finish_import', 'csco_hook_finish_import' );
|
||||
1797
inc/theme-functions.php
Normal file
1797
inc/theme-functions.php
Normal file
File diff suppressed because one or more lines are too long
63
inc/theme-mods.php
Normal file
63
inc/theme-mods.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Theme mods
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register Theme Mods
|
||||
*/
|
||||
function csco_register_theme_mods() {
|
||||
|
||||
/**
|
||||
* Site Identity.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/site-identity.php';
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/colors-settings.php';
|
||||
|
||||
/**
|
||||
* Typography.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/typography-settings.php';
|
||||
|
||||
/**
|
||||
* Header Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/header-settings.php';
|
||||
|
||||
/**
|
||||
* Footer Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/footer-settings.php';
|
||||
|
||||
/**
|
||||
* Homepage Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/homepage-settings.php';
|
||||
|
||||
/**
|
||||
* Archive Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/archive-settings.php';
|
||||
|
||||
/**
|
||||
* Posts Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/post-settings.php';
|
||||
|
||||
/**
|
||||
* Pages Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/page-settings.php';
|
||||
|
||||
/**
|
||||
* Miscellaneous Settings.
|
||||
*/
|
||||
require get_template_directory() . '/inc/theme-mods/miscellaneous-settings.php';
|
||||
}
|
||||
add_action( 'after_setup_theme', 'csco_register_theme_mods', 20 );
|
||||
1160
inc/theme-mods/archive-settings.php
Normal file
1160
inc/theme-mods/archive-settings.php
Normal file
File diff suppressed because it is too large
Load Diff
1181
inc/theme-mods/colors-settings.php
Normal file
1181
inc/theme-mods/colors-settings.php
Normal file
File diff suppressed because it is too large
Load Diff
38
inc/theme-mods/footer-settings.php
Normal file
38
inc/theme-mods/footer-settings.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Footer Settings
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'footer',
|
||||
array(
|
||||
'title' => esc_html__( 'Footer Settings', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'settings' => 'footer_text',
|
||||
'label' => esc_html__( 'Footer Text', 'revision' ),
|
||||
'section' => 'footer',
|
||||
'sanitize_callback' => function ( $val ) {
|
||||
return wp_kses( $val, 'content' );
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'settings' => 'footer_copyright',
|
||||
'label' => esc_html__( 'Footer Copyright', 'revision' ),
|
||||
'section' => 'footer',
|
||||
'default' => esc_html__( '© 2024 — Revision. All Rights Reserved.', 'revision' ),
|
||||
'sanitize_callback' => function ( $val ) {
|
||||
return wp_kses( $val, 'content' );
|
||||
},
|
||||
)
|
||||
);
|
||||
308
inc/theme-mods/header-settings.php
Normal file
308
inc/theme-mods/header-settings.php
Normal file
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
/**
|
||||
* Header Settings
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'header',
|
||||
array(
|
||||
'title' => esc_html__( 'Header Settings', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'header_collapsible_common',
|
||||
'section' => 'header',
|
||||
'label' => esc_html__( 'Common', 'revision' ),
|
||||
'input_attrs' => array(
|
||||
'collapsed' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'header_initial_height',
|
||||
'label' => esc_html__( 'Header Initial Height', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => '88px',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-header-initial-height',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'header_height',
|
||||
'label' => esc_html__( 'Header Height', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => '88px',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-header-height',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'header_border_width',
|
||||
'label' => esc_html__( 'Header Border Width', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => '0px',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-header-border-width',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'navbar_sticky',
|
||||
'label' => esc_html__( 'Make navigation bar sticky', 'revision' ),
|
||||
'description' => esc_html__( 'Enabling this option will make navigation bar visible when scrolling.', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'navbar_smart_sticky',
|
||||
'label' => esc_html__( 'Enable the smart sticky feature', 'revision' ),
|
||||
'description' => esc_html__( 'Enabling this option will reveal navigation bar when scrolling up and hide it when scrolling down.', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'navbar_sticky',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'header_offcanvas',
|
||||
'label' => esc_html__( 'Display offcanvas toggle button', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => false,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'header_navigation_menu',
|
||||
'label' => esc_html__( 'Display navigation menu', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'header_collapsible_search',
|
||||
'section' => 'header',
|
||||
'label' => esc_html__( 'Search', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'header_search_button',
|
||||
'label' => esc_html__( 'Display search button', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'header_search_show_categories',
|
||||
'label' => esc_html__( 'Display categories', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'header_search_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'settings' => 'header_search_heading',
|
||||
'label' => esc_html__( 'Heading', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => esc_html__( 'What are You Looking For?', 'revision' ),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'header_search_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'settings' => 'header_search_filter_categories',
|
||||
'label' => esc_html__( 'Categories', 'revision' ),
|
||||
'description' => esc_html__( 'Add comma-separated list of category slugs. For example: «travel, lifestyle, food». Leave empty for all categories.', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'header_search_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
array(
|
||||
'setting' => 'header_search_show_categories',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'number',
|
||||
'settings' => 'header_search_categories_limit',
|
||||
'label' => esc_html__( 'Limit', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => 4,
|
||||
'input_attrs' => array(
|
||||
'min' => 1,
|
||||
'max' => 99,
|
||||
'step' => 1,
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'header_search_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
array(
|
||||
'setting' => 'header_search_show_categories',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
array(
|
||||
'setting' => 'header_search_filter_categories',
|
||||
'operator' => '==',
|
||||
'value' => '',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'header_collapsible_custom_button',
|
||||
'section' => 'header',
|
||||
'label' => esc_html__( 'Custom Button', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'header_custom_button',
|
||||
'label' => esc_html__( 'Display custom button', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => false,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'settings' => 'header_custom_button_label',
|
||||
'label' => esc_html__( 'Button Label', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'header_custom_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'settings' => 'header_custom_button_link',
|
||||
'label' => esc_html__( 'Button Link', 'revision' ),
|
||||
'section' => 'header',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'header_custom_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'settings' => 'header_custom_button_target',
|
||||
'section' => 'header',
|
||||
'label' => esc_html__( 'Target', 'revision' ),
|
||||
'default' => '_self',
|
||||
'choices' => array(
|
||||
'_self' => esc_html__( 'In the active tab', 'revision' ),
|
||||
'_blank' => esc_html__( 'In a new tab', 'revision' ),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
array(
|
||||
'setting' => 'header_custom_button',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
1600
inc/theme-mods/homepage-settings.php
Normal file
1600
inc/theme-mods/homepage-settings.php
Normal file
File diff suppressed because it is too large
Load Diff
1261
inc/theme-mods/miscellaneous-settings.php
Normal file
1261
inc/theme-mods/miscellaneous-settings.php
Normal file
File diff suppressed because it is too large
Load Diff
68
inc/theme-mods/page-settings.php
Normal file
68
inc/theme-mods/page-settings.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Page Settings
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'page_settings',
|
||||
array(
|
||||
'title' => esc_html__( 'Page Settings', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'settings' => 'page_sidebar',
|
||||
'label' => esc_html__( 'Default Sidebar', 'revision' ),
|
||||
'section' => 'page_settings',
|
||||
'default' => 'disabled',
|
||||
'choices' => array(
|
||||
'right' => esc_html__( 'Right Sidebar', 'revision' ),
|
||||
'left' => esc_html__( 'Left Sidebar', 'revision' ),
|
||||
'disabled' => esc_html__( 'No Sidebar', 'revision' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'settings' => 'page_header_type',
|
||||
'label' => esc_html__( 'Page Header Type', 'revision' ),
|
||||
'section' => 'page_settings',
|
||||
'default' => 'standard',
|
||||
'choices' => array(
|
||||
'standard' => esc_html__( 'Standard', 'revision' ),
|
||||
'split' => esc_html__( 'Split', 'revision' ),
|
||||
'overlay' => esc_html__( 'Overlay', 'revision' ),
|
||||
'title' => esc_html__( 'Page Title Only', 'revision' ),
|
||||
'none' => esc_html__( 'None', 'revision' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'settings' => 'page_media_preview',
|
||||
'label' => esc_html__( 'Standard Page Header Preview', 'revision' ),
|
||||
'section' => 'page_settings',
|
||||
'default' => 'cropped',
|
||||
'choices' => array(
|
||||
'cropped' => esc_html__( 'Display Cropped Image', 'revision' ),
|
||||
'uncropped' => esc_html__( 'Display Preview in Original Ratio', 'revision' ),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
array(
|
||||
'setting' => 'page_header_type',
|
||||
'operator' => '==',
|
||||
'value' => 'standard',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
387
inc/theme-mods/post-settings.php
Normal file
387
inc/theme-mods/post-settings.php
Normal file
@@ -0,0 +1,387 @@
|
||||
<?php
|
||||
/**
|
||||
* Post Settings
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'post_settings',
|
||||
array(
|
||||
'title' => esc_html__( 'Post Settings', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'post_collapsible_common',
|
||||
'section' => 'post_settings',
|
||||
'label' => esc_html__( 'Common', 'revision' ),
|
||||
'input_attrs' => array(
|
||||
'collapsed' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'settings' => 'post_sidebar',
|
||||
'label' => esc_html__( 'Default Sidebar', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => 'right',
|
||||
'choices' => array(
|
||||
'right' => esc_html__( 'Right Sidebar', 'revision' ),
|
||||
'left' => esc_html__( 'Left Sidebar', 'revision' ),
|
||||
'disabled' => esc_html__( 'No Sidebar', 'revision' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'settings' => 'post_header_type',
|
||||
'label' => esc_html__( 'Default Page Header Type', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => 'standard',
|
||||
'choices' => array(
|
||||
'standard' => esc_html__( 'Standard', 'revision' ),
|
||||
'split' => esc_html__( 'Split', 'revision' ),
|
||||
'overlay' => esc_html__( 'Overlay', 'revision' ),
|
||||
'title' => esc_html__( 'Page Title Only', 'revision' ),
|
||||
'none' => esc_html__( 'None', 'revision' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'settings' => 'post_media_preview',
|
||||
'label' => esc_html__( 'Standard Page Header Preview', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => 'cropped',
|
||||
'choices' => array(
|
||||
'cropped' => esc_html__( 'Display Cropped Image', 'revision' ),
|
||||
'uncropped' => esc_html__( 'Display Preview in Original Ratio', 'revision' ),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
array(
|
||||
'setting' => 'post_header_type',
|
||||
'operator' => '==',
|
||||
'value' => 'standard',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'multicheck',
|
||||
'settings' => 'post_meta',
|
||||
'label' => esc_html__( 'Post Meta', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => array( 'category', 'date', 'author' ),
|
||||
/**
|
||||
* Post meta choices.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
'choices' => apply_filters(
|
||||
'csco_post_meta_choices',
|
||||
array(
|
||||
'category' => esc_html__( 'Category', 'revision' ),
|
||||
'date' => esc_html__( 'Date', 'revision' ),
|
||||
'author' => esc_html__( 'Author', 'revision' ),
|
||||
'comments' => esc_html__( 'Comments', 'revision' ),
|
||||
'views' => esc_html__( 'Views', 'revision' ),
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_metabar',
|
||||
'label' => esc_html__( 'Display metabar section', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_reading_time',
|
||||
'label' => esc_html__( 'Display reading time', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
array(
|
||||
'setting' => 'post_metabar',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_subtitle',
|
||||
'label' => esc_html__( 'Display excerpt as post subtitle', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_tags',
|
||||
'label' => esc_html__( 'Display tags', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_footer',
|
||||
'label' => esc_html__( 'Display post footer', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_prev_next',
|
||||
'label' => esc_html__( 'Enable prev/next section', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'post_collapsible_read_next',
|
||||
'section' => 'post_settings',
|
||||
'label' => esc_html__( 'Read Next Links', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_read_next',
|
||||
'label' => esc_html__( 'Display read next links', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'settings' => 'post_read_next_posts',
|
||||
'label' => esc_html__( 'Display posts', 'revision' ),
|
||||
'description' => esc_html__( 'The section will display posts from the current category, published after the current post\'s date, before it, or the newest posts. In case fewer than tree or four posts meet the requirements, the section will display other posts from the current category. In case there are fewer than three or four posts in the current category, the section will display posts from other categories.', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => 'after',
|
||||
'choices' => apply_filters(
|
||||
'csco_header_layouts',
|
||||
array(
|
||||
'after' => esc_html__( 'After current post date', 'revision' ),
|
||||
'before' => esc_html__( 'Before current post date', 'revision' ),
|
||||
'new' => esc_html__( 'Newest posts', 'revision' ),
|
||||
)
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_read_next',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'settings' => 'post_read_next_image_orientation',
|
||||
'label' => esc_html__( 'Image Orientation', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => 'landscape-16-9',
|
||||
'choices' => array(
|
||||
'original' => esc_html__( 'Original', 'revision' ),
|
||||
'landscape' => esc_html__( 'Landscape 4:3', 'revision' ),
|
||||
'landscape-3-2' => esc_html__( 'Landscape 3:2', 'revision' ),
|
||||
'landscape-16-9' => esc_html__( 'Landscape 16:9', 'revision' ),
|
||||
'landscape-21-9' => esc_html__( 'Landscape 21:9', 'revision' ),
|
||||
'portrait' => esc_html__( 'Portrait 3:4', 'revision' ),
|
||||
'portrait-2-3' => esc_html__( 'Portrait 2:3', 'revision' ),
|
||||
'square' => esc_html__( 'Square', 'revision' ),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_read_next',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'settings' => 'post_read_next_image_size',
|
||||
'label' => esc_html__( 'Image Size', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => 'csco-thumbnail',
|
||||
'choices' => csco_get_list_available_image_sizes(),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_read_next',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'read_next_excerpt',
|
||||
'label' => esc_html__( 'Display excerpt', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => true,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_read_next',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'read_next_discover_more',
|
||||
'label' => esc_html__( 'Display discover more', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => false,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_read_next',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'multicheck',
|
||||
'settings' => 'post_read_next_meta',
|
||||
'label' => esc_html__( 'Post Meta', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => array( 'category', 'date', 'author', 'reading_time' ),
|
||||
/**
|
||||
* Post meta choices.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
'choices' => apply_filters(
|
||||
'csco_post_meta_choices',
|
||||
array(
|
||||
'category' => esc_html__( 'Category', 'revision' ),
|
||||
'reading_time' => esc_html__( 'Reading time', 'revision' ),
|
||||
'date' => esc_html__( 'Date', 'revision' ),
|
||||
'author' => esc_html__( 'Author', 'revision' ),
|
||||
'comments' => esc_html__( 'Comments', 'revision' ),
|
||||
'views' => esc_html__( 'Views', 'revision' ),
|
||||
)
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_read_next',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Auto Load next post.
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'post_collapsible_load_nextpost',
|
||||
'section' => 'post_settings',
|
||||
'label' => esc_html__( 'Auto Load Next Post', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_load_nextpost',
|
||||
'label' => esc_html__( 'Enable the auto load next post feature', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => false,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_load_nextpost_same_category',
|
||||
'label' => esc_html__( 'Auto load posts from the same category only', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => false,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_load_nextpost',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'post_load_nextpost_reverse',
|
||||
'label' => esc_html__( 'Auto load previous posts instead of next ones', 'revision' ),
|
||||
'section' => 'post_settings',
|
||||
'default' => false,
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'post_load_nextpost',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
72
inc/theme-mods/site-identity.php
Normal file
72
inc/theme-mods/site-identity.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Site Identity
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'title_tag',
|
||||
'label' => esc_html__( 'Use H1 tag for Logo on Homepage', 'revision' ),
|
||||
'section' => 'title_tagline',
|
||||
'default' => true,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'image',
|
||||
'settings' => 'logo',
|
||||
'label' => esc_html__( 'Main Logo', 'revision' ),
|
||||
'description' => esc_html__( 'The main logo is used in the navigation bar and mobile view of your website. Logo image will be displayed in its original image dimensions. Please upload the 2x version of your logo via Media Library with ', 'revision' ) . '<code>@2x</code>' . esc_html__( ' suffix for supporting Retina screens. For example ', 'revision' ) . '<code>logo@2x.png</code>' . esc_html__( '. Recommended maximum height is 40px (80px for Retina version).', 'revision' ),
|
||||
'section' => 'title_tagline',
|
||||
'default' => '',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'image',
|
||||
'settings' => 'logo_dark',
|
||||
'label' => esc_html__( 'Main Logo for Dark Mode', 'revision' ),
|
||||
'section' => 'title_tagline',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'logo',
|
||||
'operator' => '!=',
|
||||
'value' => '',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'image',
|
||||
'settings' => 'footer_logo',
|
||||
'label' => esc_html__( 'Footer Logo', 'revision' ),
|
||||
'description' => esc_html__( 'The footer logo is used in the site footer in desktop and mobile view. Similar to the main logo, upload the 2x version of your logo via Media Library with ', 'revision' ) . '<code>@2x</code>' . esc_html__( ' suffix for supporting Retina screens. For example ', 'revision' ) . '<code>logo-footer@2x.png</code>' . esc_html__( '. Recommended maximum height is 80px (160px for Retina version).', 'revision' ),
|
||||
'section' => 'title_tagline',
|
||||
'default' => '',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'image',
|
||||
'settings' => 'footer_logo_dark',
|
||||
'label' => esc_html__( 'Footer Logo for Dark Mode', 'revision' ),
|
||||
'section' => 'title_tagline',
|
||||
'default' => '',
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'footer_logo',
|
||||
'operator' => '!=',
|
||||
'value' => '',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
708
inc/theme-mods/typography-settings.php
Normal file
708
inc/theme-mods/typography-settings.php
Normal file
@@ -0,0 +1,708 @@
|
||||
<?php
|
||||
/**
|
||||
* Typography
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
CSCO_Customizer::add_panel(
|
||||
'typography',
|
||||
array(
|
||||
'title' => esc_html__( 'Typography', 'revision' ),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'typography_general',
|
||||
array(
|
||||
'title' => esc_html__( 'General', 'revision' ),
|
||||
'panel' => 'typography',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_base',
|
||||
'label' => esc_html__( 'Base Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '400',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '1rem',
|
||||
'letter-spacing' => 'normal',
|
||||
'line-height' => '1.55',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500italic',
|
||||
'500',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_primary',
|
||||
'label' => esc_html__( 'Primary Font', 'revision' ),
|
||||
'description' => esc_html__( 'Used for buttons, and tags and other actionable elements.', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '800',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '1rem',
|
||||
'letter-spacing' => '-0.03em',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_secondary',
|
||||
'label' => esc_html__( 'Secondary Font', 'revision' ),
|
||||
'description' => esc_html__( 'Used for breadcrumbs and other secondary elements.', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '400',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '0.875rem',
|
||||
'letter-spacing' => 'normal',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.55',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'settings' => 'typography_advanced_settings',
|
||||
'label' => esc_html__( 'Display advanced typography settings', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => false,
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_section_headings',
|
||||
'label' => esc_html__( 'Section Headings Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '800',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '0.75rem',
|
||||
'letter-spacing' => '0.1em',
|
||||
'text-transform' => 'uppercase',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_post_title',
|
||||
'label' => esc_html__( 'Post Title Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '700',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '3.25rem',
|
||||
'letter-spacing' => '-0.05em',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_post_subtitle',
|
||||
'label' => esc_html__( 'Post Subtitle Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '400',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '1.125rem',
|
||||
'letter-spacing' => 'normal',
|
||||
'line-height' => '1.55',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500italic',
|
||||
'500',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_category',
|
||||
'label' => esc_html__( 'Post Category Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '800',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '0.6875rem',
|
||||
'letter-spacing' => '0.1em',
|
||||
'text-transform' => 'uppercase',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_post_meta',
|
||||
'label' => esc_html__( 'Post Meta Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '600',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '0.9375rem',
|
||||
'letter-spacing' => '-0.02em',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_post_content',
|
||||
'label' => esc_html__( 'Post Content Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '400',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '1.125rem',
|
||||
'letter-spacing' => 'normal',
|
||||
'line-height' => '1.55',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_input',
|
||||
'label' => esc_html__( 'Input Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '400',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '0.875rem',
|
||||
'line-height' => '1.55rem',
|
||||
'letter-spacing' => 'normal',
|
||||
'text-transform' => 'none',
|
||||
),
|
||||
'choices' => array(),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_entry_title',
|
||||
'label' => esc_html__( 'Entry Title Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '700',
|
||||
'subsets' => array( 'latin' ),
|
||||
'letter-spacing' => '-0.04em',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_excerpt',
|
||||
'label' => esc_html__( 'Entry Excerpt Font', 'revision' ),
|
||||
'section' => 'typography_general',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '400',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '1rem',
|
||||
'letter-spacing' => 'normal',
|
||||
'line-height' => '1.55',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'600',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'typography_advanced_settings',
|
||||
'operator' => '==',
|
||||
'value' => true,
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'typography_logos',
|
||||
array(
|
||||
'title' => esc_html__( 'Logos', 'revision' ),
|
||||
'panel' => 'typography',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_main_logo',
|
||||
'label' => esc_html__( 'Main Logo', 'revision' ),
|
||||
'description' => esc_html__( 'The main logo is used in the navigation bar and mobile view of your website.', 'revision' ),
|
||||
'section' => 'typography_logos',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'font-size' => '1.375rem',
|
||||
'variant' => '700',
|
||||
'subsets' => array( 'latin' ),
|
||||
'letter-spacing' => '-0.04em',
|
||||
'text-transform' => 'none',
|
||||
),
|
||||
'choices' => array(),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'logo',
|
||||
'operator' => '==',
|
||||
'value' => '',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_footer_logo',
|
||||
'label' => esc_html__( 'Footer Logo', 'revision' ),
|
||||
'description' => esc_html__( 'The footer logo is used in the site footer in desktop and mobile view.', 'revision' ),
|
||||
'section' => 'typography_logos',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'font-size' => '1.375rem',
|
||||
'variant' => '700',
|
||||
'subsets' => array( 'latin' ),
|
||||
'letter-spacing' => '-0.04em',
|
||||
'text-transform' => 'none',
|
||||
),
|
||||
'choices' => array(),
|
||||
'active_callback' => array(
|
||||
array(
|
||||
'setting' => 'footer_logo',
|
||||
'operator' => '==',
|
||||
'value' => '',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'typography_headings',
|
||||
array(
|
||||
'title' => esc_html__( 'Headings', 'revision' ),
|
||||
'panel' => 'typography',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_headings',
|
||||
'label' => esc_html__( 'Headings', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '700',
|
||||
'subsets' => array( 'latin' ),
|
||||
'letter-spacing' => '-0.04em',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(
|
||||
'variant' => array(
|
||||
'regular',
|
||||
'italic',
|
||||
'500',
|
||||
'500italic',
|
||||
'700',
|
||||
'700italic',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'collapsible',
|
||||
'settings' => 'typography_headings_collapsible',
|
||||
'section' => 'typography_headings',
|
||||
'label' => esc_html__( 'Headings Font Size', 'revision' ),
|
||||
'input_attrs' => array(
|
||||
'collapsed' => false,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'font_h1_size',
|
||||
'label' => esc_html__( 'Heading 1', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => '3.25rem',
|
||||
'sanitize_callback' => 'esc_html',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-heading-1-font-size',
|
||||
'context' => array( 'editor', 'front' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'font_h2_size',
|
||||
'label' => esc_html__( 'Heading 2', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => '2.625rem',
|
||||
'sanitize_callback' => 'esc_html',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-heading-2-font-size',
|
||||
'context' => array( 'editor', 'front' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'font_h3_size',
|
||||
'label' => esc_html__( 'Heading 3', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => '2.0625rem',
|
||||
'sanitize_callback' => 'esc_html',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-heading-3-font-size',
|
||||
'context' => array( 'editor', 'front' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'font_h4_size',
|
||||
'label' => esc_html__( 'Heading 4', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => '1.5rem',
|
||||
'sanitize_callback' => 'esc_html',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-heading-4-font-size',
|
||||
'context' => array( 'editor', 'front' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'font_h5_size',
|
||||
'label' => esc_html__( 'Heading 5', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => '1.3125rem',
|
||||
'sanitize_callback' => 'esc_html',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-heading-5-font-size',
|
||||
'context' => array( 'editor', 'front' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'dimension',
|
||||
'settings' => 'font_h6_size',
|
||||
'label' => esc_html__( 'Heading 6', 'revision' ),
|
||||
'section' => 'typography_headings',
|
||||
'default' => '1.125rem',
|
||||
'sanitize_callback' => 'esc_html',
|
||||
'output' => array(
|
||||
array(
|
||||
'element' => ':root',
|
||||
'property' => '--cs-heading-6-font-size',
|
||||
'context' => array( 'editor', 'front' ),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_section(
|
||||
'typography_navigation',
|
||||
array(
|
||||
'title' => esc_html__( 'Navigation', 'revision' ),
|
||||
'panel' => 'typography',
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_menu',
|
||||
'label' => esc_html__( 'Menu Font', 'revision' ),
|
||||
'description' => esc_html__( 'Used for main top level menu elements.', 'revision' ),
|
||||
'section' => 'typography_navigation',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '600',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '1rem',
|
||||
'letter-spacing' => '-0.03em',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_submenu',
|
||||
'label' => esc_html__( 'Submenu Font', 'revision' ),
|
||||
'description' => esc_html__( 'Used for submenu elements.', 'revision' ),
|
||||
'section' => 'typography_navigation',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'subsets' => array( 'latin' ),
|
||||
'variant' => '600',
|
||||
'font-size' => '1rem',
|
||||
'letter-spacing' => '-0.03em',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_footer_menu',
|
||||
'label' => esc_html__( 'Footer Menu Font', 'revision' ),
|
||||
'section' => 'typography_navigation',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'variant' => '800',
|
||||
'subsets' => array( 'latin' ),
|
||||
'font-size' => '0.75rem',
|
||||
'letter-spacing' => '0.1em',
|
||||
'text-transform' => 'uppercase',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(),
|
||||
)
|
||||
);
|
||||
|
||||
CSCO_Customizer::add_field(
|
||||
array(
|
||||
'type' => 'typography',
|
||||
'settings' => 'font_footer_submenu',
|
||||
'label' => esc_html__( 'Footer Submenu Font', 'revision' ),
|
||||
'section' => 'typography_navigation',
|
||||
'default' => array(
|
||||
'font-family' => 'DM Sans',
|
||||
'subsets' => array( 'latin' ),
|
||||
'variant' => '600',
|
||||
'font-size' => '1rem',
|
||||
'letter-spacing' => '-0.03em',
|
||||
'text-transform' => 'none',
|
||||
'line-height' => '1.2',
|
||||
),
|
||||
'choices' => array(),
|
||||
)
|
||||
);
|
||||
82
inc/theme-setup.php
Normal file
82
inc/theme-setup.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Theme Setup
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
/**
|
||||
* The function sets the default options to plugins.
|
||||
*
|
||||
* Set Post Views Counter location to manual.
|
||||
*
|
||||
* @param string $plugin Plugin name.
|
||||
*/
|
||||
function csco_plugin_set_options( $plugin ) {
|
||||
if ( 'post-views-counter' === $plugin ) {
|
||||
// Get display options.
|
||||
$display_options = get_option( 'post_views_counter_settings_display' );
|
||||
|
||||
$display_options = $display_options ? $display_options : array();
|
||||
// Set position value.
|
||||
$display_options['position'] = 'manual';
|
||||
// Update options.
|
||||
update_option( 'post_views_counter_settings_display', $display_options );
|
||||
}
|
||||
|
||||
if ( 'wp-seo' === $plugin ) {
|
||||
// Get display options.
|
||||
$display_options = get_option( 'wpseo_titles' );
|
||||
|
||||
$display_options = $display_options ? $display_options : array();
|
||||
// Set position value.
|
||||
$display_options['breadcrumbs-sep'] = '<span class="cs-separator"></span>';
|
||||
// Update options.
|
||||
update_option( 'wpseo_titles', $display_options );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook into activated_plugin action.
|
||||
*
|
||||
* @param string $plugin Plugin path to main plugin file with plugin data.
|
||||
*/
|
||||
function csco_activated_plugin( $plugin ) {
|
||||
// Check if PVC constant is defined, use it to get PVC path anc compare to activated plugin.
|
||||
if ( 'post-views-counter/post-views-counter.php' === $plugin ) {
|
||||
csco_plugin_set_options( 'post-views-counter' );
|
||||
}
|
||||
|
||||
// Check if WPSEO constant is defined, use it to get WPSEO path anc compare to activated plugin.
|
||||
if ( 'wordpress-seo/wp-seo.php' === $plugin ) {
|
||||
csco_plugin_set_options( 'wp-seo' );
|
||||
}
|
||||
}
|
||||
add_action( 'activated_plugin', 'csco_activated_plugin' );
|
||||
|
||||
/**
|
||||
* Hook into after_switch_theme action.
|
||||
*/
|
||||
function csco_activated_theme() {
|
||||
csco_plugin_set_options( 'post-views-counter' );
|
||||
csco_plugin_set_options( 'wp-seo' );
|
||||
}
|
||||
add_action( 'after_switch_theme', 'csco_activated_theme' );
|
||||
|
||||
/**
|
||||
* Remove AMP link.
|
||||
*/
|
||||
function csco_admin_remove_amp_link() {
|
||||
remove_action( 'admin_menu', 'amp_add_customizer_link' );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'csco_admin_remove_amp_link', 20 );
|
||||
|
||||
/**
|
||||
* Remove AMP panel.
|
||||
*
|
||||
* @param object $wp_customize Instance of the WP_Customize_Manager class.
|
||||
*/
|
||||
function csco_customizer_remove_amp_panel( $wp_customize ) {
|
||||
$wp_customize->remove_panel( 'amp_panel' );
|
||||
}
|
||||
add_action( 'customize_register', 'csco_customizer_remove_amp_panel', 1000 );
|
||||
884
inc/theme-tags.php
Normal file
884
inc/theme-tags.php
Normal file
@@ -0,0 +1,884 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Tags
|
||||
*
|
||||
* Functions that are called directly from template parts or within actions.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_header_nav_menu' ) ) {
|
||||
class CSCO_NAV_Walker extends Walker_Nav_Menu {
|
||||
/**
|
||||
* Starts the element output.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added.
|
||||
* @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id`
|
||||
* to match parent class for PHP 8 named parameter support.
|
||||
*
|
||||
* @see Walker::start_el()
|
||||
*
|
||||
* @param string $output Used to append additional content (passed by reference).
|
||||
* @param WP_Post $data_object Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
* @param int $current_object_id Optional. ID of the current menu item. Default 0.
|
||||
*/
|
||||
public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) {
|
||||
// Restores the more descriptive, specific name for use within this method.
|
||||
$menu_item = $data_object;
|
||||
|
||||
if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
|
||||
$t = '';
|
||||
$n = '';
|
||||
} else {
|
||||
$t = "\t";
|
||||
$n = "\n";
|
||||
}
|
||||
$indent = ( $depth ) ? str_repeat( $t, $depth ) : '';
|
||||
|
||||
$classes = empty( $menu_item->classes ) ? array() : (array) $menu_item->classes;
|
||||
$classes[] = 'menu-item-' . $menu_item->ID;
|
||||
|
||||
/**
|
||||
* Filters the arguments for a single nav menu item.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
* @param WP_Post $menu_item Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth );
|
||||
|
||||
/**
|
||||
* Filters the CSS classes applied to a menu item's list item element.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.1.0 The `$depth` parameter was added.
|
||||
*
|
||||
* @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element.
|
||||
* @param WP_Post $menu_item The current menu item object.
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth ) );
|
||||
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
/**
|
||||
* Filters the ID applied to a menu item's list item element.
|
||||
*
|
||||
* @since 3.0.1
|
||||
* @since 4.1.0 The `$depth` parameter was added.
|
||||
*
|
||||
* @param string $menu_id The ID that is applied to the menu item's `<li>` element.
|
||||
* @param WP_Post $menu_item The current menu item.
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $menu_item->ID, $menu_item, $args, $depth );
|
||||
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||
|
||||
$output .= $indent . '<li' . $id . $class_names . '>';
|
||||
|
||||
$atts = array();
|
||||
$atts['title'] = ! empty( $menu_item->attr_title ) ? $menu_item->attr_title : '';
|
||||
$atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : '';
|
||||
if ( '_blank' === $menu_item->target && empty( $menu_item->xfn ) ) {
|
||||
$atts['rel'] = 'noopener';
|
||||
} else {
|
||||
$atts['rel'] = $menu_item->xfn;
|
||||
}
|
||||
$atts['href'] = ! empty( $menu_item->url ) ? $menu_item->url : '';
|
||||
$atts['aria-current'] = $menu_item->current ? 'page' : '';
|
||||
|
||||
if ( '#' === trim( $menu_item->url ) ) {
|
||||
$atts['class'] = 'menu-item-without-link';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the HTML attributes applied to a menu item's anchor element.
|
||||
*
|
||||
* @since 3.6.0
|
||||
* @since 4.1.0 The `$depth` parameter was added.
|
||||
*
|
||||
* @param array $atts {
|
||||
* The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
|
||||
*
|
||||
* @type string $title Title attribute.
|
||||
* @type string $target Target attribute.
|
||||
* @type string $rel The rel attribute.
|
||||
* @type string $href The href attribute.
|
||||
* @type string $aria-current The aria-current attribute.
|
||||
* }
|
||||
* @param WP_Post $menu_item The current menu item object.
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth );
|
||||
|
||||
$attributes = '';
|
||||
foreach ( $atts as $attr => $value ) {
|
||||
if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
|
||||
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
|
||||
$attributes .= ' ' . $attr . '="' . $value . '"';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The the_title hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID );
|
||||
|
||||
/**
|
||||
* Filters a menu item's title.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param string $title The menu item's title.
|
||||
* @param WP_Post $menu_item The current menu item object.
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth );
|
||||
|
||||
$link_tag = 'a';
|
||||
|
||||
$item_output = $args->before;
|
||||
$item_output .= '<' . $link_tag . $attributes . '>';
|
||||
$item_output .= $args->link_before . '<span>' . $title . '</span>' . $args->link_after;
|
||||
$item_output .= '</' . $link_tag . '>';
|
||||
$item_output .= $args->after;
|
||||
|
||||
/**
|
||||
* Filters a menu item's starting output.
|
||||
*
|
||||
* The menu item's starting output only includes `$args->before`, the opening `<a>`,
|
||||
* the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is
|
||||
* no filter for modifying the opening and closing `<li>` for a menu item.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $item_output The menu item's starting HTML output.
|
||||
* @param WP_Post $menu_item Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param stdClass $args An object of wp_nav_menu() arguments.
|
||||
*/
|
||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $menu_item, $depth, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Header Nav Menu
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_nav_menu( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'header_navigation_menu', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( has_nav_menu( 'primary' ) ) {
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'menu_class' => 'cs-header__nav-inner',
|
||||
'theme_location' => 'primary',
|
||||
'container' => 'nav',
|
||||
'container_class' => 'cs-header__nav',
|
||||
'walker' => new CSCO_NAV_Walker(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_additional_menu' ) ) {
|
||||
/**
|
||||
* Header Additional Menu
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_additional_menu( $settings = array() ) {
|
||||
if ( has_nav_menu( 'additional' ) ) {
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'menu_class' => 'cs-header__top-nav',
|
||||
'theme_location' => 'additional',
|
||||
'container' => '',
|
||||
'container_class' => '',
|
||||
'depth' => 1,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_logo' ) ) {
|
||||
/**
|
||||
* Header Logo
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_logo( $settings = array() ) {
|
||||
|
||||
$logo_default_name = 'logo';
|
||||
$logo_dark_name = 'logo_dark';
|
||||
$logo_class = null;
|
||||
|
||||
$defaults = array(
|
||||
'variant' => null,
|
||||
'tag' => 'div',
|
||||
);
|
||||
|
||||
if ( is_front_page() && get_theme_mod( 'title_tag', true ) ) {
|
||||
$defaults['tag'] = 'h1';
|
||||
}
|
||||
|
||||
$settings = apply_filters( 'csco_header_logo_settings', wp_parse_args( $settings, $defaults ) );
|
||||
|
||||
// For hide logo.
|
||||
if ( 'hide' === $settings['variant'] ) {
|
||||
$logo_class = 'cs-logo-hide';
|
||||
}
|
||||
|
||||
// Get default logo.
|
||||
$logo_url = get_theme_mod( $logo_default_name );
|
||||
|
||||
$logo_id = attachment_url_to_postid( $logo_url );
|
||||
|
||||
// Set mode of logo.
|
||||
$logo_mode = 'cs-logo-once';
|
||||
|
||||
// Check display mode.
|
||||
if ( $logo_id ) {
|
||||
$logo_mode = 'cs-logo-default';
|
||||
}
|
||||
|
||||
// Logo tag
|
||||
$logo_tag = $settings['tag'];
|
||||
?>
|
||||
<<?php echo esc_html( $logo_tag ); ?> class="cs-logo">
|
||||
<a class="cs-header__logo <?php echo esc_attr( $logo_mode ); ?> <?php echo esc_attr( $logo_class ); ?>" href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||||
<?php
|
||||
if ( $logo_id ) {
|
||||
csco_get_retina_image( $logo_id, array( 'alt' => get_bloginfo( 'name' ) ), 'logo' );
|
||||
} else {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
if ( 'cs-logo-default' === $logo_mode ) {
|
||||
|
||||
$logo_dark_url = get_theme_mod( $logo_dark_name ) ? get_theme_mod( $logo_dark_name ) : $logo_url;
|
||||
|
||||
$logo_dark_id = attachment_url_to_postid( $logo_dark_url );
|
||||
|
||||
if ( $logo_dark_id ) {
|
||||
?>
|
||||
<a class="cs-header__logo cs-logo-dark <?php echo esc_attr( $logo_class ); ?>" href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||||
<?php csco_get_retina_image( $logo_dark_id, array( 'alt' => get_bloginfo( 'name' ) ), 'logo' ); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</<?php echo esc_html( $logo_tag ); ?>>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_offcanvas_toggle' ) ) {
|
||||
/**
|
||||
* Header Offcanvas Toggle
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_offcanvas_toggle( $settings = array() ) {
|
||||
|
||||
if ( csco_offcanvas_exists() ) {
|
||||
|
||||
if ( ! isset( $settings['mobile'] ) ) {
|
||||
if ( ! get_theme_mod( 'header_offcanvas', false ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$class = __return_empty_string();
|
||||
?>
|
||||
<span class="cs-header__offcanvas-toggle <?php echo esc_attr( $class ); ?>" role="button" aria-label="<?php echo esc_attr__( 'Mobile menu button', 'revision' ); ?>">
|
||||
<i class="cs-icon cs-icon-menu1"></i>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_search_toggle' ) ) {
|
||||
/**
|
||||
* Header Search Toggle
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_search_toggle( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'header_search_button', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<span class="cs-header__search-toggle" role="button" aria-label="<?php echo esc_attr__( 'Search', 'revision' ); ?>">
|
||||
<i class="cs-icon cs-icon-search"></i>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_scheme_toggle' ) ) {
|
||||
/**
|
||||
* Header Scheme Toggle
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_scheme_toggle( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'color_scheme_toggle', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<span class="cs-site-scheme-toggle cs-header__scheme-toggle" role="button" aria-label="<?php echo esc_attr__( 'Dark mode toggle button', 'revision' ); ?>">
|
||||
<span class="cs-header__scheme-toggle-icons">
|
||||
<span class="cs-header__scheme-cs-icon-box cs-light-mode" data-mode="light"><i class="cs-header__scheme-toggle-icon cs-icon cs-icon-light-mode"></i></span>
|
||||
<span class="cs-header__scheme-cs-icon-box cs-dark-mode" data-mode="dark"><i class="cs-header__scheme-toggle-icon cs-icon cs-icon-dark-mode"></i></span>
|
||||
</span>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_scheme_toggle_mobile' ) ) {
|
||||
/**
|
||||
* Header Scheme Toggle Mobile
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_scheme_toggle_mobile( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'color_scheme_toggle', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<span class="cs-header__scheme-toggle cs-header__scheme-toggle-mobile cs-site-scheme-toggle" role="button" aria-label="<?php echo esc_attr__( 'Scheme Toggle', 'revision' ); ?>">
|
||||
<span class="cs-header__scheme-toggle-icons">
|
||||
<span class="cs-header__scheme-cs-icon-box cs-light-mode" data-mode="light"><i class="cs-header__scheme-toggle-icon cs-icon cs-icon-light-mode"></i></span>
|
||||
<span class="cs-header__scheme-cs-icon-box cs-dark-mode" data-mode="dark"><i class="cs-header__scheme-toggle-icon cs-icon cs-icon-dark-mode"></i></span>
|
||||
</span>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_header_custom_button' ) ) {
|
||||
/**
|
||||
* Header Custom Button
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_header_custom_button( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'header_custom_button', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$button = get_theme_mod( 'header_custom_button_label' );
|
||||
$link = get_theme_mod( 'header_custom_button_link' );
|
||||
$target = get_theme_mod( 'header_custom_button_target', '_self' );
|
||||
|
||||
if ( $button && $link ) {
|
||||
?>
|
||||
<a class="cs-button cs-header__custom-button" href="<?php echo esc_url( $link ); ?>" target="<?php echo esc_attr( $target ); ?>">
|
||||
<?php echo wp_kses( $button, 'content' ); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'csco_discover_more_button' ) ) {
|
||||
/**
|
||||
* Discover More Button
|
||||
*/
|
||||
function csco_discover_more_button() {
|
||||
$button_label = sprintf(
|
||||
/* translators: %s: Post Title */
|
||||
__( 'Discover More: %s', 'revision' ),
|
||||
get_the_title()
|
||||
);
|
||||
?>
|
||||
<div class="cs-entry__discover-more">
|
||||
<a class="cs-button" href="<?php echo esc_url( get_permalink() ); ?>" title="<?php echo esc_attr( $button_label ); ?>">
|
||||
<?php esc_html_e( 'Discover More', 'revision' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_footer_logo' ) ) {
|
||||
/**
|
||||
* Footer Logo
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_footer_logo( $settings = array() ) {
|
||||
$logo_url = get_theme_mod( 'footer_logo' );
|
||||
|
||||
$logo_id = attachment_url_to_postid( $logo_url );
|
||||
|
||||
$logo_mode = 'cs-logo-once';
|
||||
|
||||
if ( $logo_id ) {
|
||||
$logo_mode = 'cs-logo-default';
|
||||
}
|
||||
?>
|
||||
<div class="cs-logo">
|
||||
<a class="cs-footer__logo <?php echo esc_attr( $logo_mode ); ?>" href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||||
<?php
|
||||
if ( $logo_id ) {
|
||||
csco_get_retina_image( $logo_id, array( 'alt' => get_bloginfo( 'name' ) ), 'logo' );
|
||||
} else {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
if ( 'cs-logo-default' === $logo_mode ) {
|
||||
|
||||
$logo_dark_url = get_theme_mod( 'footer_logo_dark' ) ? get_theme_mod( 'footer_logo_dark' ) : $logo_url;
|
||||
|
||||
$logo_dark_id = attachment_url_to_postid( $logo_dark_url );
|
||||
|
||||
if ( $logo_dark_id ) {
|
||||
?>
|
||||
<a class="cs-footer__logo cs-logo-dark" href="<?php echo esc_url( home_url( '/' ) ); ?>">
|
||||
<?php csco_get_retina_image( $logo_dark_id, array( 'alt' => get_bloginfo( 'name' ) ), 'logo' ); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_footer_description' ) ) {
|
||||
/**
|
||||
* Footer Description
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_footer_description( $settings = array() ) {
|
||||
|
||||
$footer_text = get_theme_mod( 'footer_text' );
|
||||
if ( $footer_text ) {
|
||||
?>
|
||||
<div class="cs-footer__desc">
|
||||
<?php echo do_shortcode( $footer_text ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_footer_copyright' ) ) {
|
||||
/**
|
||||
* Footer Copyright
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_footer_copyright( $settings = array() ) {
|
||||
$footer_copyright = get_theme_mod( 'footer_copyright', '© 2024 — Revision. All Rights Reserved.' );
|
||||
if ( $footer_copyright ) {
|
||||
?>
|
||||
<div class="cs-footer__copyright">
|
||||
<?php echo do_shortcode( $footer_copyright ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_footer_nav_menu' ) ) {
|
||||
/**
|
||||
* Footer Nav Menu
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_footer_nav_menu( $settings = array() ) {
|
||||
|
||||
$settings = array_merge(
|
||||
array(
|
||||
'menu_class' => null,
|
||||
),
|
||||
$settings
|
||||
);
|
||||
|
||||
if ( has_nav_menu( 'footer' ) ) {
|
||||
?>
|
||||
<div class="cs-footer__nav-menu">
|
||||
<?php
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => 'footer',
|
||||
'container_class' => '',
|
||||
'menu_class' => sprintf( 'cs-footer__nav %s', $settings['menu_class'] ),
|
||||
'container' => '',
|
||||
'depth' => 2,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_misc_subscribe' ) ) {
|
||||
/**
|
||||
* Subscribe section
|
||||
*/
|
||||
function csco_misc_subscribe() {
|
||||
if ( ! get_theme_mod( 'misc_subscribe', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_404() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$allowed_html = array(
|
||||
'input' => array(
|
||||
'type' => true,
|
||||
'name' => true,
|
||||
'value' => true,
|
||||
'id' => true,
|
||||
'class' => true,
|
||||
'data-*' => true,
|
||||
),
|
||||
);
|
||||
|
||||
// Provider‑specific setup.
|
||||
$provider = get_theme_mod( 'misc_subscribe_provider', 'mailchimp' );
|
||||
|
||||
$action = __return_empty_string();
|
||||
$email_name = 'EMAIL';
|
||||
$hidden_html = __return_empty_string();
|
||||
|
||||
switch ( $provider ) {
|
||||
case 'mailchimp':
|
||||
$action = get_theme_mod( 'misc_subscribe_mailchimp' );
|
||||
break;
|
||||
case 'kit':
|
||||
$kit_form_id = get_theme_mod( 'misc_subscribe_kit_form_id' );
|
||||
$kit_api_key = get_theme_mod( 'misc_subscribe_kit_api_key' );
|
||||
$action = esc_url( "https://api.kit.com/forms/{$kit_form_id}/subscriptions" );
|
||||
$email_name = 'email';
|
||||
$hidden_html = '<input type="hidden" name="api_key" value="' . esc_attr( $kit_api_key ) . '">';
|
||||
break;
|
||||
case 'mailerlite':
|
||||
$action = get_theme_mod( 'misc_subscribe_mailerlite' );
|
||||
$email_name = 'fields[email]';
|
||||
break;
|
||||
case 'custom':
|
||||
$action = get_theme_mod( 'misc_subscribe_custom_action' );
|
||||
$email_name = get_theme_mod( 'misc_subscribe_custom_email_field', 'EMAIL' );
|
||||
$hidden_html = wp_kses( get_theme_mod( 'misc_subscribe_custom_hidden' ), $allowed_html );
|
||||
break;
|
||||
}
|
||||
|
||||
$subscribe_heading = get_theme_mod( 'misc_subscribe_heading' );
|
||||
$subscribe_description = get_theme_mod( 'misc_subscribe_description' );
|
||||
$misc_subscribe_short_description = get_theme_mod( 'misc_subscribe_short_description' );
|
||||
|
||||
?>
|
||||
<div class="cs-subscribe-section">
|
||||
<div class="cs-container">
|
||||
<div class="cs-subscribe">
|
||||
<div class="cs-subscribe__content">
|
||||
<?php if ( $subscribe_heading ) { ?>
|
||||
<div class="cs-subscribe__header">
|
||||
<h3 class="cs-subscribe__heading">
|
||||
<?php echo esc_html( $subscribe_heading ); ?>
|
||||
</h3>
|
||||
<?php if ( $subscribe_description ) { ?>
|
||||
<div class="cs-subscribe__description">
|
||||
<?php echo do_shortcode( $subscribe_description ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<form class="cs-subscribe__form cs-form-box" action="<?php echo esc_url( $action ); ?>" method="post" target="_blank" novalidate>
|
||||
<div class="cs-form-group cs-subscribe__form-group" >
|
||||
<input type="email" placeholder="<?php echo esc_attr__( 'Enter Your Email', 'revision' ); ?>" name="<?php echo esc_attr( $email_name ); ?>" required>
|
||||
<?php echo wp_kses( $hidden_html, $allowed_html ); ?>
|
||||
<button type="submit" value="<?php esc_attr_e( 'Subscribe', 'revision' ); ?>" aria-label="<?php echo esc_attr__( 'Subscribe', 'revision' ); ?>" name="subscribe" class="cs-button-animated">
|
||||
<i class="cs-icon cs-icon-send"></i>
|
||||
<span>
|
||||
<span><?php esc_html_e( 'Subscribe', 'revision' ); ?></span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if ( $misc_subscribe_short_description ) { ?>
|
||||
<div class="cs-subscribe__short-description">
|
||||
<?php echo do_shortcode( $misc_subscribe_short_description ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'csco_off_canvas_button' ) ) {
|
||||
/**
|
||||
* Off-Canvas Button
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_off_canvas_button( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'header_custom_button', false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$button = get_theme_mod( 'header_custom_button_label' );
|
||||
$link = get_theme_mod( 'header_custom_button_link' );
|
||||
|
||||
if ( $button && $link ) {
|
||||
?>
|
||||
<div class="cs-offcanvas__button">
|
||||
<a class="cs-button cs-offcanvas__button" href="<?php echo esc_url( $link ); ?>" target="_blank">
|
||||
<?php echo wp_kses( $button, 'content' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_scroll_to_top' ) ) {
|
||||
/**
|
||||
* Scroll to Top
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_scroll_to_top( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'misc_scroll_to_top', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<button class="cs-scroll-top" role="button" aria-label="<?php echo esc_attr__( 'Scroll to top button', 'revision' ); ?>">
|
||||
<i class="cs-icon-chevron-up"></i>
|
||||
<div class="cs-scroll-top-border">
|
||||
<svg width="49" height="49" viewBox="0 0 49 49">
|
||||
<path d="M24.5,2 a22.5,22.5 0 0,1 0,45 a22.5,22.5 0 0,1 0,-45" style="stroke-width: 2; fill: none;"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="cs-scroll-top-progress">
|
||||
<svg width="49" height="49" viewBox="0 0 49 49">
|
||||
<path d="M24.5,2 a22.5,22.5 0 0,1 0,45 a22.5,22.5 0 0,1 0,-45" style="stroke-width: 2; fill: none;"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_off_canvas_scheme_toggle' ) ) {
|
||||
/**
|
||||
* Offcanvas Scheme Toggle
|
||||
*
|
||||
* @param array $settings The advanced settings.
|
||||
*/
|
||||
function csco_off_canvas_scheme_toggle( $settings = array() ) {
|
||||
if ( ! get_theme_mod( 'color_scheme_toggle', true ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<span class="cs-site-scheme-toggle cs-offcanvas__scheme-toggle" role="button" aria-label="<?php echo esc_attr__( 'Scheme Toggle', 'revision' ); ?>">
|
||||
<span class="cs-header__scheme-toggle-icons">
|
||||
<span class="cs-header__scheme-cs-icon-box cs-light-mode" data-mode="light"><i class="cs-header__scheme-toggle-icon cs-icon cs-icon-light-mode"></i></span>
|
||||
<span class="cs-header__scheme-cs-icon-box cs-dark-mode" data-mode="dark"><i class="cs-header__scheme-toggle-icon cs-icon cs-icon-dark-mode"></i></span>
|
||||
</span>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_the_post_format_icon' ) ) {
|
||||
/**
|
||||
* Post Format Icon
|
||||
*
|
||||
* @param string $content After content.
|
||||
*/
|
||||
function csco_the_post_format_icon( $content = null ) {
|
||||
$post_format = get_post_format();
|
||||
|
||||
if ( 'gallery' === $post_format ) {
|
||||
$attachments = count(
|
||||
(array) get_children(
|
||||
array(
|
||||
'post_parent' => get_the_ID(),
|
||||
'post_type' => 'attachment',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$content = $attachments ? sprintf( '<span>%s</span>', $attachments ) : '';
|
||||
}
|
||||
|
||||
if ( $post_format ) {
|
||||
?>
|
||||
<span class="cs-entry-format">
|
||||
<a class="cs-format-icon cs-format-<?php echo esc_attr( $post_format ); ?>" href="<?php the_permalink(); ?>">
|
||||
<?php echo wp_kses( $content, 'content' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_post_subtitle' ) ) {
|
||||
/**
|
||||
* Post Subtitle
|
||||
*/
|
||||
function csco_post_subtitle() {
|
||||
if ( ! is_single() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_theme_mod( 'post_subtitle', true ) ) {
|
||||
/**
|
||||
* The plugins/wp_subtitle/get_subtitle hook.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$subtitle = apply_filters(
|
||||
'plugins/wp_subtitle/get_subtitle',
|
||||
'',
|
||||
array(
|
||||
'before' => '',
|
||||
'after' => '',
|
||||
'post_id' => get_the_ID(),
|
||||
)
|
||||
);
|
||||
|
||||
if ( $subtitle ) {
|
||||
?>
|
||||
<div class="cs-entry__subtitle">
|
||||
<?php echo wp_kses( $subtitle, 'content' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
} elseif ( has_excerpt() ) {
|
||||
?>
|
||||
<div class="cs-entry__subtitle">
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_archive_post_description' ) ) {
|
||||
/**
|
||||
* Post Description in Archive Pages
|
||||
*/
|
||||
function csco_archive_post_description() {
|
||||
$description = get_the_archive_description();
|
||||
if ( $description ) {
|
||||
?>
|
||||
<div class="cs-page__archive-description">
|
||||
<?php echo do_shortcode( $description ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'csco_archive_category_thumbnail' ) ) {
|
||||
/**
|
||||
* Category Thumbnail in Archive Pages
|
||||
*/
|
||||
function csco_archive_category_thumbnail() {
|
||||
$category_id = get_queried_object_id();
|
||||
$category = get_term( $category_id, 'category' );
|
||||
if ( $category ) {
|
||||
$csco_category_logo = get_term_meta( $category_id, 'csco_category_logo', true );
|
||||
if ( $csco_category_logo ) {
|
||||
?>
|
||||
<div class="cs-page__archive-thumbnail">
|
||||
<div class="cs-page__archive-thumbnail-box">
|
||||
<?php
|
||||
csco_get_retina_image(
|
||||
$csco_category_logo,
|
||||
array(
|
||||
'alt' => esc_attr( $category->name ),
|
||||
'title' => esc_attr( $category->name ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ! function_exists( 'csco_share_links' ) ) {
|
||||
/**
|
||||
* Share Links section
|
||||
*/
|
||||
function csco_share_links() {
|
||||
?>
|
||||
|
||||
<div class="cs-share">
|
||||
|
||||
<?php
|
||||
$share_url = get_permalink();
|
||||
|
||||
$text = rawurlencode( html_entity_decode( get_the_title( get_the_ID() ) ) );
|
||||
|
||||
$twitter_share_url = esc_url( 'https://twitter.com/share?t=' . $text . '&url=' . $share_url, null, '' );
|
||||
$facebook_share_url = esc_url( 'https://www.facebook.com/sharer.php?text=' . $text . '&u=' . $share_url, null, '' );
|
||||
$linkedin_share_url = esc_url( 'https://www.linkedin.com/shareArticle?mini=true&url=' . $share_url, null, '' );
|
||||
?>
|
||||
|
||||
<a class="cs-share__link" target="_blank" href="<?php call_user_func( 'printf', '%s', $twitter_share_url ); ?>" title="<?php esc_attr_e( 'Share in Twitter', 'revision' ); ?>">
|
||||
<i class="cs-icon cs-icon-twitter-x"></i>
|
||||
</a>
|
||||
|
||||
<a class="cs-share__link" target="_blank" href="<?php call_user_func( 'printf', '%s', $facebook_share_url ); ?>" title="<?php esc_attr_e( 'Share on Facebook', 'revision' ); ?>">
|
||||
<i class="cs-icon cs-icon-facebook"></i>
|
||||
</a>
|
||||
|
||||
<a class="cs-share__link" target="_blank" href="<?php call_user_func( 'printf', '%s', $linkedin_share_url ); ?>" title="<?php esc_attr_e( 'Share in Linkedin', 'revision' ); ?>">
|
||||
<i class="cs-icon cs-icon-linkedIn"></i>
|
||||
</a>
|
||||
|
||||
<a class="cs-share__link cs-share__copy-link" target="_blank" href="<?php echo esc_url( $share_url ); ?>" title="<?php esc_attr_e( 'Copy link', 'revision' ); ?>">
|
||||
<i class="cs-icon cs-icon-link"></i>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
174
inc/typography.php
Normal file
174
inc/typography.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/**
|
||||
* Typography
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
:root {
|
||||
/* Base Font */
|
||||
--cs-font-base-family: <?php csco_typography( 'font_base', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-base-size: <?php csco_typography( 'font_base', 'font-size', '1rem' ); ?>;
|
||||
--cs-font-base-weight: <?php csco_typography( 'font_base', 'font-weight', '400' ); ?>;
|
||||
--cs-font-base-style: <?php csco_typography( 'font_base', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-base-letter-spacing: <?php csco_typography( 'font_base', 'letter-spacing', 'normal' ); ?>;
|
||||
--cs-font-base-line-height: <?php csco_typography( 'font_base', 'line-height', '1.55' ); ?>;
|
||||
|
||||
/* Primary Font */
|
||||
--cs-font-primary-family: <?php csco_typography( 'font_primary', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-primary-size: <?php csco_typography( 'font_primary', 'font-size', '1rem' ); ?>;
|
||||
--cs-font-primary-weight: <?php csco_typography( 'font_primary', 'font-weight', '800' ); ?>;
|
||||
--cs-font-primary-style: <?php csco_typography( 'font_primary', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-primary-letter-spacing: <?php csco_typography( 'font_primary', 'letter-spacing', '-0.03em' ); ?>;
|
||||
--cs-font-primary-text-transform: <?php csco_typography( 'font_primary', 'text-transform', 'none' ); ?>;
|
||||
--cs-font-primary-line-height: <?php csco_typography( 'font_primary', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Secondary Font */
|
||||
--cs-font-secondary-family: <?php csco_typography( 'font_secondary', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-secondary-size: <?php csco_typography( 'font_secondary', 'font-size', '0.875rem' ); ?>;
|
||||
--cs-font-secondary-weight: <?php csco_typography( 'font_secondary', 'font-weight', '400' ); ?>;
|
||||
--cs-font-secondary-style: <?php csco_typography( 'font_secondary', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-secondary-letter-spacing: <?php csco_typography( 'font_secondary', 'letter-spacing', 'normal' ); ?>;
|
||||
--cs-font-secondary-text-transform: <?php csco_typography( 'font_secondary', 'text-transform', 'none' ); ?>;
|
||||
--cs-font-secondary-line-height: <?php csco_typography( 'font_secondary', 'line-height', '1.55' ); ?>;
|
||||
|
||||
/* Section Headings Font */
|
||||
--cs-font-section-headings-family: <?php csco_typography( 'font_section_headings', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-section-headings-size: <?php csco_typography( 'font_section_headings', 'font-size', '0.75rem' ); ?>;
|
||||
--cs-font-section-headings-weight: <?php csco_typography( 'font_section_headings', 'font-weight', '800' ); ?>;
|
||||
--cs-font-section-headings-style: <?php csco_typography( 'font_section_headings', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-section-headings-letter-spacing: <?php csco_typography( 'font_section_headings', 'letter-spacing', '0.1em' ); ?>;
|
||||
--cs-font-section-headings-text-transform: <?php csco_typography( 'font_section_headings', 'text-transform', 'uppercase' ); ?>;
|
||||
--cs-font-section-headings-line-height: <?php csco_typography( 'font_section_headings', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Post Title Font Size */
|
||||
--cs-font-post-title-family: <?php csco_typography( 'font_post_title', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-post-title-weight: <?php csco_typography( 'font_post_title', 'font-weight', '700' ); ?>;
|
||||
--cs-font-post-title-size: <?php csco_typography( 'font_post_title', 'font-size', '3.25rem' ); ?>;
|
||||
--cs-font-post-title-letter-spacing: <?php csco_typography( 'font_post_title', 'letter-spacing', '-0.05em' ); ?>;
|
||||
--cs-font-post-title-line-height: <?php csco_typography( 'font_post_title', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Post Subbtitle */
|
||||
--cs-font-post-subtitle-family: <?php csco_typography( 'font_post_subtitle', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-post-subtitle-weight: <?php csco_typography( 'font_post_subtitle', 'font-weight', '400' ); ?>;
|
||||
--cs-font-post-subtitle-size: <?php csco_typography( 'font_post_subtitle', 'font-size', '1.125rem' ); ?>;
|
||||
--cs-font-post-subtitle-letter-spacing: <?php csco_typography( 'font_post_subtitle', 'letter-spacing', 'normal' ); ?>;
|
||||
--cs-font-post-subtitle-line-height: <?php csco_typography( 'font_post_subtitle', 'line-height', '1.55' ); ?>;
|
||||
|
||||
/* Post Category Font */
|
||||
--cs-font-category-family: <?php csco_typography( 'font_category', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-category-size: <?php csco_typography( 'font_category', 'font-size', '0.6875rem' ); ?>;
|
||||
--cs-font-category-weight: <?php csco_typography( 'font_category', 'font-weight', '800' ); ?>;
|
||||
--cs-font-category-style: <?php csco_typography( 'font_category', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-category-letter-spacing: <?php csco_typography( 'font_category', 'letter-spacing', '0.1em' ); ?>;
|
||||
--cs-font-category-text-transform: <?php csco_typography( 'font_category', 'text-transform', 'uppercase' ); ?>;
|
||||
--cs-font-category-line-height: <?php csco_typography( 'font_category', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Post Meta Font */
|
||||
--cs-font-post-meta-family: <?php csco_typography( 'font_post_meta', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-post-meta-size: <?php csco_typography( 'font_post_meta', 'font-size', '0.9375rem' ); ?>;
|
||||
--cs-font-post-meta-weight: <?php csco_typography( 'font_post_meta', 'font-weight', '600' ); ?>;
|
||||
--cs-font-post-meta-style: <?php csco_typography( 'font_post_meta', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-post-meta-letter-spacing: <?php csco_typography( 'font_post_meta', 'letter-spacing', '-0.02em' ); ?>;
|
||||
--cs-font-post-meta-text-transform: <?php csco_typography( 'font_post_meta', 'text-transform', 'none' ); ?>;
|
||||
--cs-font-post-meta-line-height: <?php csco_typography( 'font_post_meta', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Post Content */
|
||||
--cs-font-post-content-family: <?php csco_typography( 'font_post_content', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-post-content-weight: <?php csco_typography( 'font_post_content', 'font-weight', '400' ); ?>;
|
||||
--cs-font-post-content-size: <?php csco_typography( 'font_post_content', 'font-size', '1.125rem' ); ?>;
|
||||
--cs-font-post-content-letter-spacing: <?php csco_typography( 'font_post_content', 'letter-spacing', 'normal' ); ?>;
|
||||
--cs-font-post-content-line-height: <?php csco_typography( 'font_post_content', 'line-height', '1.55' ); ?>;
|
||||
|
||||
/* Input Font */
|
||||
--cs-font-input-family: <?php csco_typography( 'font_input', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-input-size: <?php csco_typography( 'font_input', 'font-size', '0.875rem' ); ?>;
|
||||
--cs-font-input-weight: <?php csco_typography( 'font_input', 'font-weight', '400' ); ?>;
|
||||
--cs-font-input-style: <?php csco_typography( 'font_input', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-input-line-height: <?php csco_typography( 'font_input', 'line-height', '1.55' ); ?>;
|
||||
--cs-font-input-letter-spacing: <?php csco_typography( 'font_input', 'letter-spacing', 'normal' ); ?>;
|
||||
--cs-font-input-text-transform: <?php csco_typography( 'font_input', 'text-transform', 'none' ); ?>;
|
||||
|
||||
/* Entry Title Font Size */
|
||||
--cs-font-entry-title-family: <?php csco_typography( 'font_entry_title', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-entry-title-weight: <?php csco_typography( 'font_entry_title', 'font-weight', '700' ); ?>;
|
||||
--cs-font-entry-title-letter-spacing: <?php csco_typography( 'font_entry_title', 'letter-spacing', '-0.04em' ); ?>;
|
||||
--cs-font-entry-title-line-height: <?php csco_typography( 'font_entry_title', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Entry Excerpt */
|
||||
--cs-font-entry-excerpt-family: <?php csco_typography( 'font_excerpt', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-entry-excerpt-weight: <?php csco_typography( 'font_excerpt', 'font-weight', '400' ); ?>;
|
||||
--cs-font-entry-excerpt-size: <?php csco_typography( 'font_excerpt', 'font-size', '1rem' ); ?>;
|
||||
--cs-font-entry-excerpt-letter-spacing: <?php csco_typography( 'font_excerpt', 'letter-spacing', 'normal' ); ?>;
|
||||
--cs-font-entry-excerpt-line-height: <?php csco_typography( 'font_excerpt', 'line-height', '1.55' ); ?>;
|
||||
|
||||
/* Logos --------------- */
|
||||
|
||||
/* Main Logo */
|
||||
--cs-font-main-logo-family: <?php csco_typography( 'font_main_logo', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-main-logo-size: <?php csco_typography( 'font_main_logo', 'font-size', '1.375rem' ); ?>;
|
||||
--cs-font-main-logo-weight: <?php csco_typography( 'font_main_logo', 'font-weight', '700' ); ?>;
|
||||
--cs-font-main-logo-style: <?php csco_typography( 'font_main_logo', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-main-logo-letter-spacing: <?php csco_typography( 'font_main_logo', 'letter-spacing', '-0.04em' ); ?>;
|
||||
--cs-font-main-logo-text-transform: <?php csco_typography( 'font_main_logo', 'text-transform', 'none' ); ?>;
|
||||
|
||||
/* Footer Logo */
|
||||
--cs-font-footer-logo-family: <?php csco_typography( 'font_footer_logo', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-footer-logo-size: <?php csco_typography( 'font_footer_logo', 'font-size', '1.375rem' ); ?>;
|
||||
--cs-font-footer-logo-weight: <?php csco_typography( 'font_footer_logo', 'font-weight', '700' ); ?>;
|
||||
--cs-font-footer-logo-style: <?php csco_typography( 'font_footer_logo', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-footer-logo-letter-spacing: <?php csco_typography( 'font_footer_logo', 'letter-spacing', '-0.04em' ); ?>;
|
||||
--cs-font-footer-logo-text-transform: <?php csco_typography( 'font_footer_logo', 'text-transform', 'none' ); ?>;
|
||||
|
||||
/* Headings --------------- */
|
||||
|
||||
/* Headings */
|
||||
--cs-font-headings-family: <?php csco_typography( 'font_headings', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-headings-weight: <?php csco_typography( 'font_headings', 'font-weight', '700' ); ?>;
|
||||
--cs-font-headings-style: <?php csco_typography( 'font_headings', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-headings-line-height: <?php csco_typography( 'font_headings', 'line-height', '1.2' ); ?>;
|
||||
--cs-font-headings-letter-spacing: <?php csco_typography( 'font_headings', 'letter-spacing', '-0.04em' ); ?>;
|
||||
--cs-font-headings-text-transform: <?php csco_typography( 'font_headings', 'text-transform', 'none' ); ?>;
|
||||
|
||||
/* Menu Font --------------- */
|
||||
|
||||
/* Menu */
|
||||
/* Used for main top level menu elements. */
|
||||
--cs-font-menu-family: <?php csco_typography( 'font_menu', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-menu-size: <?php csco_typography( 'font_menu', 'font-size', '1rem' ); ?>;
|
||||
--cs-font-menu-weight: <?php csco_typography( 'font_menu', 'font-weight', '600' ); ?>;
|
||||
--cs-font-menu-style: <?php csco_typography( 'font_menu', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-menu-letter-spacing: <?php csco_typography( 'font_menu', 'letter-spacing', '-0.03em' ); ?>;
|
||||
--cs-font-menu-text-transform: <?php csco_typography( 'font_menu', 'text-transform', 'none' ); ?>;
|
||||
--cs-font-menu-line-height: <?php csco_typography( 'font_menu', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Submenu Font */
|
||||
/* Used for submenu elements. */
|
||||
--cs-font-submenu-family: <?php csco_typography( 'font_submenu', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-submenu-size: <?php csco_typography( 'font_submenu', 'font-size', '1rem' ); ?>;
|
||||
--cs-font-submenu-weight: <?php csco_typography( 'font_submenu', 'font-weight', '600' ); ?>;
|
||||
--cs-font-submenu-style: <?php csco_typography( 'font_submenu', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-submenu-letter-spacing: <?php csco_typography( 'font_submenu', 'letter-spacing', '-0.03em' ); ?>;
|
||||
--cs-font-submenu-text-transform: <?php csco_typography( 'font_submenu', 'text-transform', 'none' ); ?>;
|
||||
--cs-font-submenu-line-height: <?php csco_typography( 'font_submenu', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Footer Menu */
|
||||
--cs-font-footer-menu-family: <?php csco_typography( 'font_footer_menu', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-footer-menu-size: <?php csco_typography( 'font_footer_menu', 'font-size', '0.75rem' ); ?>;
|
||||
--cs-font-footer-menu-weight: <?php csco_typography( 'font_footer_menu', 'font-weight', '800' ); ?>;
|
||||
--cs-font-footer-menu-style: <?php csco_typography( 'font_footer_menu', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-footer-menu-letter-spacing: <?php csco_typography( 'font_footer_menu', 'letter-spacing', '0.1em' ); ?>;
|
||||
--cs-font-footer-menu-text-transform: <?php csco_typography( 'font_footer_menu', 'text-transform', 'uppercase' ); ?>;
|
||||
--cs-font-footer-menu-line-height: <?php csco_typography( 'font_footer_menu', 'line-height', '1.2' ); ?>;
|
||||
|
||||
/* Footer Submenu Font */
|
||||
--cs-font-footer-submenu-family: <?php csco_typography( 'font_footer_submenu', 'font-family', 'DM Sans' ); ?>;
|
||||
--cs-font-footer-submenu-size: <?php csco_typography( 'font_footer_submenu', 'font-size', '1rem' ); ?>;
|
||||
--cs-font-footer-submenu-weight: <?php csco_typography( 'font_footer_submenu', 'font-weight', '600' ); ?>;
|
||||
--cs-font-footer-submenu-style: <?php csco_typography( 'font_footer_submenu', 'font-style', 'normal' ); ?>;
|
||||
--cs-font-footer-submenu-letter-spacing: <?php csco_typography( 'font_footer_submenu', 'letter-spacing', '-0.03m' ); ?>;
|
||||
--cs-font-footer-submenu-text-transform: <?php csco_typography( 'font_footer_submenu', 'text-transform', 'none' ); ?>;
|
||||
--cs-font-footer-submenu-line-height: <?php csco_typography( 'font_footer_submenu', 'line-height', '1.2' ); ?>;
|
||||
}
|
||||
35
inc/widgets-init.php
Normal file
35
inc/widgets-init.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Widgets Init
|
||||
*
|
||||
* Register sitebar locations for widgets.
|
||||
*
|
||||
* @package Revision
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'csco_widgets_init' ) ) {
|
||||
/**
|
||||
* Register sidebars
|
||||
*/
|
||||
function csco_widgets_init() {
|
||||
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => esc_html__( 'Default Sidebar', 'revision' ),
|
||||
'id' => 'sidebar-main',
|
||||
'before_widget' => '<div class="widget %1$s %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
)
|
||||
);
|
||||
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => esc_html__( 'Off-canvas', 'revision' ),
|
||||
'id' => 'sidebar-offcanvas',
|
||||
'before_widget' => '<div class="widget %1$s %2$s">',
|
||||
'after_widget' => '</div>',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'widgets_init', 'csco_widgets_init' );
|
||||
}
|
||||
Reference in New Issue
Block a user