51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
namespace RomhackPlaza\Backwards;
|
||
|
|
|
||
|
|
defined( '\ABSPATH' ) || exit;
|
||
|
|
|
||
|
|
/*
|
||
|
|
* This file contains some snippets used in the base Treville theme.
|
||
|
|
* This function are not edited. All rights are for ThemeZee.
|
||
|
|
*/
|
||
|
|
|
||
|
|
if( ! function_exists( 'treville_is_amp' ) ) {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Checks if AMP page is rendered.
|
||
|
|
*/
|
||
|
|
function treville_is_amp() {
|
||
|
|
return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if( ! function_exists( 'treville_amp_menu_toggl' ) ) {
|
||
|
|
|
||
|
|
function treville_amp_menu_toggle() {
|
||
|
|
if ( treville_is_amp() ) {
|
||
|
|
echo "[aria-expanded]=\"mobileMenuExpanded? 'true' : 'false'\" ";
|
||
|
|
echo 'on="tap:AMP.setState({mobileMenuExpanded: !mobileMenuExpanded})"';
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if( ! function_exists( 'treville_amp_secondary_menu_is_toggled' ) ) {
|
||
|
|
|
||
|
|
function treville_amp_secondary_menu_is_toggled() {
|
||
|
|
if ( treville_is_amp() ) {
|
||
|
|
echo "[class]=\"'secondary-navigation' + ( mobileMenuExpanded ? ' toggled-on' : '' )\"";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if( !function_exists( 'treville_amp_primary_menu_is_toggled' ) ) {
|
||
|
|
|
||
|
|
function treville_amp_primary_menu_is_toggled() {
|
||
|
|
if ( treville_is_amp() ) {
|
||
|
|
echo "[class]=\"'primary-navigation-wrap' + ( mobileMenuExpanded ? ' toggled-on' : '' )\"";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|