first commit without licensingg
9166
assets/css/editor-style-rtl.css
Normal file
9166
assets/css/editor-style.css
Normal file
2029
assets/js/scripts.js
Normal file
137
assets/jsx/editor-iframe.js
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var cscoEditorIframe = {};
|
||||||
|
if (window.self !== window.top) {
|
||||||
|
var $this;
|
||||||
|
cscoEditorIframe = {
|
||||||
|
/*
|
||||||
|
* Variables
|
||||||
|
*/
|
||||||
|
html: false,
|
||||||
|
body: false,
|
||||||
|
post_type: null,
|
||||||
|
page_layout: null,
|
||||||
|
prevStorageVal: null,
|
||||||
|
/*
|
||||||
|
* Initialize
|
||||||
|
*/
|
||||||
|
init: function init(e) {
|
||||||
|
$this = cscoEditorIframe;
|
||||||
|
|
||||||
|
// Find html and wrapper elements.
|
||||||
|
$this.html = document.querySelector('html');
|
||||||
|
$this.body = document.querySelector('.editor-styles-wrapper');
|
||||||
|
if (!$this || !$this.html || !$this.body) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this.post_type = cscoGWrapper.post_type;
|
||||||
|
$this.page_layout = cscoGWrapper.page_layout;
|
||||||
|
$this.rootObserver();
|
||||||
|
|
||||||
|
// Init events.
|
||||||
|
if ('undefined' === typeof window.cscoEditorIframeInit) {
|
||||||
|
$this.events(e);
|
||||||
|
window.cscoEditorIframeInit = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* Events
|
||||||
|
*/
|
||||||
|
events: function events(e) {
|
||||||
|
// Listen storage from the parent window
|
||||||
|
setInterval(function () {
|
||||||
|
var currentValue = sessionStorage.getItem('cscoIframeContext');
|
||||||
|
if (currentValue !== $this.prevStorageVal) {
|
||||||
|
$this.prevStorageVal = currentValue;
|
||||||
|
if (currentValue) {
|
||||||
|
var data = JSON.parse(currentValue);
|
||||||
|
if (data.hasOwnProperty('page_layout')) {
|
||||||
|
$this.page_layout = data.page_layout;
|
||||||
|
$this.setLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
// Listen HTML and Body elements.
|
||||||
|
var observer = new MutationObserver(function (mutations) {
|
||||||
|
mutations.forEach(function (mutation) {
|
||||||
|
if (mutation.oldValue !== mutation.target.classList.value) {
|
||||||
|
$this.rootObserver();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
observer.observe($this.html, {
|
||||||
|
attributes: true,
|
||||||
|
subtree: false,
|
||||||
|
attributeOldValue: true,
|
||||||
|
attributeFilter: ["class"]
|
||||||
|
});
|
||||||
|
observer.observe($this.body, {
|
||||||
|
attributes: true,
|
||||||
|
subtree: false,
|
||||||
|
attributeOldValue: true,
|
||||||
|
attributeFilter: ["class"]
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen resize.
|
||||||
|
window.addEventListener('resize', function (e) {
|
||||||
|
$this.setBreakpoints();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Function for Listener HTML and Body elements.
|
||||||
|
*/
|
||||||
|
rootObserver: function rootObserver() {
|
||||||
|
var update = false;
|
||||||
|
if (!$this.html.classList.contains('cs-editor-iframe')) {
|
||||||
|
$this.html.classList.add('cs-editor-iframe');
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
if (!$this.body.classList.contains('cs-editor-styles-wrapper')) {
|
||||||
|
$this.body.classList.add('cs-editor-styles-wrapper');
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
if (update) {
|
||||||
|
$this.setBreakpoints();
|
||||||
|
$this.setLayout();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* Set breakpoints
|
||||||
|
*/
|
||||||
|
setBreakpoints: function setBreakpoints() {
|
||||||
|
var breakpoints = cscoGWrapper.breakpoints;
|
||||||
|
|
||||||
|
// Update the matching breakpoints on the observed element.
|
||||||
|
Object.keys(breakpoints).forEach(function (breakpoint) {
|
||||||
|
var minWidth = breakpoints[breakpoint];
|
||||||
|
if ($this.body.clientWidth >= minWidth) {
|
||||||
|
$this.html.classList.add(breakpoint);
|
||||||
|
} else {
|
||||||
|
$this.html.classList.remove(breakpoint);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Set layout.
|
||||||
|
*/
|
||||||
|
setLayout: function setLayout() {
|
||||||
|
$this.body.classList.remove('cs-sidebar-enabled');
|
||||||
|
$this.body.classList.remove('cs-sidebar-disabled');
|
||||||
|
$this.body.classList.add($this.page_layout);
|
||||||
|
$this.body.classList.add($this.post_type);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Iframe Loaded.
|
||||||
|
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||||
|
cscoEditorIframe.init();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
cscoEditorIframe.init();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
19
assets/jsx/editor-scripts.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue editor scripts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add wrapper to widgets editor.
|
||||||
|
*/
|
||||||
|
wp.data.subscribe(function () {
|
||||||
|
setTimeout(function () {
|
||||||
|
var elements = document.querySelectorAll('#widgets-editor .editor-styles-wrapper:not(.cs-editor-styles-wrapper)');
|
||||||
|
if (elements && elements.length) {
|
||||||
|
elements.forEach(function (wrapper) {
|
||||||
|
wrapper.classList.add('cs-editor-styles-wrapper');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
|
});
|
||||||
250
assets/jsx/editor-wrapper.js
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||||
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||||
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||||
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||||
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||||
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||||
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||||
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||||
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||||
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||||
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||||
|
/**
|
||||||
|
* Editor Wrapper
|
||||||
|
*/
|
||||||
|
|
||||||
|
function csEditorWrapper() {
|
||||||
|
var Component = wp.element.Component;
|
||||||
|
var registerPlugin = wp.plugins.registerPlugin;
|
||||||
|
var _wp$data = wp.data,
|
||||||
|
select = _wp$data.select,
|
||||||
|
subscribe = _wp$data.subscribe;
|
||||||
|
var cscoGutenberg = {};
|
||||||
|
var cscoIframeContext = {};
|
||||||
|
function setIframeContext(key, val) {
|
||||||
|
cscoIframeContext[key] = val;
|
||||||
|
sessionStorage.setItem('cscoIframeContext', JSON.stringify(cscoIframeContext));
|
||||||
|
}
|
||||||
|
(function () {
|
||||||
|
var $this;
|
||||||
|
cscoGutenberg = {
|
||||||
|
/*
|
||||||
|
* Variables
|
||||||
|
*/
|
||||||
|
wrapper: false,
|
||||||
|
content: false,
|
||||||
|
template: null,
|
||||||
|
singularLayout: null,
|
||||||
|
/*
|
||||||
|
* Initialize
|
||||||
|
*/
|
||||||
|
init: function init(e) {
|
||||||
|
$this = cscoGutenberg;
|
||||||
|
|
||||||
|
// Find wrapper and content elements.
|
||||||
|
$this.content = document.querySelector('.block-editor-editor-skeleton__content, .interface-interface-skeleton__content');
|
||||||
|
$this.wrapper = document.querySelector('.editor-styles-wrapper');
|
||||||
|
|
||||||
|
// Init events.
|
||||||
|
if ('undefined' === typeof window.cscoGutenbergInit) {
|
||||||
|
$this.events(e);
|
||||||
|
window.cscoGutenbergInit = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* Events
|
||||||
|
*/
|
||||||
|
events: function events(e) {
|
||||||
|
// Update singular layout.
|
||||||
|
subscribe(function () {
|
||||||
|
var meta = select('core/editor').getEditedPostAttribute('meta');
|
||||||
|
if ('object' === _typeof(meta) && meta['csco_singular_sidebar']) {
|
||||||
|
var newSingularLayout = meta['csco_singular_sidebar'];
|
||||||
|
if (newSingularLayout !== $this.singularLayout) {
|
||||||
|
$this.singularLayout = newSingularLayout;
|
||||||
|
$this.changeLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update template.
|
||||||
|
subscribe(function () {
|
||||||
|
var newTemplate = select('core/editor').getEditedPostAttribute('template');
|
||||||
|
if (newTemplate !== $this.template) {
|
||||||
|
$this.template = newTemplate;
|
||||||
|
$this.changeLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update Breakpoints during resize.
|
||||||
|
window.addEventListener('resize', function (e) {
|
||||||
|
$this.initBreakpoints();
|
||||||
|
$this.initChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update Breakpoints.
|
||||||
|
var observer = new MutationObserver(function (mutations) {
|
||||||
|
mutations.forEach(function (mutation) {
|
||||||
|
if (mutation.oldValue !== mutation.target.classList.value) {
|
||||||
|
$this.initBreakpoints();
|
||||||
|
$this.initChanges();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
observer.observe(document.getElementsByTagName('body')[0], {
|
||||||
|
attributes: true,
|
||||||
|
subtree: false,
|
||||||
|
attributeOldValue: true,
|
||||||
|
attributeFilter: ["class"]
|
||||||
|
});
|
||||||
|
observer.observe(document.getElementsByClassName('edit-post-layout')[0], {
|
||||||
|
attributes: true,
|
||||||
|
subtree: false,
|
||||||
|
attributeOldValue: true,
|
||||||
|
attributeFilter: ["class"]
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* Get page template
|
||||||
|
*/
|
||||||
|
getPageTemplate: function getPageTemplate() {
|
||||||
|
return select('core/editor').getEditedPostAttribute('template');
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* Initialize changes
|
||||||
|
*/
|
||||||
|
initChanges: function initChanges() {
|
||||||
|
setTimeout(function () {
|
||||||
|
document.body.dispatchEvent(new Event('editor-render'));
|
||||||
|
}, 200);
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* Initialize the breakpoints system
|
||||||
|
*/
|
||||||
|
initBreakpoints: function initBreakpoints() {
|
||||||
|
if ('undefined' === typeof $this) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!$this.wrapper || !$this.content) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default breakpoints that should apply to all observed
|
||||||
|
// elements that don't define their own custom breakpoints.
|
||||||
|
var breakpoints = cscoGWrapper.breakpoints;
|
||||||
|
|
||||||
|
// Update the matching breakpoints on the observed element.
|
||||||
|
Object.keys(breakpoints).forEach(function (breakpoint) {
|
||||||
|
var minWidth = breakpoints[breakpoint];
|
||||||
|
if ($this.wrapper.clientWidth >= minWidth) {
|
||||||
|
$this.content.classList.add(breakpoint);
|
||||||
|
} else {
|
||||||
|
$this.content.classList.remove(breakpoint);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Init page layout.
|
||||||
|
*/
|
||||||
|
initLayout: function initLayout() {
|
||||||
|
if ('undefined' === typeof $this || !$this.wrapper) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this.wrapper.classList.add('cs-editor-styles-wrapper');
|
||||||
|
$this.wrapper.classList.add(cscoGWrapper.page_layout);
|
||||||
|
$this.wrapper.classList.add(cscoGWrapper.post_type);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Get new page layout.
|
||||||
|
*/
|
||||||
|
newLayout: function newLayout(layout) {
|
||||||
|
if ('right' === layout || 'left' === layout) {
|
||||||
|
return 'cs-sidebar-enabled';
|
||||||
|
} else if ('disabled' === layout) {
|
||||||
|
return 'cs-sidebar-disabled';
|
||||||
|
} else {
|
||||||
|
return cscoGWrapper.default_layout;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Update when page layout has changed.
|
||||||
|
*/
|
||||||
|
changeLayout: function changeLayout() {
|
||||||
|
if ('undefined' === typeof $this) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var layout = $this.singularLayout;
|
||||||
|
if ($this.newLayout(layout) === cscoGWrapper.page_layout) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ('right' === layout || 'left' === layout) {
|
||||||
|
cscoGWrapper.page_layout = 'cs-sidebar-enabled';
|
||||||
|
} else if ('disabled' === layout) {
|
||||||
|
cscoGWrapper.page_layout = 'cs-sidebar-disabled';
|
||||||
|
} else {
|
||||||
|
cscoGWrapper.page_layout = cscoGWrapper.default_layout;
|
||||||
|
}
|
||||||
|
setIframeContext('page_layout', cscoGWrapper.page_layout);
|
||||||
|
if ($this.wrapper) {
|
||||||
|
$this.wrapper.classList.remove('cs-sidebar-enabled');
|
||||||
|
$this.wrapper.classList.remove('cs-sidebar-disabled');
|
||||||
|
|
||||||
|
// Add new class.
|
||||||
|
$this.wrapper.classList.add(cscoGWrapper.page_layout);
|
||||||
|
}
|
||||||
|
$this.initChanges();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
var cscoGutenbergComponent = /*#__PURE__*/function (_Component) {
|
||||||
|
_inherits(cscoGutenbergComponent, _Component);
|
||||||
|
var _super = _createSuper(cscoGutenbergComponent);
|
||||||
|
function cscoGutenbergComponent() {
|
||||||
|
_classCallCheck(this, cscoGutenbergComponent);
|
||||||
|
return _super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
_createClass(cscoGutenbergComponent, [{
|
||||||
|
key: "componentDidMount",
|
||||||
|
value:
|
||||||
|
/**
|
||||||
|
* Add initial class.
|
||||||
|
*/
|
||||||
|
function componentDidMount() {
|
||||||
|
// Initialize.
|
||||||
|
cscoGutenberg.init();
|
||||||
|
|
||||||
|
// Initialize Page Layout.
|
||||||
|
cscoGutenberg.initLayout();
|
||||||
|
|
||||||
|
// Initialize Breakpoints
|
||||||
|
cscoGutenberg.initBreakpoints();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "componentDidUpdate",
|
||||||
|
value: function componentDidUpdate() {
|
||||||
|
// Initialize.
|
||||||
|
cscoGutenberg.init();
|
||||||
|
|
||||||
|
// Update Page Layout.
|
||||||
|
cscoGutenberg.initLayout();
|
||||||
|
|
||||||
|
// Update Breakpoints
|
||||||
|
cscoGutenberg.initBreakpoints();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "render",
|
||||||
|
value: function render() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return cscoGutenbergComponent;
|
||||||
|
}(Component);
|
||||||
|
registerPlugin('cs-editor-wrapper', {
|
||||||
|
render: cscoGutenbergComponent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
csEditorWrapper();
|
||||||
128
assets/jsx/panels.js
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||||
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||||
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||||
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||||
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||||
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||||
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||||
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||||
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||||
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||||
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||||
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||||
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||||
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||||
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||||
|
/**
|
||||||
|
* Register Panel
|
||||||
|
*/
|
||||||
|
|
||||||
|
function csRegisterPanels() {
|
||||||
|
var __ = wp.i18n.__;
|
||||||
|
var compose = wp.compose.compose;
|
||||||
|
var Component = wp.element.Component;
|
||||||
|
var _wp$components = wp.components,
|
||||||
|
SelectControl = _wp$components.SelectControl,
|
||||||
|
CheckboxControl = _wp$components.CheckboxControl,
|
||||||
|
ToggleControl = _wp$components.ToggleControl,
|
||||||
|
TextControl = _wp$components.TextControl,
|
||||||
|
RangeControl = _wp$components.RangeControl;
|
||||||
|
var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
|
||||||
|
var _wp$data = wp.data,
|
||||||
|
withSelect = _wp$data.withSelect,
|
||||||
|
withDispatch = _wp$data.withDispatch;
|
||||||
|
var registerPlugin = wp.plugins.registerPlugin;
|
||||||
|
|
||||||
|
// Fetch the post meta.
|
||||||
|
var applyWithSelect = withSelect(function (select) {
|
||||||
|
var _select = select('core/editor'),
|
||||||
|
getEditedPostAttribute = _select.getEditedPostAttribute;
|
||||||
|
return {
|
||||||
|
meta: getEditedPostAttribute('meta')
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Provide method to update post meta.
|
||||||
|
var applyWithDispatch = withDispatch(function (dispatch, _ref) {
|
||||||
|
var meta = _ref.meta;
|
||||||
|
var _dispatch = dispatch('core/editor'),
|
||||||
|
editPost = _dispatch.editPost;
|
||||||
|
return {
|
||||||
|
updateMeta: function updateMeta(newMeta) {
|
||||||
|
editPost({
|
||||||
|
meta: _objectSpread(_objectSpread({}, meta), newMeta)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ==================================
|
||||||
|
* Layout Options
|
||||||
|
* ==================================
|
||||||
|
*/
|
||||||
|
if ('post' === csPanelsData.postType || 'page' === csPanelsData.postType) {
|
||||||
|
var csThemeLayoutOptions = /*#__PURE__*/function (_Component) {
|
||||||
|
_inherits(csThemeLayoutOptions, _Component);
|
||||||
|
var _super = _createSuper(csThemeLayoutOptions);
|
||||||
|
function csThemeLayoutOptions() {
|
||||||
|
_classCallCheck(this, csThemeLayoutOptions);
|
||||||
|
return _super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
_createClass(csThemeLayoutOptions, [{
|
||||||
|
key: "render",
|
||||||
|
value: function render() {
|
||||||
|
var _this$props = this.props,
|
||||||
|
_this$props$meta = _this$props.meta,
|
||||||
|
_this$props$meta2 = _this$props$meta === void 0 ? {} : _this$props$meta,
|
||||||
|
csco_singular_sidebar = _this$props$meta2.csco_singular_sidebar,
|
||||||
|
csco_page_header_type = _this$props$meta2.csco_page_header_type,
|
||||||
|
csco_page_load_nextpost = _this$props$meta2.csco_page_load_nextpost,
|
||||||
|
updateMeta = _this$props.updateMeta;
|
||||||
|
return /*#__PURE__*/React.createElement(PluginDocumentSettingPanel, {
|
||||||
|
title: __('Layout Options', 'revision')
|
||||||
|
}, /*#__PURE__*/React.createElement(SelectControl, {
|
||||||
|
label: __('Sidebar', 'revision'),
|
||||||
|
value: csco_singular_sidebar,
|
||||||
|
onChange: function onChange(value) {
|
||||||
|
updateMeta({
|
||||||
|
csco_singular_sidebar: value || 'default'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: csPanelsData.singularSidebar
|
||||||
|
}), /*#__PURE__*/React.createElement(SelectControl, {
|
||||||
|
label: __('Page Header Type', 'revision'),
|
||||||
|
value: csco_page_header_type,
|
||||||
|
onChange: function onChange(value) {
|
||||||
|
updateMeta({
|
||||||
|
csco_page_header_type: value || 'default'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: csPanelsData.pageHeaderType
|
||||||
|
}), /*#__PURE__*/React.createElement(SelectControl, {
|
||||||
|
label: __('Auto Load Next Post', 'revision'),
|
||||||
|
value: csco_page_load_nextpost,
|
||||||
|
onChange: function onChange(value) {
|
||||||
|
updateMeta({
|
||||||
|
csco_page_load_nextpost: value || 'default'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: csPanelsData.pageLoadNextpost
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
return csThemeLayoutOptions;
|
||||||
|
}(Component); // Combine the higher-order components.
|
||||||
|
var render = compose([applyWithSelect, applyWithDispatch])(csThemeLayoutOptions);
|
||||||
|
|
||||||
|
// Register panel.
|
||||||
|
registerPlugin('cs-theme-layout-options', {
|
||||||
|
icon: false,
|
||||||
|
render: render
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
csRegisterPanels();
|
||||||
79
assets/static/css/elementor-icons.css
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: 'cs-elementor-icons';
|
||||||
|
src: url('../icon-fonts/elementor-icons.eot?mywnu');
|
||||||
|
src: url('../icon-fonts/elementor-icons.eot?mywnu#iefix') format('embedded-opentype'),
|
||||||
|
url('../icon-fonts/elementor-icons.ttf?mywnu') format('truetype'),
|
||||||
|
url('../icon-fonts/elementor-icons.woff?mywnu') format('woff'),
|
||||||
|
url('../icon-fonts/elementor-icons.svg?mywnu#elementor-icons') format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
[class^="cs-icon-el-"],
|
||||||
|
[class*=" cs-icon-el-"] {
|
||||||
|
/* use !important to prevent issues with browser extensions that change fonts */
|
||||||
|
font-family: 'cs-elementor-icons' !important;
|
||||||
|
speak: never;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1;
|
||||||
|
|
||||||
|
/* Better Font Rendering =========== */
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cs-icon-el-remove:before {
|
||||||
|
content: "\e90e";
|
||||||
|
}
|
||||||
|
.cs-icon-el-outlined_flag:before {
|
||||||
|
content: "\e900";
|
||||||
|
}
|
||||||
|
.cs-icon-el-gps_fixed:before {
|
||||||
|
content: "\e905";
|
||||||
|
}
|
||||||
|
.cs-icon-el-compare:before {
|
||||||
|
content: "\e911";
|
||||||
|
}
|
||||||
|
.cs-icon-el-timer:before {
|
||||||
|
content: "\e90f";
|
||||||
|
}
|
||||||
|
.cs-icon-el-photo_size_select_actual:before {
|
||||||
|
content: "\e901";
|
||||||
|
}
|
||||||
|
.cs-icon-el-wb_iridescent:before {
|
||||||
|
content: "\e90b";
|
||||||
|
}
|
||||||
|
.cs-icon-el-burst_mode:before {
|
||||||
|
content: "\e902";
|
||||||
|
}
|
||||||
|
.cs-icon-el-directions:before {
|
||||||
|
content: "\e913";
|
||||||
|
}
|
||||||
|
.cs-icon-el-local_grocery_store:before {
|
||||||
|
content: "\e914";
|
||||||
|
}
|
||||||
|
.cs-icon-el-assignment:before {
|
||||||
|
content: "\e904";
|
||||||
|
}
|
||||||
|
.cs-icon-el-perm_media:before {
|
||||||
|
content: "\e907";
|
||||||
|
}
|
||||||
|
.cs-icon-el-view_carousel:before {
|
||||||
|
content: "\e908";
|
||||||
|
}
|
||||||
|
.cs-icon-el-view_column:before {
|
||||||
|
content: "\e90d";
|
||||||
|
}
|
||||||
|
.cs-icon-el-view_module:before {
|
||||||
|
content: "\e90a";
|
||||||
|
}
|
||||||
|
.cs-icon-el-vertical_split:before {
|
||||||
|
content: "\e912";
|
||||||
|
}
|
||||||
|
.cs-icon-el-wysiwyg:before {
|
||||||
|
content: "\e90c";
|
||||||
|
}
|
||||||
13
assets/static/css/swiper-bundle.min.css
vendored
Normal file
67
assets/static/icon-fonts/icons.svg
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<metadata>Generated by IcoMoon</metadata>
|
||||||
|
<defs>
|
||||||
|
<font id="icons" horiz-adv-x="1024">
|
||||||
|
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||||
|
<missing-glyph horiz-adv-x="1024" />
|
||||||
|
<glyph unicode=" " horiz-adv-x="512" d="" />
|
||||||
|
<glyph unicode="" glyph-name="activity" d="M938.667 469.334h-170.667c-17.067 0-34.133-12.8-38.4-29.867l-89.6-260.267-217.6 644.267c-4.267 17.067-21.333 29.867-38.4 29.867s-34.133-12.8-38.4-29.867l-119.467-354.133h-140.8c-25.6 0-42.667-17.067-42.667-42.667s17.067-42.667 42.667-42.667h170.667c17.067 0 34.133 12.8 38.4 29.867l89.6 260.267 217.6-648.533c4.267-17.067 21.333-29.867 38.4-29.867s34.133 12.8 38.4 29.867l119.467 354.133h140.8c25.6 0 42.667 17.067 42.667 42.667s-17.067 46.933-42.667 46.933z" />
|
||||||
|
<glyph unicode="" glyph-name="alert" d="M548.956 822.863l406.446-704.001c3.743-6.487 5.714-13.844 5.714-21.33 0-7.491-1.971-14.848-5.714-21.335-3.748-6.487-9.134-11.873-15.616-15.616-6.487-3.748-13.844-5.719-21.335-5.719h-812.886c-7.49 0-14.847 1.971-21.333 5.719-6.486 3.743-11.872 9.129-15.617 15.616s-5.716 13.844-5.716 21.335c0 7.485 1.971 14.843 5.716 21.33l406.442 704.001c3.745 6.486 9.131 11.871 15.617 15.615s13.843 5.716 21.335 5.716c7.485 0 14.843-1.971 21.33-5.716s11.873-9.13 15.616-15.615zM179.464 140.197h665.090l-332.544 575.999-332.546-575.999zM469.342 268.197h85.334v-85.335h-85.334v85.335zM469.342 566.863h85.334v-213.331h-85.334v213.331z" />
|
||||||
|
<glyph unicode="" glyph-name="cart" d="M291.137 840.416h441.728c6.234 0 12.378-1.451 17.956-4.239s10.427-6.836 14.167-11.823l108.424-144.565v-602.355c0-10.65-4.229-20.859-11.764-28.395-7.529-7.529-17.745-11.758-28.395-11.758h-642.508c-10.65 0-20.864 4.229-28.396 11.758-7.531 7.535-11.762 17.745-11.762 28.395v602.355l108.424 144.565c3.741 4.987 8.591 9.035 14.167 11.823s11.725 4.239 17.959 4.239zM793.1 599.474h-562.198v-481.882h562.198v481.882zM773.018 679.789l-60.235 80.314h-401.566l-60.235-80.314h522.037zM391.529 519.161v-80.314c0-31.951 12.692-62.593 35.285-85.186 22.592-22.589 53.235-35.287 85.185-35.287s62.593 12.698 85.185 35.287c22.593 22.593 35.285 53.235 35.285 85.186v80.314h80.312v-80.314c0-53.252-21.155-104.324-58.808-141.977s-88.723-58.808-141.975-58.808c-53.251 0-104.322 21.155-141.976 58.808s-58.808 88.725-58.808 141.977v80.314h80.314z" />
|
||||||
|
<glyph unicode="" glyph-name="dark-mode" d="M873.229 338.774c-22.976-75.021-69.024-140.883-131.59-188.218-54.931-41.35-120.3-66.573-188.765-72.832s-137.321 6.694-198.836 37.402c-61.515 30.714-113.256 77.965-149.414 136.448-36.159 58.49-55.304 125.9-55.287 194.666-0.248 80.265 25.84 158.395 74.26 222.403 47.321 62.58 113.169 108.638 188.175 131.62 4.943 1.523 10.209 1.668 15.229 0.422s9.605-3.838 13.263-7.496c3.658-3.659 6.249-8.245 7.495-13.267s1.101-10.287-0.421-15.232c-16.401-54.264-17.777-111.962-3.979-166.947s42.25-105.194 82.327-145.28c40.077-40.086 90.276-68.545 145.247-82.346 54.97-13.8 112.659-12.425 166.912 3.98 4.941 1.523 10.208 1.668 15.226 0.422 5.024-1.247 9.606-3.839 13.267-7.497 3.654-3.658 6.246-8.245 7.494-13.266 1.242-5.021 1.101-10.287-0.422-15.232l-0.179 0.249z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-left" d="M810.667 469.334h-494.933l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-298.667-298.667c-4.267-4.267-8.533-8.533-8.533-12.8-4.267-8.533-4.267-21.333 0-34.133 4.267-4.267 4.267-8.533 8.533-12.8l298.667-298.667c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133h494.933c25.6 0 42.667 17.067 42.667 42.667s-17.067 42.667-42.667 42.667z" />
|
||||||
|
<glyph unicode="" glyph-name="download" d="M130.824 157.763h722.825v-80.312h-722.825v80.312zM532.392 391.798l243.794 243.832 56.778-56.782-340.728-340.774-340.731 340.734 56.782 56.822 243.792-243.752v448.552h80.314v-448.632z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-right" d="M849.067 409.6c4.267 8.533 4.267 21.333 0 34.133-4.267 4.267-4.267 8.533-8.533 12.8l-298.667 298.667c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133h-494.933c-25.6 0-42.667-17.067-42.667-42.667s17.067-42.667 42.667-42.667h494.933l-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8l298.667 298.667c4.267 4.267 8.533 8.533 8.533 12.8z" />
|
||||||
|
<glyph unicode="" glyph-name="info" d="M512.067 12.187c-235.648 0-426.666 191.017-426.666 426.665s191.018 426.668 426.666 426.668 426.665-191.018 426.665-426.668c0-235.648-191.017-426.665-426.665-426.665zM512.067 97.522c90.527 0 177.347 35.958 241.357 99.973 64.015 64.010 99.978 150.83 99.978 241.357 0 90.528-35.963 177.348-99.978 241.36-64.010 64.013-150.83 99.975-241.357 99.975s-177.347-35.962-241.359-99.975c-64.013-64.012-99.974-150.832-99.974-241.36s35.961-177.347 99.974-241.357c64.012-64.015 150.832-99.973 241.359-99.973v0zM469.4 652.186h85.331v-85.334h-85.331v85.334zM469.4 481.519h85.331v-255.997h-85.331v255.997z" />
|
||||||
|
<glyph unicode="" glyph-name="light-mode" d="M480 790.857v32c0 8.487 3.372 16.627 9.373 22.627s14.14 9.373 22.627 9.373c8.487 0 16.627-3.372 22.627-9.373s9.373-14.14 9.373-22.627v-32c0-8.487-3.372-16.627-9.373-22.627s-14.14-9.373-22.627-9.373c-8.487 0-16.627 3.372-22.627 9.373s-9.373 14.14-9.373 22.627zM512 694.857c-50.632 0-100.127-15.014-142.226-43.144s-74.911-68.111-94.287-114.89c-19.376-46.778-24.445-98.251-14.568-147.91s34.259-95.273 70.061-131.075c35.802-35.802 81.417-60.186 131.076-70.061 49.659-9.882 101.132-4.813 147.91 14.566 46.776 19.373 86.763 52.186 114.891 94.285 28.128 42.1 43.142 91.595 43.142 142.227-0.077 67.873-27.072 132.944-75.066 180.938-47.987 47.993-113.062 74.988-180.934 75.062zM233.36 672.217c6.004-6.004 14.148-9.378 22.64-9.378s16.636 3.373 22.64 9.378c6.004 6.004 9.378 14.148 9.378 22.64s-3.373 16.636-9.378 22.64l-32 32c-6.004 6.004-14.148 9.378-22.64 9.378s-16.636-3.373-22.64-9.378c-6.004-6.004-9.378-14.148-9.378-22.64s3.373-16.636 9.378-22.64l32-32zM233.36 205.5l-32-32c-6.004-6.010-9.378-14.15-9.378-22.643s3.373-16.634 9.378-22.643c6.004-6.003 14.148-9.376 22.64-9.376s16.636 3.373 22.64 9.376l32 32c2.973 2.976 5.332 6.509 6.941 10.394 1.609 3.878 2.437 8.045 2.437 12.25s-0.828 8.371-2.437 12.25c-1.609 3.885-3.967 7.418-6.941 10.394-2.973 2.97-6.503 5.331-10.387 6.938s-8.048 2.438-12.253 2.438c-4.205 0-8.368-0.832-12.253-2.438s-7.414-3.968-10.387-6.938zM768 662.857c4.205-0.003 8.365 0.822 12.25 2.428s7.418 3.962 10.394 6.932l32 32c6.003 6.004 9.376 14.148 9.376 22.64s-3.373 16.636-9.376 22.64c-6.010 6.004-14.15 9.378-22.643 9.378s-16.634-3.373-22.643-9.378l-32-32c-4.48-4.476-7.526-10.179-8.768-16.39-1.235-6.211-0.602-12.648 1.824-18.499s6.528-10.849 11.795-14.365c5.267-3.516 11.462-5.39 17.792-5.385zM790.643 205.5c-6.010 6.003-14.15 9.376-22.643 9.376s-16.634-3.373-22.643-9.376c-6.003-6.010-9.376-14.15-9.376-22.643s3.373-16.634 9.376-22.643l32-32c2.976-2.97 6.509-5.331 10.394-6.938 3.878-1.606 8.045-2.438 12.25-2.438s8.371 0.832 12.25 2.438c3.885 1.606 7.418 3.968 10.394 6.938 2.97 2.976 5.331 6.509 6.938 10.394 1.606 3.878 2.438 8.045 2.438 12.25s-0.832 8.371-2.438 12.25c-1.606 3.885-3.968 7.418-6.938 10.394l-32 32zM160 470.857h-32c-8.487 0-16.627-3.372-22.627-9.373s-9.373-14.14-9.373-22.627c0-8.487 3.372-16.627 9.373-22.627s14.14-9.373 22.627-9.373h32c8.487 0 16.627 3.372 22.627 9.373s9.373 14.14 9.373 22.627c0 8.487-3.372 16.627-9.373 22.627s-14.14 9.373-22.627 9.373zM512 118.857c-8.487 0-16.627-3.373-22.627-9.37-6.001-6.003-9.373-14.144-9.373-22.63v-32c0-8.486 3.372-16.627 9.373-22.63 6.001-5.997 14.14-9.37 22.627-9.37s16.627 3.373 22.627 9.37c6.001 6.003 9.373 14.144 9.373 22.63v32c0 8.486-3.372 16.627-9.373 22.63-6.001 5.997-14.14 9.37-22.627 9.37zM896 470.857h-32c-8.486 0-16.627-3.372-22.63-9.373-5.997-6.001-9.37-14.14-9.37-22.627s3.373-16.627 9.37-22.627c6.003-6.001 14.144-9.373 22.63-9.373h32c8.486 0 16.627 3.372 22.63 9.373 5.997 6.001 9.37 14.14 9.37 22.627s-3.373 16.627-9.37 22.627c-6.003 6.001-14.144 9.373-22.63 9.373z" />
|
||||||
|
<glyph unicode="" glyph-name="menu" d="M102.4 592.457h819.2v-76.8h-819.2v76.8zM102.4 336.457h614.4v-76.8h-614.4v76.8z" />
|
||||||
|
<glyph unicode="" glyph-name="award" d="M853.333 597.334c0 187.733-153.6 341.333-341.333 341.333s-341.333-153.6-341.333-341.333c0-110.933 51.2-209.067 132.267-268.8l-46.933-366.933c-4.267-17.067 4.267-34.133 17.067-42.667s29.867-8.533 46.933 0l192 115.2 192-115.2c4.267-4.267 12.8-4.267 21.333-4.267s17.067 4.267 21.333 8.533 21.333 25.6 17.067 42.667l-46.933 362.667c85.333 59.733 136.533 157.867 136.533 268.8zM256 597.334c0 140.8 115.2 256 256 256s256-115.2 256-256-115.2-256-256-256-256 115.2-256 256zM669.867 38.4l-136.533 81.067c-12.8 8.533-29.867 8.533-42.667 0l-136.533-81.067 29.867 243.2c38.4-17.067 81.067-25.6 128-25.6s89.6 8.533 128 25.6l29.867-243.2z" />
|
||||||
|
<glyph unicode="" glyph-name="reference" d="M673.003 542.703l-345.633-345.63-56.781 56.784 345.589 345.628h-304.589v80.314h441.726v-441.723h-80.312v304.628z" />
|
||||||
|
<glyph unicode="" glyph-name="chevron-down" d="M797.867 584.534c-17.067 17.067-42.667 17.067-59.733 0l-226.133-226.133-226.133 226.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l256-256c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8l256 256c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||||
|
<glyph unicode="" glyph-name="chevron-left" d="M443.733 426.667l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-256-256c-17.067-17.067-17.067-42.667 0-59.733l256-256c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133z" />
|
||||||
|
<glyph unicode="" glyph-name="chevron-right" d="M669.867 456.534l-256 256c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l256 256c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||||
|
<glyph unicode="" glyph-name="chevron-up" d="M797.867 328.534l-256 256c-17.067 17.067-42.667 17.067-59.733 0l-256-256c-17.067-17.067-17.067-42.667 0-59.733s42.667-17.067 59.733 0l226.133 226.133 226.133-226.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733z" />
|
||||||
|
<glyph unicode="" glyph-name="reply-2" d="M487.619 292.571h-97.524c-79.989 0.031-158.465-21.804-226.944-63.142s-124.356-100.609-161.591-171.404c-1.047 13.144-1.567 26.317-1.56 39.497 0 269.313 218.307 487.621 487.619 487.621v268.19l512.002-414.476-512.002-414.478v268.192zM390.095 390.094h195.048v-161.304l259.46 210.066-259.46 210.066v-161.304h-97.524c-56.064 0.063-111.48-11.987-162.456-35.324s-96.308-57.413-132.895-99.893c62.967 24.956 130.095 37.745 197.827 37.693z" />
|
||||||
|
<glyph unicode="" glyph-name="search" d="M754.345 253.441l171.99-171.948-56.82-56.826-171.954 171.996c-63.982-51.29-143.561-79.185-225.561-79.071-199.499 0-361.412 161.912-361.412 361.412s161.912 361.412 361.412 361.412c199.497 0 361.409-161.912 361.409-361.412 0.12-82-27.774-161.581-79.065-225.563zM673.786 283.239c50.965 52.411 79.426 122.662 79.312 195.765 0 155.327-125.811 281.098-281.098 281.098-155.327 0-281.098-125.771-281.098-281.098 0-155.287 125.771-281.1 281.098-281.1 73.103-0.114 143.355 28.347 195.762 79.312l6.024 6.024z" />
|
||||||
|
<glyph unicode="" glyph-name="success" d="M512.067 12.187c-235.648 0-426.666 191.017-426.666 426.665s191.018 426.668 426.666 426.668 426.665-191.018 426.665-426.668c0-235.648-191.017-426.665-426.665-426.665zM512.067 97.522c90.527 0 177.347 35.958 241.357 99.973 64.015 64.010 99.978 150.83 99.978 241.357 0 90.528-35.963 177.348-99.978 241.36-64.010 64.013-150.83 99.975-241.357 99.975s-177.347-35.962-241.359-99.975c-64.013-64.012-99.974-150.832-99.974-241.36s35.961-177.347 99.974-241.357c64.012-64.015 150.832-99.973 241.359-99.973zM469.528 268.187l-181.034 181.034 60.33 60.33 120.704-120.701 241.322 241.363 60.375-60.33-301.698-301.695z" />
|
||||||
|
<glyph unicode="" glyph-name="twitter-x" d="M593.043 504.051l317.127 360.525h-75.149l-275.361-313.039-219.932 313.039h-253.665l332.58-473.37-332.58-378.064h75.153l290.79 330.578 232.262-330.578h253.664l-344.89 490.909zM490.109 387.035l-301.814 422.211h115.432l531.332-743.292h-115.43l-229.519 321.080z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-down" horiz-adv-x="964" d="M441.452 250.82v488.798h80.301l0.028-488.768 215.378 215.379 56.79-56.79-312.347-312.345-312.347 312.345 56.79 56.79 215.406-215.409z" />
|
||||||
|
<glyph unicode="" glyph-name="filter" horiz-adv-x="970" d="M404.211 196.331h161.684v80.842h-161.684v-80.842zM121.263 681.383v-80.842h727.579v80.842h-727.579zM242.526 398.436h485.053v80.842h-485.053v-80.842z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-short-left" horiz-adv-x="964" d="M293.963 479.405h488.798v-80.301l-488.768-0.028 215.379-215.378-56.79-56.79-312.345 312.347 312.345 312.347 56.79-56.79-215.409-215.406z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-long-left" d="M874.667 472.99h-601.6l149.333 140.8-46.933 46.933-238.933-221.867 238.933-221.867 46.933 46.933-149.333 140.8h601.6z" />
|
||||||
|
<glyph unicode="" glyph-name="message-square" d="M810.667 853.334h-597.333c-72.533 0-128-55.467-128-128v-682.667c0-17.067 8.533-34.133 25.6-38.4 4.267-4.267 12.8-4.267 17.067-4.267 12.8 0 21.333 4.267 29.867 12.8l157.867 157.867h494.933c72.533 0 128 55.467 128 128v426.667c0 72.533-55.467 128-128 128zM853.333 298.667c0-25.6-17.067-42.667-42.667-42.667h-512c-12.8 0-21.333-4.267-29.867-12.8l-98.133-98.133v580.267c0 25.6 17.067 42.667 42.667 42.667h597.333c25.6 0 42.667-17.067 42.667-42.667v-426.667z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-short-right" horiz-adv-x="964" d="M670.037 398.309h-488.798v80.301l488.768 0.028-215.379 215.378 56.79 56.79 312.345-312.347-312.345-312.347-56.79 56.79 215.409 215.406z" />
|
||||||
|
<glyph unicode="" glyph-name="timer" d="M512 778.667c-75.948 0-150.19-22.521-213.339-64.715s-112.367-102.167-141.431-172.334c-29.064-70.167-36.668-147.376-21.851-221.865s51.389-142.912 105.092-196.614c53.704-53.701 122.126-90.273 196.615-105.092s151.698-7.212 221.865 21.848c70.167 29.067 130.137 78.285 172.333 141.436 42.196 63.145 64.717 137.388 64.717 213.336-0.117 101.808-40.609 199.412-112.596 271.4-71.992 71.989-169.596 112.483-271.404 112.6zM694.64 532.027l-160-160c-2.973-2.973-6.502-5.331-10.387-6.941s-8.048-2.437-12.253-2.437c-4.204 0-8.368 0.828-12.252 2.437s-7.414 3.967-10.388 6.941c-2.973 2.973-5.331 6.502-6.941 10.387s-2.437 8.048-2.437 12.253c0 4.205 0.828 8.368 2.437 12.253s3.967 7.414 6.941 10.387l160 160c2.973 2.973 6.503 5.331 10.388 6.941s8.048 2.437 12.252 2.437c4.205 0 8.368-0.828 12.253-2.437s7.414-3.967 10.387-6.941c2.973-2.973 5.332-6.502 6.941-10.387s2.438-8.048 2.438-12.253c0-4.205-0.829-8.368-2.438-12.253s-3.967-7.414-6.941-10.387zM384 874.667c0 8.487 3.372 16.626 9.373 22.627s14.141 9.373 22.627 9.373h192c8.487 0 16.626-3.371 22.627-9.373s9.373-14.14 9.373-22.627c0-8.487-3.371-16.626-9.373-22.627s-14.141-9.373-22.627-9.373h-192c-8.487 0-16.626 3.371-22.627 9.373s-9.373 14.141-9.373 22.627z" />
|
||||||
|
<glyph unicode="" glyph-name="music" d="M921.6 844.8c-8.533 8.533-21.333 8.533-34.133 8.533l-512-85.333c-17.067-4.267-34.133-21.333-34.133-42.667v-469.333h-128c-72.533 0-128-55.467-128-128s55.467-128 128-128h85.333c72.533 0 128 55.467 128 128v563.2l426.667 72.533v-422.4h-128c-72.533 0-128-55.467-128-128s55.467-128 128-128h85.333c72.533 0 128 55.467 128 128v597.333c0 12.8-4.267 25.6-17.067 34.133zM341.333 128c0-25.6-17.067-42.667-42.667-42.667h-85.333c-25.6 0-42.667 17.067-42.667 42.667s17.067 42.667 42.667 42.667h128v-42.667zM853.333 213.334c0-25.6-17.067-42.667-42.667-42.667h-85.333c-25.6 0-42.667 17.067-42.667 42.667s17.067 42.667 42.667 42.667h128v-42.667z" />
|
||||||
|
<glyph unicode="" glyph-name="play" d="M832 460.8l-597.333 384c-12.8 8.533-29.867 8.533-42.667 0-12.8-4.267-21.333-17.067-21.333-34.133v-768c0-17.067 8.533-29.867 21.333-38.4 8.533-4.267 12.8-4.267 21.333-4.267s17.067 4.267 21.333 8.533l597.333 384c12.8 8.533 21.333 21.333 21.333 34.133s-8.533 29.867-21.333 34.133zM256 119.467v614.4l477.867-307.2-477.867-307.2z" />
|
||||||
|
<glyph unicode="" glyph-name="facebook" d="M512.001 865.523c-235.648 0-426.667-191.019-426.667-426.667 0-212.947 156.032-389.459 360.022-421.503v298.196h-108.374v123.307h108.374v93.995c0 106.922 63.658 165.973 161.152 165.973 46.676 0 95.489-8.32 95.489-8.32v-104.96h-53.76c-53.036 0-69.548-32.896-69.548-66.645v-80.043h118.316l-18.906-123.307h-99.411v-298.196c203.948 32 359.98 208.595 359.98 421.503 0 235.648-191.021 426.667-426.668 426.667z" />
|
||||||
|
<glyph unicode="" glyph-name="instagram" d="M335.293 862.539c-45.397-2.142-76.399-9.387-103.501-20.036-28.049-10.931-51.823-25.6-75.478-49.34s-38.221-47.531-49.075-75.623c-10.505-27.162-17.622-58.189-19.627-103.612s-2.449-60.024-2.227-175.889c0.222-115.866 0.734-130.388 2.936-175.905 2.167-45.389 9.386-76.384 20.036-103.494 10.948-28.051 25.6-51.814 49.348-75.475 23.748-23.667 47.523-38.195 75.683-49.069 27.136-10.49 58.172-17.638 103.587-19.629 45.414-1.984 60.032-2.445 175.864-2.227 115.832 0.224 130.413 0.736 175.923 2.893 45.51 2.163 76.339 9.434 103.456 20.032 28.051 10.97 51.834 25.6 75.482 49.357 23.642 23.757 38.202 47.565 49.050 75.674 10.515 27.136 17.658 58.17 19.629 103.552 1.984 45.542 2.458 60.081 2.234 175.93s-0.742 130.372-2.899 175.873c-2.163 45.5-9.389 76.399-20.032 103.526-10.963 28.049-25.6 51.798-49.338 75.478-23.744 23.68-47.565 38.23-75.667 49.050-27.155 10.505-58.17 17.664-103.584 19.627s-60.034 2.466-175.908 2.244c-115.875-0.222-130.381-0.717-175.89-2.936zM340.276 91.228c-41.6 1.805-64.188 8.717-79.241 14.502-19.934 7.68-34.133 16.966-49.135 31.821-15.002 14.861-24.218 29.107-32.001 48.998-5.845 15.053-12.885 37.619-14.831 79.219-2.116 44.96-2.56 58.46-2.808 172.372s0.188 127.395 2.159 172.374c1.775 41.566 8.73 64.179 14.506 79.224 7.68 19.96 16.931 34.134 31.821 49.126s29.098 24.227 49.007 32.009c15.036 5.871 37.598 12.851 79.181 14.831 44.996 2.134 58.479 2.56 172.374 2.808s127.411-0.179 172.427-2.159c41.562-1.809 64.186-8.696 79.213-14.507 19.942-7.68 34.131-16.904 49.126-31.821s24.237-29.073 32.019-49.024c5.875-14.993 12.858-37.547 14.822-79.156 2.138-44.996 2.624-58.488 2.829-172.374s-0.192-127.412-2.163-172.372c-1.818-41.6-8.717-64.198-14.509-79.27-7.68-19.923-16.941-34.131-31.84-49.114-14.899-14.989-29.088-24.218-49.005-32-15.021-5.862-37.606-12.864-79.155-14.842-44.998-2.118-58.479-2.56-172.416-2.81-113.938-0.243-127.378 0.218-172.374 2.163zM688.102 666.895c0.019-10.127 3.040-20.022 8.678-28.433 5.645-8.411 13.651-14.96 23.014-18.819s19.661-4.855 29.587-2.861c9.933 1.994 19.046 6.887 26.195 14.061 7.142 7.174 12.006 16.307 13.965 26.243 1.952 9.936 0.922 20.23-2.97 29.579-3.898 9.348-10.477 17.332-18.906 22.943s-18.336 8.593-28.467 8.573c-13.574-0.027-26.586-5.445-36.166-15.062s-14.95-22.646-14.931-36.223zM292.925 438.431c0.239-121.003 98.509-218.87 219.487-218.639s218.916 98.49 218.686 219.493c-0.23 121.003-98.528 218.897-219.523 218.659s-218.881-98.526-218.65-219.512zM369.776 438.584c-0.055 28.129 8.232 55.644 23.813 79.064s37.758 41.693 63.725 52.509c25.967 10.817 54.558 13.69 82.157 8.257s52.969-18.929 72.899-38.78c19.93-19.851 33.524-45.166 39.066-72.744s2.784-56.18-7.93-82.19c-10.712-26.010-28.897-48.259-52.255-63.933-23.357-15.676-50.839-24.072-78.968-24.124-18.678-0.038-37.181 3.597-54.452 10.714-17.27 7.111-32.971 17.556-46.204 30.737s-23.741 28.84-30.922 46.083c-7.181 17.242-10.895 35.731-10.93 54.408z" />
|
||||||
|
<glyph unicode="" glyph-name="menu1" d="M128 682.667h768v-86h-768v86zM128 384.667v84h768v-84h-768zM128 170.667v86h768v-86h-768z" />
|
||||||
|
<glyph unicode="" glyph-name="link" d="M717.056 820.937c-39.977-4.754-75.786-19.573-105.741-41.826l0.589 0.418c-19.008-14.080-70.528-64.96-74.496-73.6-2.039-4.046-3.233-8.818-3.233-13.869 0-17.32 14.040-31.36 31.36-31.36 4.526 0 8.827 0.959 12.713 2.684l-0.2-0.079c3.648 1.536 18.688 14.848 37.056 32.896 36.608 36.032 49.664 45.248 76.928 54.592 15.224 4.832 32.733 7.617 50.893 7.617 9.393 0 18.613-0.745 27.602-2.179l-0.991 0.13c37.961-7.703 70.25-28.008 93.075-56.273l0.237-0.303c11.008-14.336 21.952-35.712 27.392-53.568 4.096-13.696 4.608-18.176 4.736-40.96 0.128-21.696-0.448-27.648-3.712-38.912-12.096-42.048-15.744-46.72-111.616-142.272-83.84-83.52-91.52-90.24-115.2-100.224-23.040-9.664-35.392-12.032-62.016-12.032-20.544 0-27.008 0.64-38.080 3.776-44.416 12.8-76.544 37.696-97.472 75.776-11.776 21.44-16.96 40.96-19.52 73.408-0.896 11.968-2.368 19.712-4.16 22.528-5.871 8.786-15.748 14.494-26.959 14.494-10.912 0-20.56-5.407-26.413-13.689l-0.068-0.101c-4.736-6.848-4.928-7.68-4.8-27.712 0.32-72.128 41.28-143.232 104.704-181.696 11.84-7.168 35.584-17.6 50.56-22.272 39.040-12.032 90.24-11.392 129.28 1.664 31.165 10.083 57.955 26.114 80.254 46.9l-0.126-0.116c24.256 21.824 156.672 155.776 165.376 167.36 17.792 23.744 30.784 51.456 38.528 82.048 4.288 17.024 4.736 21.376 4.672 50.24 0 27.456-0.512 33.664-4.032 47.744-8.737 37.108-25.854 69.369-49.293 95.917l0.205-0.237c-15.626 18.258-34.109 33.518-54.858 45.234l-1.014 0.526c-24.769 14.52-53.997 24.321-85.202 27.386l-0.878 0.070c-6.777 0.937-14.607 1.472-22.562 1.472-8.294 0-16.453-0.582-24.437-1.706l0.919 0.106zM384.256 627.273c-26.432-4.416-60.416-17.92-83.392-33.152-16.896-11.136-37.632-30.72-113.216-106.88-82.816-83.328-88.768-90.56-104.128-125.504-14.4-32.64-19.648-60.8-18.176-97.6 2.176-54.528 23.616-104.576 61.12-142.528 13.832-14.62 29.75-27.071 47.32-36.925l1-0.515c30.997-17.996 68.209-28.617 107.901-28.617 48.724 0 93.71 16.005 129.988 43.044l-0.577-0.411c19.008 14.080 70.528 64.96 74.496 73.6 9.728 21.12-4.864 45.184-27.456 45.184-12.48 0-18.304-4.096-50.24-35.456-16.96-16.704-35.072-33.088-40.256-36.48-24.16-16.184-53.888-25.829-85.868-25.829-29.001 0-56.149 7.931-79.394 21.743l0.717-0.395c-34.624 20.672-58.176 51.264-70.4 91.328-4.032 13.248-4.544 17.92-4.672 40.576-0.128 21.696 0.448 27.648 3.712 38.912 12.096 42.048 15.744 46.72 111.616 142.272 84.736 84.416 91.264 90.048 116.608 100.8 21.312 9.024 35.008 11.584 61.44 11.52 19.456-0.064 26.368-0.768 37.248-3.904 44.288-12.608 76.672-37.76 97.344-75.52 11.904-21.76 16.128-36.992 18.944-68.544 1.408-15.68 3.072-24.768 4.928-27.584 5.856-8.786 15.725-14.497 26.927-14.497 10.903 0 20.542 5.409 26.381 13.691l0.068 0.102c4.736 6.848 4.928 7.68 4.8 27.712-0.448 102.464-79.424 193.344-182.4 210.048-10.648 1.437-22.956 2.257-35.456 2.257-13.022 0-25.835-0.89-38.384-2.612l1.456 0.164z" />
|
||||||
|
<glyph unicode="" glyph-name="pinterest" d="M570.454 861.513c-102.090 14.044-205.814-9.325-292.019-65.79s-149.068-142.214-176.982-241.412c-27.914-99.199-18.995-205.148 25.112-298.282s120.422-167.168 214.854-208.422c-2.554 32.774-0.21 65.747 6.955 97.83 7.893 35.802 55.296 233.090 55.296 233.090-9.439 21.158-14.157 44.119-13.824 67.286 0 63.36 36.565 110.634 82.048 110.634 8.171 0.119 16.271-1.523 23.751-4.814s14.163-8.154 19.596-14.259c5.433-6.105 9.487-13.308 11.888-21.119s3.091-16.048 2.024-24.15c0-38.4-24.661-96.512-37.546-151.040-2.547-10-2.708-20.459-0.472-30.534 2.237-10.074 6.808-19.482 13.347-27.462 6.538-7.987 14.861-14.323 24.298-18.496 9.436-4.179 19.722-6.080 30.028-5.555 80.981 0 135.255 103.723 135.255 226.176 0 93.867-62.168 164.181-176.77 164.181-27.419 1.066-54.768-3.453-80.387-13.28s-48.973-24.759-68.645-43.889c-19.672-19.129-35.251-42.057-45.791-67.391s-15.821-52.546-15.523-79.984c-1.222-30.435 8.598-60.286 27.648-84.053 3.56-2.657 6.159-6.4 7.406-10.664s1.073-8.817-0.494-12.973c-1.962-7.851-6.912-26.584-8.874-33.451-0.408-2.33-1.358-4.531-2.772-6.426s-3.254-3.43-5.372-4.486c-2.117-1.056-4.452-1.6-6.817-1.587s-4.694 0.582-6.799 1.664c-59.051 23.635-86.87 88.616-86.87 162.814 0 121.472 101.718 266.88 305.238 266.88 161.962 0 269.655-118.486 269.655-245.206 0-166.786-92.89-292.181-230.146-292.181-20.515-0.653-40.863 3.872-59.165 13.165s-33.964 23.046-45.539 40c0 0-24.661-98.816-29.525-117.504-9.929-32.288-24.58-62.925-43.478-90.925 39.382-11.949 80.299-17.92 121.43-17.747 56.045-0.045 111.55 10.963 163.332 32.397 51.789 21.44 98.835 52.877 138.451 92.525 39.616 39.642 71.027 86.714 92.422 138.515 21.402 51.798 32.378 107.309 32.288 163.356-0.051 103.040-37.382 202.582-105.101 280.244s-161.248 128.201-263.324 142.284l-0.085 0.043z" />
|
||||||
|
<glyph unicode="" glyph-name="watch" d="M853.333 426.667c0 98.133-42.667 183.467-106.667 247.467l-12.8 149.333c-8.533 64-59.733 115.2-128 115.2 0 0 0 0 0 0h-187.733c-64 0-119.467-51.2-128-115.2l-12.8-149.333c-64-59.733-106.667-149.333-106.667-247.467s42.667-187.733 106.667-247.467l12.8-149.333c8.533-64 64-115.2 128-115.2 0 0 0 0 0 0h183.467c0 0 0 0 0 0 68.267 0 119.467 51.2 128 115.2l12.8 145.067c68.267 64 110.933 153.6 110.933 251.733zM375.467 814.934c0 21.333 21.333 38.4 42.667 38.4h187.733c21.333 0 42.667-17.067 42.667-38.4l8.533-76.8c-46.933 17.067-93.867 29.867-145.067 29.867s-98.133-12.8-140.8-29.867l4.267 76.8zM256 426.667c0 140.8 115.2 256 256 256s256-115.2 256-256-115.2-256-256-256-256 115.2-256 256zM648.533 38.4c0-21.333-21.333-38.4-42.667-38.4 0 0 0 0 0 0h-187.733c0 0 0 0 0 0-21.333 0-38.4 17.067-42.667 38.4l-8.533 76.8c42.667-21.333 89.6-29.867 140.8-29.867s98.133 12.8 140.8 29.867v-76.8zM546.133 332.8c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-51.2 51.2v110.933c0 25.6-17.067 42.667-42.667 42.667s-42.667-17.067-42.667-42.667v-128c0-12.8 4.267-21.333 12.8-29.867l64-64z" />
|
||||||
|
<glyph unicode="" glyph-name="snapchat" d="M912.448 235.241c-3.501 11.597-20.282 19.763-20.282 19.763h0.019c-1.549 0.87-2.982 1.6-4.186 2.17-27.917 13.517-52.634 29.715-73.485 48.166-16.749 14.8-31.078 31.133-42.618 48.5-14.048 21.183-20.634 38.867-23.494 48.45-1.568 6.233-1.318 8.717 0 11.967 1.114 2.717 4.294 5.366 5.862 6.55 9.453 6.667 24.621 16.5 33.933 22.534 8.070 5.217 15.021 9.733 19.066 12.55 13.12 9.167 22.067 18.5 27.373 28.55 6.861 13.017 7.661 27.35 2.33 41.45-7.2 19.016-24.947 30.367-47.482 30.367-5.037 0-10.17-0.567-15.302-1.683-12.896-2.8-25.165-7.384-35.43-11.384-0.173-0.068-0.358-0.092-0.544-0.069s-0.358 0.091-0.512 0.198c-0.147 0.108-0.269 0.252-0.352 0.418s-0.122 0.351-0.109 0.536c1.101 25.416 2.298 59.55-0.518 92.033-2.534 29.35-8.57 54.083-18.451 75.633-9.933 21.65-22.797 37.7-32.896 49.25-9.651 11.034-26.522 27.25-52.003 41.834-35.884 20.533-76.717 30.933-121.367 30.933-44.533 0-85.333-10.4-121.267-30.933-26.966-15.4-44.216-32.833-52.083-41.834-10.1-11.55-22.983-27.6-32.916-49.25-9.884-21.55-15.917-46.284-18.45-75.633-2.817-32.55-1.684-63.983-0.517-92.017 0.033-0.817-0.767-1.4-1.533-1.1-10.25 4-22.533 8.584-35.416 11.384-5.117 1.116-10.267 1.683-15.3 1.683-22.534 0-40.284-11.35-47.484-30.367-5.333-14.1-4.516-28.433 2.333-41.45 5.3-10.050 14.266-19.383 27.366-28.55 4.050-2.817 11.017-7.333 19.067-12.55 9.133-5.917 23.867-15.467 33.35-22.117 1.167-0.833 5.15-3.85 6.433-6.966 1.35-3.334 1.583-5.85-0.133-12.467-2.933-9.684-9.533-27.133-23.333-47.95-11.533-17.367-25.884-33.7-42.634-48.5-20.85-18.451-45.567-34.65-73.484-48.166-1.3-0.634-2.883-1.434-4.6-2.419v0.019c0 0-16.65-8.531-19.8-19.533-4.65-16.25 7.717-31.469 20.383-39.635 20.667-13.331 45.834-20.499 60.433-24.384 4.067-1.082 7.75-2.067 11.1-3.117 2.1-0.698 7.35-2.682 9.6-5.568 2.833-3.629 3.167-8.166 4.184-13.229 1.633-8.55 5.183-19.187 15.766-26.483 11.633-8.051 26.417-8.621 45.133-9.338 19.583-0.749 43.95-1.683 71.833-10.88 12.917-4.269 24.634-11.469 38.184-19.802 28.317-17.402 63.567-39.046 123.783-39.046 60.25 0 95.734 21.766 124.25 39.264 13.465 8.269 25.1 15.418 37.734 19.584 27.885 9.216 52.25 10.131 71.834 10.88 18.701 0.717 33.485 1.286 45.133 9.338 11.315 7.814 14.598 19.462 16.064 28.282 0.8 4.333 1.35 8.23 3.853 11.43 2.118 2.739 6.97 4.672 9.267 5.453 3.43 1.082 7.251 2.118 11.469 3.232 14.598 3.885 32.883 8.518 55.162 21.101 26.637 15.053 28.454 33.734 25.683 42.918z" />
|
||||||
|
<glyph unicode="" glyph-name="tiktok" d="M772.32 667.757c-5.402 2.791-10.662 5.85-15.75 9.167-14.816 9.793-28.397 21.331-40.454 34.367-30.163 34.516-41.434 69.533-45.581 94.050h0.166c-3.469 20.35-2.035 33.517-1.818 33.517h-137.4v-531.302c0-7.13 0-14.182-0.3-21.146 0-0.87-0.084-1.67-0.134-2.605 0-0.378 0-0.781-0.083-1.178 0-0.102 0-0.205 0-0.301-1.448-19.066-7.559-37.478-17.795-53.626s-24.283-29.53-40.906-38.976c-17.324-9.856-36.918-15.027-56.85-15.002-64.017 0-115.9 52.198-115.9 116.666s51.884 116.669 115.9 116.669c12.118 0.012 24.161-1.896 35.683-5.65l0.167 139.9c-34.977 4.518-70.511 1.738-104.361-8.164s-65.279-26.712-92.306-49.369c-23.682-20.577-43.592-45.128-58.833-72.55-5.8-10-27.683-50.183-30.333-115.402-1.667-37.018 9.45-75.366 14.75-91.213v-0.333c3.333-9.338 16.25-41.184 37.3-68.038 16.974-21.536 37.028-40.454 59.517-56.147v0.333l0.333-0.333c66.516-45.203 140.267-42.234 140.267-42.234 12.766 0.518 55.533 0 104.1 23.014 53.867 25.517 84.533 63.533 84.533 63.533 19.592 22.72 35.168 48.608 46.067 76.55 12.435 32.685 16.582 71.885 16.582 87.552v281.867c1.664-1 23.866-15.683 23.866-15.683s31.987-20.5 81.888-33.85c35.795-9.5 84.032-11.5 84.032-11.5v136.4c-16.902-1.834-51.219 3.5-86.349 21.016z" />
|
||||||
|
<glyph unicode="" glyph-name="tumblr" d="M85.333 865.523v-853.335h853.336v853.335h-853.336zM692.102 176.31c-21.984-11.757-44.826-20.224-68.575-25.338-20.225-5.056-42.159-7.501-65.905-7.501-20.452 0-43.974 3.296-71.020 9.946-21.99 8.461-38.861 18.63-50.624 30.394-15.34 13.805-25.51 27.104-30.396 40.621-6.876 17.101-10.227 37.331-10.227 60.851v205.501h-63.464v83.636c20.396 6.93 39.713 17.781 58.348 33.123 18.638 15.056 32.214 31.93 40.622 50.566 6.649 15.339 13.523 40.62 20.227 76.132h80.564v-152.493h136.469v-90.963h-136.469v-149.596c0-33.972 3.066-55.905 8.181-66.132 1.761-8.41 7.783-15.968 17.785-22.842 17.046-8.237 32.156-12.442 45.679-12.442 28.634 0 58.405 10.003 88.799 30.4v-93.862h0.006z" />
|
||||||
|
<glyph unicode="" glyph-name="vimeo" d="M213.333 865.523h597.336c70.688 0 128-57.308 128-128v-597.335c0-70.688-57.312-128-128-128h-597.336c-70.692 0-128 57.312-128 128v597.335c0 70.692 57.308 128 128 128zM513.667 185.526c55 34.995 236.669 189.997 268.33 371.664 31.667 181.667-216.664 143.333-244.997-15 66.667 40 103.333-16.666 68.333-78.333-33.333-65-65-105-81.667-105-15 0-26.667 41.667-45 116.667-4.548 17.057-8.063 37.39-11.699 58.431-12.353 71.474-26.116 151.112-86.634 138.236-75-13.333-173.333-131.667-173.333-131.667l21.667-31.667c0 0 50 40 65 20 9.252-11.103 32.373-86.924 54.534-159.601 17.759-58.237 34.902-114.456 43.799-133.733 18.333-35.002 68.333-84.998 121.667-49.997z" />
|
||||||
|
<glyph unicode="" glyph-name="zap" d="M934.4 529.067c-8.533 17.067-21.333 25.6-38.4 25.6h-337.067l38.4 294.4c4.267 17.067-8.533 38.4-25.6 42.667-17.067 8.533-38.4 4.267-51.2-12.8l-426.667-512c-8.533-12.8-12.8-29.867-4.267-46.933 8.533-12.8 21.333-21.333 38.4-21.333h337.067l-38.4-294.4c-4.267-17.067 8.533-38.4 25.6-42.667 4.267-4.267 12.8-4.267 17.067-4.267 12.8 0 25.6 4.267 34.133 17.067l426.667 512c8.533 12.8 12.8 29.867 4.267 42.667zM529.067 140.8l25.6 196.267c0 12.8-4.267 25.6-8.533 34.133-8.533 8.533-21.333 12.8-34.133 12.8h-294.4l273.067 328.533-21.333-196.267c0-12.8 4.267-25.6 8.533-34.133 8.533-8.533 21.333-12.8 29.867-12.8h294.4l-273.067-328.533z" />
|
||||||
|
<glyph unicode="" d="M932.659 642.595c-10.253 36.546-39.84 65.164-77.766 74.938-50.938 18.952-544.359 28.237-687.494-0.543-37.925-9.883-67.623-38.392-77.766-74.938-22.991-97.203-24.739-307.355 0.564-406.727 10.256-36.55 39.841-65.165 77.766-74.938 100.87-22.374 580.428-25.523 687.5 0 37.92 9.882 67.622 38.387 77.76 74.938 24.518 105.889 26.266 303.009-0.563 407.27z" />
|
||||||
|
<glyph unicode="" d="M656.538 438.962l-229.917 127.069v-254.138l229.917 127.069z" />
|
||||||
|
<glyph unicode="" glyph-name="image" d="M810.667 853.334h-597.333c-72.533 0-128-55.467-128-128v-597.333c0-72.533 55.467-128 128-128h597.333c72.533 0 128 55.467 128 128v597.333c0 72.533-55.467 128-128 128zM170.667 725.334c0 25.6 17.067 42.667 42.667 42.667h597.333c25.6 0 42.667-17.067 42.667-42.667v-324.267l-140.8 140.8c-17.067 17.067-42.667 17.067-59.733 0l-452.267-452.267c-17.067 4.267-29.867 21.333-29.867 38.4v597.333zM810.667 85.334h-494.933l366.933 366.933 170.667-170.667v-153.6c0-25.6-17.067-42.667-42.667-42.667zM362.667 469.334c59.733 0 106.667 46.933 106.667 106.667s-46.933 106.667-106.667 106.667-106.667-46.933-106.667-106.667 46.933-106.667 106.667-106.667zM362.667 597.334c12.8 0 21.333-8.533 21.333-21.333s-8.533-21.333-21.333-21.333-21.333 8.533-21.333 21.333 8.533 21.333 21.333 21.333z" />
|
||||||
|
<glyph unicode="" glyph-name="x" d="M93.55 892.27c-16.497-6.865-29.239-19.964-35.474-36.28l-0.147-0.437c-1.987-6.144-3.133-13.214-3.133-20.55 0-8.974 1.714-17.547 4.832-25.411l-0.163 0.467c3.218-7.168 33.134-37.888 185.051-189.879l181.248-181.321-181.979-182.199c-204.654-204.946-188.343-186.295-188.343-214.601 0-12.946 0.731-16.823 4.462-24.722 6.892-13.186 17.388-23.682 30.184-30.388l0.39-0.186c7.973-3.803 11.703-4.462 25.6-4.462 29.257 0 12.069-14.994 216.722 189.513l180.078 180.005 180.078-180.151c150.382-150.455 181.541-180.809 189.367-184.686 8.265-4.096 11.41-4.681 25.6-4.681 13.897 0 17.627 0.658 25.6 4.462 5.193 2.414 13.166 8.119 17.774 12.8 4.681 4.608 10.386 12.581 12.8 17.774 3.803 7.973 4.462 11.703 4.462 25.6 0 29.257 14.921 12.142-189.074 216.283l-179.493 179.639 179.493 179.639c203.995 204.142 189.074 187.026 189.074 216.283 0 13.897-0.658 17.627-4.462 25.6-6.892 13.186-17.388 23.682-30.184 30.388l-0.39 0.186c-8.046 3.803-11.63 4.462-25.6 4.389-13.093 0-17.847-0.731-24.795-3.877-7.168-3.218-38.254-33.499-189.367-184.686l-180.882-180.882-180.078 180.005c-202.825 202.679-187.099 188.782-215.040 189.879-12.288 0.512-15.945-0.073-24.21-3.511z" />
|
||||||
|
<glyph unicode="" glyph-name="arrow-long-right" d="M648.533 660.724l-46.933-46.933 149.333-140.8h-601.6v-68.267h601.6l-149.333-140.8 46.933-46.933 238.933 221.867z" />
|
||||||
|
<glyph unicode="" glyph-name="comments" d="M528.002 854.857c-106.053-0.116-207.727-42.297-282.717-117.286s-117.169-176.663-117.286-282.712v-336.002c0-16.975 6.743-33.252 18.745-45.256 12.002-11.999 28.281-18.744 45.255-18.744h336.002c106.086 0 207.825 42.142 282.838 117.16 75.017 75.013 117.16 176.752 117.16 282.843 0 106.084-42.142 207.826-117.16 282.84-75.013 75.015-176.752 117.157-282.838 117.157zM352 390.859c-9.493 0-18.774 2.811-26.667 8.085-7.894 5.278-14.046 12.772-17.679 21.546-3.633 8.769-4.584 18.418-2.732 27.732 1.853 9.309 6.424 17.864 13.137 24.576s15.266 11.283 24.576 13.137c9.311 1.852 18.963 0.901 27.733-2.729 8.771-3.635 16.268-9.789 21.542-17.683s8.090-17.171 8.090-26.666c0-12.73-5.057-24.939-14.059-33.941s-21.211-14.057-33.941-14.057zM528.002 390.859c-9.495 0-18.776 2.811-26.671 8.085-7.894 5.278-14.043 12.772-17.678 21.546-3.635 8.769-4.585 18.418-2.732 27.732 1.853 9.309 6.423 17.864 13.135 24.576 6.717 6.712 15.267 11.283 24.581 13.137 9.309 1.852 18.963 0.901 27.732-2.729 8.769-3.635 16.268-9.789 21.541-17.683s8.090-17.171 8.090-26.666c0-12.73-5.059-24.939-14.057-33.941-9.002-9.002-21.211-14.057-33.941-14.057zM704 390.859c-9.495 0-18.772 2.811-26.666 8.085-7.894 5.278-14.047 12.772-17.683 21.546-3.631 8.769-4.58 18.418-2.728 27.732 1.853 9.309 6.423 17.864 13.135 24.576s15.267 11.283 24.576 13.137c9.314 1.852 18.963 0.901 27.732-2.729 8.774-3.635 16.268-9.789 21.546-17.683 5.274-7.894 8.085-17.171 8.085-26.666 0-12.73-5.055-24.939-14.057-33.941s-21.211-14.057-33.941-14.057z" />
|
||||||
|
<glyph unicode="" glyph-name="LinkedIn" d="M138.667 862.878c-25.131-6.784-42.24-23.424-50.133-48.768-3.072-9.984-3.2-22.613-3.2-375.083 0-330.368 0.256-365.653 2.731-374.059 7.68-25.771 23.253-41.643 48.683-49.579 9.984-3.072 22.613-3.2 375.253-3.2s365.269 0.128 375.253 3.2c25.429 7.936 41.003 23.808 48.683 49.579 2.475 8.405 2.731 43.691 2.731 374.016 0 360.491-0.043 364.885-3.413 375.851-6.601 20.984-21.914 37.526-41.588 45.648l-0.481 0.176-9.984 4.011-367.787 0.341c-313.003 0.256-369.109-0.043-376.747-2.133zM305.877 739.742c15.189-7.168 26.795-18.261 33.963-32.555 5.589-11.136 5.76-12.075 5.76-32s-0.171-20.864-5.845-32.427c-9.771-19.84-24.491-31.573-47.019-37.419-5.649-1.545-12.136-2.433-18.829-2.433-13.131 0-25.463 3.417-36.158 9.41l0.374-0.192c-12.392 8.346-22.355 19.387-29.207 32.329l-0.233 0.482c-6.443 14.208-7.424 37.803-2.219 53.248 5.077 16.097 15.521 29.268 29.191 37.72l0.291 0.168c12.715 8.192 20.437 9.984 40.533 9.515 16.043-0.427 19.115-1.024 29.397-5.845zM697.173 552.009c30.336-6.613 63.829-28.757 81.835-54.101 14.891-20.992 22.485-40.32 28.715-72.704 3.669-19.157 3.755-22.741 3.755-152.747l0.043-133.12-125.141-0.896-0.768 115.669c-0.725 109.355-0.981 116.48-4.352 131.669-2.078 9.553-4.81 17.893-8.277 25.838l0.341-0.878c-6.626 12.175-16.747 21.732-29.009 27.484l-0.389 0.164c-13.013 5.931-35.328 7.296-50.944 3.072-25.984-7.040-47.573-28.971-57.259-58.069-1.749-5.291-2.475-33.28-3.2-125.44l-0.896-118.613-125.44-0.896v406.229h119.381l0.469-27.392 0.469-27.435 10.112 12.16c22.187 26.624 57.344 46.379 94.251 52.907 11.392 2.005 51.797 0.256 66.304-2.901zM337.92 341.577v-203.093h-124.587v406.187h124.587v-203.093z" />
|
||||||
|
<glyph unicode="" glyph-name="location" d="M486.4 896.286c-148.674-11.068-271.579-110.241-317.369-245.040l-0.754-2.555c-14.507-44.331-18.987-76.544-17.579-127.019 1.792-65.493 15.573-122.88 45.611-190.080 49.664-111.104 144.597-226.773 266.368-324.608 26.027-20.949 35.797-26.069 49.323-26.069 13.483 0 23.296 5.12 48.896 25.728 50.731 40.747 107.691 95.403 147.157 141.227 88.064 102.144 143.744 212.352 160.853 318.293 4.437 27.477 6.144 82.816 3.328 107.563-10.942 96.443-58.099 180.176-127.327 238.57l-0.545 0.448c-62.843 52.487-144.49 84.355-233.58 84.355-8.579 0-17.090-0.296-25.521-0.877l1.138 0.063zM536.747 810.825c67.462-5.942 127.082-35.478 171.415-80.194l0.019-0.020c57.899-57.941 86.016-134.784 80.128-219.221-8.021-114.859-70.315-233.728-184.149-351.317-28.203-29.184-88.021-83.029-92.16-83.029-4.181 0-63.957 53.888-92.715 83.584-113.28 116.949-175.616 236.032-183.595 350.763-5.888 84.523 22.144 161.237 80.128 219.221 51.285 51.243 118.912 79.957 192.768 81.792 5.163 0.085 17.835-0.597 28.16-1.579zM488.96 703.988c-12.373-2.005-32.299-7.851-45.013-13.312-74.027-31.659-115.797-113.963-98.005-192.896 17.609-76.582 85.19-132.829 165.908-132.829 5.552 0 11.041 0.266 16.456 0.786l-0.689-0.054c65.94 6.324 120.454 49.333 143.304 108.148l0.398 1.164c31.744 84.352-8.917 180.437-91.264 215.68-18.519 8.624-40.204 13.655-63.063 13.655-0.255 0-0.509-0.001-0.763-0.002h0.039c-2.99 0.11-6.502 0.173-10.029 0.173-6.078 0-12.113-0.187-18.099-0.555l0.821 0.040zM536.021 617.033c25.344-7.424 47.829-28.587 56.576-53.291 4.309-12.245 5.76-34.005 3.115-46.763-4.949-23.851-24.363-48.597-46.379-59.051-10.822-5.429-23.582-8.608-37.083-8.608-23.539 0-44.821 9.661-60.098 25.235l-0.013 0.013c-18.816 18.859-26.709 39.595-25.003 65.835 1.877 29.397 16.555 53.035 42.752 68.992 16.512 10.069 46.251 13.483 66.133 7.637z" />
|
||||||
|
<glyph unicode="" glyph-name="not-found" d="M844.85 616.278l-217.6 217.601c-2.888 2.886-6.317 5.174-10.091 6.734s-7.818 2.362-11.902 2.358h-373.029c-16.489 0-32.303-6.55-43.962-18.21s-18.21-27.473-18.21-43.962v-683.886c0-16.489 6.55-32.303 18.21-43.962s27.473-18.21 43.962-18.21h559.543c16.489 0 32.303 6.551 43.962 18.21s18.21 27.472 18.21 43.962v497.371c0.003 4.084-0.799 8.128-2.358 11.902s-3.847 7.203-6.735 10.091zM627.25 274.335c2.888-2.888 5.179-6.317 6.744-10.091 1.562-3.774 2.367-7.818 2.367-11.902s-0.805-8.128-2.367-11.902c-1.565-3.774-3.856-7.203-6.744-10.091s-6.317-5.179-10.091-6.744c-3.774-1.562-7.818-2.367-11.902-2.367s-8.128 0.805-11.902 2.367c-3.774 1.565-7.203 3.856-10.091 6.744l-71.265 71.303-71.265-71.303c-2.888-2.888-6.317-5.179-10.091-6.744-3.774-1.562-7.818-2.367-11.902-2.367s-8.128 0.805-11.902 2.367c-3.774 1.565-7.203 3.856-10.091 6.744s-5.179 6.317-6.744 10.091c-1.562 3.774-2.367 7.818-2.367 11.902s0.805 8.128 2.367 11.902c1.565 3.774 3.856 7.203 6.744 10.091l71.303 71.265-71.303 71.265c-5.834 5.831-9.111 13.745-9.111 21.993s3.277 16.162 9.111 21.993c5.831 5.834 13.745 9.111 21.993 9.111s16.162-3.277 21.993-9.111l71.265-71.303 71.265 71.303c2.888 2.888 6.317 5.179 10.091 6.744 3.774 1.562 7.818 2.367 11.902 2.367s8.128-0.805 11.902-2.367c3.774-1.565 7.203-3.856 10.091-6.744s5.179-6.317 6.744-10.091c1.562-3.774 2.367-7.818 2.367-11.902s-0.805-8.128-2.367-11.902c-1.565-3.774-3.856-7.203-6.744-10.091l-71.303-71.265 71.303-71.265zM605.257 594.286v170.971l170.97-170.971h-170.97z" />
|
||||||
|
<glyph unicode="" glyph-name="location-fill" d="M512 886.857c-93.324-0.106-182.795-37.226-248.785-103.215s-103.11-155.461-103.215-248.785c0-301.203 320-528.678 333.64-538.202 5.38-3.77 11.79-5.792 18.36-5.792s12.979 2.022 18.36 5.792c13.64 9.523 333.64 236.998 333.64 538.202-0.109 93.324-37.222 182.795-103.213 248.785s-155.464 103.11-248.787 103.215zM512 662.857c25.316 0 50.063-7.507 71.113-21.572s37.455-34.056 47.144-57.444c9.688-23.389 12.22-49.126 7.284-73.955-4.939-24.829-17.13-47.637-35.031-65.538s-40.708-30.092-65.538-35.031c-24.829-4.939-50.566-2.404-73.955 7.284s-43.38 26.094-57.444 47.144c-14.065 21.050-21.572 45.797-21.572 71.113 0 33.948 13.485 66.505 37.491 90.509s56.562 37.491 90.509 37.491z" />
|
||||||
|
<glyph unicode="" glyph-name="new-window" d="M600.73 828.131c-17.533-3.531-30.552-18.81-30.552-37.129 0-10.481 4.261-19.966 11.146-26.818l0.002-0.001c11.366-11.418 9.472-11.213 104.755-11.264l86.17-0.051-129.946-130.099c-71.475-71.578-131.277-132.762-132.864-135.987-3.635-7.27-3.891-22.886-0.461-30.925 4.316-8.681 11.161-15.559 19.564-19.802l0.25-0.114c7.424-3.072 19.763-3.328 28.416-0.563 5.683 1.792 29.491 24.73 137.83 132.915l130.97 130.816 0.051-86.17c0.051-79.77 0.256-86.682 3.174-93.030 12.493-27.341 49.613-30.822 66.202-6.195 7.219 10.65 7.475 16.947 7.014 155.699l-0.461 132.403-5.171 8.346c-3.539 5.461-8.056 9.978-13.343 13.411l-0.174 0.106-8.346 5.171-134.144 0.256c-73.728 0.102-136.806-0.307-140.083-0.973zM181.402 699.977c-29.491-4.403-54.221-29.696-58.624-60.058-2.048-14.182-2.048-515.942 0-530.125 4.669-31.166 28.994-55.491 59.768-60.112l0.392-0.048c14.182-2.048 515.942-2.048 530.125 0 31.642 4.608 55.808 29.184 60.262 61.235 0.922 6.963 1.434 71.629 1.126 158.362-0.512 162.253 0.154 152.525-11.725 164.352-6.346 6.666-15.287 10.812-25.196 10.812-0.718 0-1.432-0.022-2.139-0.065l0.097 0.005c-16.282 0-31.642-11.162-35.789-25.958-1.024-3.635-1.638-61.747-1.638-149.76l-0.051-143.77h-500.019v500.019l143.77 0.051c89.651 0 146.074 0.614 149.862 1.69 10.158 3.804 18.23 11.195 22.83 20.595l0.108 0.243c1.76 4.715 2.778 10.163 2.778 15.848 0 5.246-0.867 10.289-2.466 14.995l0.097-0.328c-2.21 4.476-4.966 8.312-8.247 11.626l0.004-0.004c-11.878 11.93-1.69 11.213-167.117 11.469-82.125 0.154-153.293-0.358-158.208-1.075z" />
|
||||||
|
<glyph unicode="" glyph-name="reply" horiz-adv-x="1182" d="M99.923 493.713l325.875-327.182 36.644 36.644-261.87 263.055h248.782c278.76 0 577.151-126.947 577.151-486.851h51.042v11.784c-6.546 320.636-251.282 526.107-628.193 526.107h-252.585l265.672 265.672-36.644 36.645-325.875-325.875zM425.797 166.531l-27.905-27.793 27.849-27.963 27.905 27.908-27.849 27.848zM99.923 493.713l-27.849 27.85-27.793-27.794 27.738-27.849 27.905 27.793zM462.442 203.176l27.849-27.849 27.787 27.786-27.724 27.85-27.912-27.787zM200.572 466.231v39.385h-94.781l66.868-67.171 27.913 27.787zM1026.505-20.62h-39.385v-39.385h39.385v39.385zM1077.547-20.62v-39.385h39.385v39.385h-39.385zM1077.547-8.836h39.392l-0.016 0.803-39.377-0.803zM196.769 517.271l-27.849 27.85-67.234-67.234h95.083v39.385zM462.442 782.943l27.849-27.849 27.85 27.849-27.85 27.85-27.849-27.85zM425.797 819.588l27.849 27.849-27.849 27.849-27.85-27.849 27.85-27.849zM453.702 194.324l-325.874 327.183-55.81-55.587 325.874-327.182 55.81 55.586zM434.593 231.024l-36.645-36.644 55.699-55.697 36.644 36.643-55.698 55.698zM172.659 438.444l261.871-263.055 55.824 55.572-261.87 263.055-55.825-55.572zM449.354 505.615h-248.782v-78.769h248.782v78.769zM1065.889-20.62c0 192.653-80.746 326.461-200.814 410.639-118.164 82.836-271.254 115.596-415.721 115.596v-78.769c134.293 0 269.778-30.714 370.5-101.326 98.816-69.272 167.266-178.89 167.266-346.14h78.769zM1077.547 18.765h-51.042v-78.769h51.042v78.769zM1038.163-8.836v-11.784h78.769v11.784h-78.769zM449.354 477.886c181.552 0 327.273-49.461 427.686-133.615 99.801-83.643 158.074-204.154 161.13-353.91l78.753 1.607c-3.489 170.882-70.861 313.421-189.29 412.674-117.815 98.74-282.917 152.014-478.28 152.014v-78.769zM196.769 477.886h252.585v78.769h-252.585v-78.769zM434.593 810.793l-265.672-265.672 55.698-55.699 265.672 265.672-55.698 55.699zM397.948 791.738l36.645-36.644 55.698 55.699-36.644 36.644-55.699-55.699zM127.772 465.865l325.874 325.874-55.699 55.699-325.874-325.874 55.698-55.699z" />
|
||||||
|
<glyph unicode="" glyph-name="byuser" d="M599.777 650.773l-87.777 61.151-87.777-61.151-105.31-18.829-18.829-105.31-61.151-87.777 61.151-87.777 18.829-105.312 105.31-18.828 87.777-61.15 87.777 61.15 105.312 18.828 18.828 105.312 61.15 87.777-61.15 87.777-18.828 105.31-105.312 18.829zM545.785 485.36l-33.785 90.030-33.785-90.030-96.065-4.311 75.182-59.955-25.583-92.696 80.251 52.978 80.251-52.978-25.583 92.696 75.182 59.955-96.065 4.311z" />
|
||||||
|
<glyph unicode="" glyph-name="eye" d="M512 768c-223.318 0-416.882-130.042-512-320 95.118-189.958 288.682-320 512-320 223.312 0 416.876 130.042 512 320-95.116 189.958-288.688 320-512 320zM764.45 598.296c60.162-38.374 111.142-89.774 149.434-150.296-38.292-60.522-89.274-111.922-149.436-150.296-75.594-48.218-162.89-73.704-252.448-73.704-89.56 0-176.858 25.486-252.452 73.704-60.158 38.372-111.138 89.772-149.432 150.296 38.292 60.524 89.274 111.924 149.434 150.296 3.918 2.5 7.876 4.922 11.86 7.3-9.96-27.328-15.41-56.822-15.41-87.596 0-141.382 114.616-256 256-256 141.382 0 256 114.618 256 256 0 30.774-5.452 60.268-15.408 87.598 3.978-2.378 7.938-4.802 11.858-7.302v0zM512 544c0-53.020-42.98-96-96-96s-96 42.98-96 96 42.98 96 96 96 96-42.982 96-96z" />
|
||||||
|
<glyph unicode="" glyph-name="comment-o" d="M512 731.428c-237.714 0-438.857-133.714-438.857-292.571 0-85.143 57.143-166.286 156-222.286l49.714-28.571-15.429-54.857c-10.857-40.571-25.143-72-40-98.286 57.714 24 110.286 56.571 157.143 97.714l24.571 21.714 32.571-3.429c24.571-2.857 49.714-4.571 74.286-4.571 237.714 0 438.857 133.714 438.857 292.571s-201.143 292.571-438.857 292.571zM1024 438.857c0-202.286-229.143-365.714-512-365.714-28 0-56 1.714-82.857 4.571-74.857-66.286-164-113.143-262.857-138.286-20.571-5.714-42.857-9.714-65.143-12.571h-2.857c-11.429 0-21.714 9.143-24.571 21.714v0.571c-2.857 14.286 6.857 22.857 15.429 33.143 36 40.571 77.143 74.857 104 170.286-117.714 66.857-193.143 170.286-193.143 286.286 0 202.286 229.143 365.714 512 365.714v0c282.857 0 512-163.429 512-365.714z" />
|
||||||
|
<glyph unicode="" glyph-name="comments-o" d="M402.286 731.428c-178.286 0-329.143-100.571-329.143-219.429 0-62.857 42.286-123.429 115.429-165.714l55.429-32-20-48c12 6.857 24 14.286 35.429 22.286l25.143 17.714 30.286-5.714c28.571-5.143 57.714-8 87.429-8 178.286 0 329.143 100.571 329.143 219.429s-150.857 219.429-329.143 219.429zM402.286 804.571c222.286 0 402.286-130.857 402.286-292.571s-180-292.571-402.286-292.571c-34.857 0-68.571 3.429-100.571 9.143-47.429-33.714-101.143-58.286-158.857-73.143-15.429-4-32-6.857-49.143-9.143h-1.714c-8.571 0-16.571 6.857-18.286 16.571v0c-2.286 10.857 5.143 17.714 11.429 25.143 22.286 25.143 47.429 47.429 66.857 94.857-92.571 53.714-152 136.571-152 229.143 0 161.714 180 292.571 402.286 292.571zM872 136.571c19.429-47.429 44.571-69.714 66.857-94.857 6.286-7.429 13.714-14.286 11.429-25.143v0c-2.286-10.286-10.857-17.714-20-16.571-17.143 2.286-33.714 5.143-49.143 9.143-57.714 14.857-111.429 39.429-158.857 73.143-32-5.714-65.714-9.143-100.571-9.143-103.429 0-198.286 28.571-269.714 75.429 16.571-1.143 33.714-2.286 50.286-2.286 122.857 0 238.857 35.429 327.429 99.429 95.429 69.714 148 164 148 266.286 0 29.714-4.571 58.857-13.143 86.857 96.571-53.143 159.429-137.714 159.429-233.143 0-93.143-59.429-175.429-152-229.143z" />
|
||||||
|
<glyph unicode="" glyph-name="mail-reply, reply1" d="M1024 310.857c0-80-40-184.571-72.571-257.714-6.286-13.143-12.571-31.429-21.143-43.429-4-5.714-8-9.714-16-9.714-11.429 0-18.286 9.143-18.286 20 0 9.143 2.286 19.429 2.857 28.571 1.714 23.429 2.857 46.857 2.857 70.286 0 272.571-161.714 320-408 320h-128v-146.286c0-20-16.571-36.571-36.571-36.571-9.714 0-18.857 4-25.714 10.857l-292.571 292.571c-6.857 6.857-10.857 16-10.857 25.714s4 18.857 10.857 25.714l292.571 292.571c6.857 6.857 16 10.857 25.714 10.857 20 0 36.571-16.571 36.571-36.571v-146.286h128c187.429 0 420.571-33.143 500-230.286 24-60.571 30.286-126.286 30.286-190.286z" />
|
||||||
|
</font></defs></svg>
|
||||||
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/static/icon-fonts/icons.ttf
Normal file
BIN
assets/static/icon-fonts/icons.woff
Normal file
1
assets/static/icon-fonts/selection.json
Normal file
473
assets/static/js/comment-reply.js
Normal file
@@ -0,0 +1,473 @@
|
|||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Comment Reply */
|
||||||
|
|
||||||
|
/* jshint ignore:start */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the addition of the comment form.
|
||||||
|
*
|
||||||
|
* @since 2.7.0
|
||||||
|
* @output wp-includes/js/comment-reply.js
|
||||||
|
*
|
||||||
|
* @namespace addComment
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
window.addComment = ( function ( window ) {
|
||||||
|
// Avoid scope lookups on commonly used variables.
|
||||||
|
var document = window.document;
|
||||||
|
|
||||||
|
// Settings.
|
||||||
|
var config = {
|
||||||
|
commentReplyClass : 'comment-reply-link',
|
||||||
|
commentReplyTitleId : 'reply-title',
|
||||||
|
cancelReplyId : 'cancel-comment-reply-link',
|
||||||
|
commentFormId : 'commentform',
|
||||||
|
temporaryFormClass : 'wp-temp-form-div',
|
||||||
|
parentIdFieldId : 'comment_parent',
|
||||||
|
postIdFieldId : 'comment_post_ID',
|
||||||
|
commentsWrap : 'comments',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Cross browser MutationObserver.
|
||||||
|
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
||||||
|
|
||||||
|
// Check browser cuts the mustard.
|
||||||
|
var cutsTheMustard = 'querySelector' in document && 'addEventListener' in window;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check browser supports dataset.
|
||||||
|
* !! sets the variable to true if the property exists.
|
||||||
|
*/
|
||||||
|
var supportsDataset = ! ! document.documentElement.dataset;
|
||||||
|
|
||||||
|
// For holding the cancel element.
|
||||||
|
var cancelElement;
|
||||||
|
|
||||||
|
// For holding the comment form element.
|
||||||
|
var commentFormElement;
|
||||||
|
|
||||||
|
// The respond element.
|
||||||
|
var respondElement;
|
||||||
|
|
||||||
|
// The mutation observer.
|
||||||
|
var observer;
|
||||||
|
|
||||||
|
if ( cutsTheMustard && document.readyState !== 'loading' ) {
|
||||||
|
ready();
|
||||||
|
} else if ( cutsTheMustard ) {
|
||||||
|
window.addEventListener( 'DOMContentLoaded', ready, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up object variables after the DOM is ready.
|
||||||
|
*
|
||||||
|
* @since 5.1.1
|
||||||
|
*/
|
||||||
|
function ready() {
|
||||||
|
// Initialize the events.
|
||||||
|
init();
|
||||||
|
|
||||||
|
// Set up a MutationObserver to check for comments loaded late.
|
||||||
|
observeChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add events to links classed .comment-reply-link.
|
||||||
|
*
|
||||||
|
* Searches the context for reply links and adds the JavaScript events
|
||||||
|
* required to move the comment form. To allow for lazy loading of
|
||||||
|
* comments this method is exposed as window.commentReply.init().
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @memberOf addComment
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} context The parent DOM element to search for links.
|
||||||
|
*/
|
||||||
|
function init(context) {
|
||||||
|
if (!cutsTheMustard) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const observerOptions = {
|
||||||
|
root: null,
|
||||||
|
rootMargin: '0px',
|
||||||
|
threshold: 0.1,
|
||||||
|
};
|
||||||
|
|
||||||
|
let currentPost = null;
|
||||||
|
|
||||||
|
const observer = new IntersectionObserver((entries) => {
|
||||||
|
entries.forEach((entry) => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
const post = entry.target;
|
||||||
|
|
||||||
|
if (currentPost !== post) {
|
||||||
|
currentPost = post;
|
||||||
|
|
||||||
|
cancelElement = post.querySelector(`#${config.cancelReplyId}`);
|
||||||
|
commentFormElement = post.querySelector(`#${config.commentFormId}`);
|
||||||
|
|
||||||
|
if (cancelElement) {
|
||||||
|
cancelElement.addEventListener('click', cancelEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commentFormElement) {
|
||||||
|
const submitFormHandler = function (e) {
|
||||||
|
if ((e.metaKey || e.ctrlKey) && e.keyCode === 13) {
|
||||||
|
commentFormElement.removeEventListener('keydown', submitFormHandler);
|
||||||
|
e.preventDefault();
|
||||||
|
commentFormElement.submit.click();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
commentFormElement.addEventListener('keydown', submitFormHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCancelReplyLink(post);
|
||||||
|
|
||||||
|
const links = replyLinks(post);
|
||||||
|
if (links) {
|
||||||
|
Array.from(links).forEach((link) => {
|
||||||
|
link.addEventListener('click', clickEvent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, observerOptions);
|
||||||
|
|
||||||
|
const posts = document.querySelectorAll('#' + config.commentsWrap );
|
||||||
|
posts.forEach((post) => {
|
||||||
|
observer.observe(post);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return all links classed .comment-reply-link.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} context The parent DOM element to search for links.
|
||||||
|
*
|
||||||
|
* @return {HTMLCollection|NodeList|Array}
|
||||||
|
*/
|
||||||
|
function replyLinks( context ) {
|
||||||
|
var selectorClass = config.commentReplyClass;
|
||||||
|
var allReplyLinks;
|
||||||
|
|
||||||
|
if ( ! context || ! context.childNodes ) {
|
||||||
|
context = document;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( document.getElementsByClassName ) {
|
||||||
|
allReplyLinks = context.getElementsByClassName( selectorClass );
|
||||||
|
} else {
|
||||||
|
allReplyLinks = context.querySelectorAll( '.' + selectorClass );
|
||||||
|
}
|
||||||
|
|
||||||
|
return allReplyLinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCancelReplyLink( postElement ) {
|
||||||
|
const cancelLink = postElement.querySelector(`#${config.cancelReplyId}`);
|
||||||
|
const postIdField = postElement.querySelector(`#${config.postIdFieldId}`);
|
||||||
|
const postId = postIdField ? postIdField.value : null;
|
||||||
|
|
||||||
|
if (cancelLink && postId) {
|
||||||
|
const currentPostUrl = `${window.location.origin}${window.location.pathname}#respond-${postId}`;
|
||||||
|
cancelLink.setAttribute('href', currentPostUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel event handler.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param {Event} event The calling event.
|
||||||
|
*/
|
||||||
|
function cancelEvent( event ) {
|
||||||
|
var cancelLink = this;
|
||||||
|
var commentsWrapElement = event.target.closest( '#' + config.commentsWrap );
|
||||||
|
var temporaryElement = commentsWrapElement.querySelector( '.' + config.temporaryFormClass );
|
||||||
|
|
||||||
|
if ( ! temporaryElement || ! respondElement ) {
|
||||||
|
// Conditions for cancel link fail.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
commentsWrapElement.querySelector( '#' + config.parentIdFieldId ).value = 0;
|
||||||
|
|
||||||
|
// Move the respond form back in place of the temporary element.
|
||||||
|
var headingText = temporaryElement.textContent;
|
||||||
|
temporaryElement.parentNode.replaceChild( respondElement, temporaryElement );
|
||||||
|
cancelLink.style.display = 'none';
|
||||||
|
|
||||||
|
var replyHeadingElement = commentsWrapElement.querySelector( '#' + config.commentReplyTitleId );
|
||||||
|
var replyHeadingTextNode = replyHeadingElement && replyHeadingElement.firstChild;
|
||||||
|
var replyLinkToParent = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
|
||||||
|
|
||||||
|
if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE && headingText ) {
|
||||||
|
if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
|
||||||
|
replyLinkToParent.style.display = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
replyHeadingTextNode.textContent = headingText;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Click event handler.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param {Event} event The calling event.
|
||||||
|
*/
|
||||||
|
function clickEvent( event ) {
|
||||||
|
var commentsWrapElement = event.target.closest( '#' + config.commentsWrap );
|
||||||
|
var replyNode = commentsWrapElement.querySelector( '#' + config.commentReplyTitleId );
|
||||||
|
var defaultReplyHeading = replyNode && replyNode.firstChild.textContent;
|
||||||
|
var replyLink = this,
|
||||||
|
commId = getDataAttribute( replyLink, 'belowelement' ),
|
||||||
|
parentId = getDataAttribute( replyLink, 'commentid' ),
|
||||||
|
respondId = getDataAttribute( replyLink, 'respondelement' ),
|
||||||
|
postId = getDataAttribute( replyLink, 'postid' ),
|
||||||
|
replyTo = getDataAttribute( replyLink, 'replyto' ) || defaultReplyHeading,
|
||||||
|
follow;
|
||||||
|
|
||||||
|
if ( ! commId || ! parentId || ! respondId || ! postId ) {
|
||||||
|
/*
|
||||||
|
* Theme or plugin defines own link via custom `wp_list_comments()` callback
|
||||||
|
* and calls `moveForm()` either directly or via a custom event hook.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Third party comments systems can hook into this function via the global scope,
|
||||||
|
* therefore the click event needs to reference the global scope.
|
||||||
|
*/
|
||||||
|
follow = window.addComment.moveForm( commId, parentId, respondId, postId, replyTo, event );
|
||||||
|
if ( false === follow ) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a mutation observer to check for newly inserted comments.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*/
|
||||||
|
function observeChanges() {
|
||||||
|
if ( ! MutationObserver ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var observerOptions = {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
};
|
||||||
|
|
||||||
|
observer = new MutationObserver( handleChanges );
|
||||||
|
observer.observe( document.body, observerOptions );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles DOM changes, calling init() if any new nodes are added.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param {Array} mutationRecords Array of MutationRecord objects.
|
||||||
|
*/
|
||||||
|
function handleChanges( mutationRecords ) {
|
||||||
|
var i = mutationRecords.length;
|
||||||
|
|
||||||
|
while ( i-- ) {
|
||||||
|
// Call init() once if any record in this set adds nodes.
|
||||||
|
if ( mutationRecords[ i ].addedNodes.length ) {
|
||||||
|
init();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Backward compatible getter of data-* attribute.
|
||||||
|
*
|
||||||
|
* Uses element.dataset if it exists, otherwise uses getAttribute.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} Element DOM element with the attribute.
|
||||||
|
* @param {string} Attribute the attribute to get.
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
function getDataAttribute( element, attribute ) {
|
||||||
|
if ( supportsDataset ) {
|
||||||
|
return element.dataset[attribute];
|
||||||
|
} else {
|
||||||
|
return element.getAttribute( 'data-' + attribute );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get element by ID.
|
||||||
|
*
|
||||||
|
* Local alias for document.getElementById.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} The requested element.
|
||||||
|
*/
|
||||||
|
function getElementById( elementId ) {
|
||||||
|
return document.getElementById( elementId );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the reply form from its current position to the reply location.
|
||||||
|
*
|
||||||
|
* @since 2.7.0
|
||||||
|
*
|
||||||
|
* @memberOf addComment
|
||||||
|
*
|
||||||
|
* @param {string} addBelowId HTML ID of element the form follows.
|
||||||
|
* @param {string} commentId Database ID of comment being replied to.
|
||||||
|
* @param {string} respondId HTML ID of 'respond' element.
|
||||||
|
* @param {string} postId Database ID of the post.
|
||||||
|
* @param {string} replyTo Form heading content.
|
||||||
|
*/
|
||||||
|
function moveForm( addBelowId, commentId, respondId, postId, replyTo, event ) {
|
||||||
|
// Get elements based on their IDs.
|
||||||
|
var commentsWrapElement = event.target.closest( '#' + config.commentsWrap );
|
||||||
|
|
||||||
|
var addBelowElement = commentsWrapElement.querySelector( '#' + addBelowId );
|
||||||
|
respondElement = commentsWrapElement.querySelector( '#' + respondId );
|
||||||
|
// Get the hidden fields.
|
||||||
|
var parentIdField = commentsWrapElement.querySelector( '#' + config.parentIdFieldId );
|
||||||
|
var postIdField = commentsWrapElement.querySelector( '#' + config.postIdFieldId );
|
||||||
|
var element, cssHidden, style;
|
||||||
|
|
||||||
|
var replyHeading = commentsWrapElement.querySelector( '#' + config.commentReplyTitleId );
|
||||||
|
var replyHeadingTextNode = replyHeading && replyHeading.firstChild;
|
||||||
|
var replyLinkToParent = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
|
||||||
|
|
||||||
|
if ( ! addBelowElement || ! respondElement || ! parentIdField ) {
|
||||||
|
// Missing key elements, fail.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'undefined' === typeof replyTo ) {
|
||||||
|
replyTo = replyHeadingTextNode && replyHeadingTextNode.textContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
addPlaceHolder( respondElement, event );
|
||||||
|
|
||||||
|
// Set the value of the post.
|
||||||
|
if ( postId && postIdField ) {
|
||||||
|
postIdField.value = postId;
|
||||||
|
}
|
||||||
|
|
||||||
|
parentIdField.value = commentId;
|
||||||
|
cancelElement.style.display = '';
|
||||||
|
addBelowElement.querySelector( '.comment-body' ).insertBefore( respondElement, null );
|
||||||
|
|
||||||
|
if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
|
||||||
|
if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
|
||||||
|
replyLinkToParent.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
replyHeadingTextNode.textContent = replyTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is for backward compatibility with third party commenting systems
|
||||||
|
* hooking into the event using older techniques.
|
||||||
|
*/
|
||||||
|
cancelElement.onclick = function () {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Focus on the first field in the comment form.
|
||||||
|
try {
|
||||||
|
for ( var i = 0; i < commentFormElement.elements.length; i++ ) {
|
||||||
|
element = commentFormElement.elements[i];
|
||||||
|
cssHidden = false;
|
||||||
|
|
||||||
|
// Get elements computed style.
|
||||||
|
if ( 'getComputedStyle' in window ) {
|
||||||
|
// Modern browsers.
|
||||||
|
style = window.getComputedStyle( element );
|
||||||
|
} else if ( document.documentElement.currentStyle ) {
|
||||||
|
// IE 8.
|
||||||
|
style = element.currentStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For display none, do the same thing jQuery does. For visibility,
|
||||||
|
* check the element computed style since browsers are already doing
|
||||||
|
* the job for us. In fact, the visibility computed style is the actual
|
||||||
|
* computed value and already takes into account the element ancestors.
|
||||||
|
*/
|
||||||
|
if ( ( element.offsetWidth <= 0 && element.offsetHeight <= 0 ) || style.visibility === 'hidden' ) {
|
||||||
|
cssHidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip form elements that are hidden or disabled.
|
||||||
|
if ( 'hidden' === element.type || element.disabled || cssHidden ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
element.focus();
|
||||||
|
// Stop after the first focusable element.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* false is returned for backward compatibility with third party commenting systems
|
||||||
|
* hooking into this function.
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add placeholder element.
|
||||||
|
*
|
||||||
|
* Places a place holder element above the #respond element for
|
||||||
|
* the form to be returned to if needs be.
|
||||||
|
*
|
||||||
|
* @since 2.7.0
|
||||||
|
*
|
||||||
|
* @param {HTMLelement} respondElement the #respond element holding comment form.
|
||||||
|
*/
|
||||||
|
function addPlaceHolder( respondElement, event ) {
|
||||||
|
var commentsWrapElement = event.target.closest( '#' + config.commentsWrap );
|
||||||
|
var temporaryElement = commentsWrapElement.querySelector( '.' + config.temporaryFormClass );
|
||||||
|
var replyElement = respondElement.querySelector( '#' + config.commentReplyTitleId );
|
||||||
|
var initialHeadingText = replyElement ? replyElement.firstChild.textContent : '';
|
||||||
|
if ( temporaryElement ) {
|
||||||
|
// The element already exists, no need to recreate.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
temporaryElement = document.createElement( 'div' );
|
||||||
|
temporaryElement.classList.add( config.temporaryFormClass );
|
||||||
|
temporaryElement.style.display = 'none';
|
||||||
|
temporaryElement.textContent = initialHeadingText;
|
||||||
|
respondElement.parentNode.insertBefore( temporaryElement, respondElement );
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
init: init,
|
||||||
|
moveForm: moveForm
|
||||||
|
};
|
||||||
|
})( window );
|
||||||
|
|
||||||
|
/* jshint ignore:end */
|
||||||
14
assets/static/js/swiper-bundle.min.js
vendored
Normal file
98
comments.php
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The template for displaying comments
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_comments_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_comments_before' );
|
||||||
|
|
||||||
|
$button_text = '';
|
||||||
|
$button_class = '';
|
||||||
|
$comments_number = get_comments_number();
|
||||||
|
|
||||||
|
if ( $comments_number > 0 ) {
|
||||||
|
$button_text = sprintf( __( 'View Comments (%s)', 'revision' ), $comments_number );
|
||||||
|
} else {
|
||||||
|
$button_text = __( 'Write a Comment', 'revision' );
|
||||||
|
$button_class = 'cs-button';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="cs-entry__comments" id="comments">
|
||||||
|
|
||||||
|
<div class="cs-entry__comments-header">
|
||||||
|
<div class="cs-entry__comments-header-top">
|
||||||
|
<div class="cs-entry__comments-header-comment-view-toggle">
|
||||||
|
<span class="cs-entry__comments-view-toggle <?php echo esc_attr( $button_class ); ?>"><?php echo esc_html( $button_text ); ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-entry__comments-inner">
|
||||||
|
|
||||||
|
<?php if ( have_comments() ) { ?>
|
||||||
|
|
||||||
|
<?php the_comments_navigation(); ?>
|
||||||
|
|
||||||
|
<ol class="comment-list">
|
||||||
|
<?php
|
||||||
|
wp_list_comments(
|
||||||
|
array(
|
||||||
|
'callback' => 'csco_comments_callback',
|
||||||
|
'style' => 'ol',
|
||||||
|
'short_ping' => true,
|
||||||
|
'avatar_size' => 30, // Use 0 to disable avatar.
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<?php the_comments_navigation(); ?>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
comment_form(
|
||||||
|
array(
|
||||||
|
'title_reply' => esc_html__( 'Leave a Comment', 'revision' ),
|
||||||
|
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
|
||||||
|
'title_reply_after' => '</h2>',
|
||||||
|
'submit_button' => '<button name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s">' . esc_html__( 'Submit Comment', 'revision' ) . ' </button>',
|
||||||
|
'submit_field' => '<p class="form-submit">%1$s %2$s <span class="cs-cancel-reply-button"></span></p>',
|
||||||
|
'cancel_reply_link' => esc_html__( 'Cancel', 'revision' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// If comments are closed and there are comments, let's leave a little note, shall we?
|
||||||
|
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'revision' ); ?></p>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_comments_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_comments_after' );
|
||||||
|
?>
|
||||||
361
core/customizer/assets/customizer-rtl.css
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
/**
|
||||||
|
* Heading
|
||||||
|
*/
|
||||||
|
.customize-control-heading {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description
|
||||||
|
*/
|
||||||
|
.customize-control-description {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checkbox
|
||||||
|
*/
|
||||||
|
.customize-control-checkbox + .customize-control-checkbox {
|
||||||
|
margin-top: -12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio
|
||||||
|
*/
|
||||||
|
.customize-control-radio .customize-inside-control-row {
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Divider
|
||||||
|
*/
|
||||||
|
.customizer-divider {
|
||||||
|
border-bottom: 1px dashed #dcdcde;
|
||||||
|
margin: 4px -12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color
|
||||||
|
*/
|
||||||
|
.customize-control-color[id*=is_dark],
|
||||||
|
.customize-control-color-alpha[id*=is_dark] {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark] .expand-setting,
|
||||||
|
.customize-control-color-alpha[id*=is_dark] .expand-setting {
|
||||||
|
position: absolute;
|
||||||
|
top: -82px;
|
||||||
|
left: 0;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.5;
|
||||||
|
transition: opacity 0.25s;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark] .expand-setting:before,
|
||||||
|
.customize-control-color-alpha[id*=is_dark] .expand-setting:before {
|
||||||
|
display: block;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg width='14' height='15' viewBox='0 0 14 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.66536 4.16683C5.66523 5.09392 5.94124 6.00005 6.45818 6.76964C6.97513 7.53923 7.70959 8.1374 8.56788 8.48787C9.42618 8.83835 10.3694 8.92523 11.2773 8.73744C12.1852 8.54965 13.0165 8.09571 13.6654 7.4335V7.50016C13.6654 11.1822 10.6807 14.1668 6.9987 14.1668C3.3167 14.1668 0.332031 11.1822 0.332031 7.50016C0.332031 3.81816 3.3167 0.833496 6.9987 0.833496H7.06536C6.62139 1.26758 6.26879 1.78614 6.02835 2.35862C5.78791 2.93109 5.66449 3.54591 5.66536 4.16683ZM1.66536 7.50016C1.66488 8.69015 2.06238 9.84611 2.79463 10.7841C3.52687 11.7222 4.55179 12.3883 5.70631 12.6767C6.86082 12.9651 8.07862 12.859 9.16593 12.3755C10.2532 11.8919 11.1476 11.0586 11.7067 10.0082C10.7117 10.2426 9.67322 10.2189 8.68991 9.93931C7.7066 9.65973 6.81103 9.13355 6.08817 8.41069C5.36531 7.68783 4.83913 6.79226 4.55955 5.80895C4.27997 4.82564 4.25627 3.7872 4.4907 2.79216C3.63708 3.24692 2.92322 3.92527 2.42554 4.75459C1.92785 5.58391 1.66508 6.53297 1.66536 7.50016Z' fill='%23000000'/%3E%3C/svg%3E%0A");
|
||||||
|
background-size: contain;
|
||||||
|
width: 14px;
|
||||||
|
height: 15px;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark] .expand-setting:hover,
|
||||||
|
.customize-control-color-alpha[id*=is_dark] .expand-setting:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark].customize-control-color-open .expand-setting,
|
||||||
|
.customize-control-color-alpha[id*=is_dark].customize-control-color-open .expand-setting {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open),
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-title,
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-content,
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-content {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container,
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select2
|
||||||
|
*/
|
||||||
|
.select2-dropdown {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container {
|
||||||
|
min-width: 100px;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--open .select2-dropdown--above,
|
||||||
|
.select2-container--open .select2-dropdown--below {
|
||||||
|
z-index: 9999999;
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--multiple,
|
||||||
|
.select2-container--default .select2-selection--single {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||||
|
background-color: rgba(255, 255, 255, 0);
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-customizer .select2-container {
|
||||||
|
z-index: 8 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-customizer .select2-container.select2-container--open {
|
||||||
|
z-index: 999999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collapsibles
|
||||||
|
*/
|
||||||
|
.customize-control-collapsible .customize-collapsible {
|
||||||
|
position: relative;
|
||||||
|
margin: 0 -12px;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3 {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px 14px;
|
||||||
|
color: #555;
|
||||||
|
background: white;
|
||||||
|
line-height: 21px;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3:after {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
left: 14px;
|
||||||
|
color: #a0a5aa;
|
||||||
|
font: 400 20px/1 dashicons;
|
||||||
|
content: "\f343";
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3:hover {
|
||||||
|
color: #0073aa;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3:hover:after {
|
||||||
|
color: #0073aa;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible.customize-control-collapsed {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible.customize-control-collapsed .customize-collapsible h3:after {
|
||||||
|
content: "\f347";
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-hidden {
|
||||||
|
height: 0 !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
visibility: hidden;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alpha Color Picker CSS
|
||||||
|
*/
|
||||||
|
.customize-control-color-alpha .wp-picker-container .iris-picker {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-container {
|
||||||
|
max-width: 257px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-open + .wp-picker-input-wrap {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
|
||||||
|
float: right;
|
||||||
|
width: 195px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap .button {
|
||||||
|
margin-right: 0;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .color-alpha-picker-container {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container {
|
||||||
|
border: 1px solid #dfdfdf;
|
||||||
|
border-top: none;
|
||||||
|
display: none;
|
||||||
|
background: #FFF;
|
||||||
|
padding: 0 11px 10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-widget-content,
|
||||||
|
.color-alpha-picker-container .ui-widget-header,
|
||||||
|
.color-alpha-picker-wrap .ui-state-focus {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-wrap a.iris-square-value:focus {
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-slider {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
height: 24px;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 88%;
|
||||||
|
width: calc(100% - 28px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-slider-handle,
|
||||||
|
.color-alpha-picker-container .ui-widget-content .ui-state-default {
|
||||||
|
color: #777;
|
||||||
|
background-color: #FFF;
|
||||||
|
text-shadow: 0 1px 0 #FFF;
|
||||||
|
text-decoration: none;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: -2px;
|
||||||
|
top: 0;
|
||||||
|
height: 26px;
|
||||||
|
width: 26px;
|
||||||
|
cursor: ew-resize;
|
||||||
|
font-size: 0;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 27px;
|
||||||
|
margin-right: -14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-slider-handle.alpha {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .click-zone {
|
||||||
|
width: 14px;
|
||||||
|
height: 24px;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .max-click-zone {
|
||||||
|
left: 10px;
|
||||||
|
right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .transparency {
|
||||||
|
height: 24px;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #FFF;
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAAYCAYAAAAf+dpfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzY5NzJDNTEwNzA3MTFFNEExREREODYzQUFCRDhDREMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzY5NzJDNTIwNzA3MTFFNEExREREODYzQUFCRDhDREMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozNjk3MkM0RjA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozNjk3MkM1MDA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PndQ2kgAAAbKSURBVHjarFyLUexIDFS7LhfSIJuXEmRDGiTjPt7VwnnNSN2SvVUUsLbno9Gn1aMx3t7eGBF/f+Lx+/j3r98vLy883Pd9bY//P/vh/v3z8zMW93//vZ/+56L9cz/H787t/7p+GtN+an8/tX1+nl/tH+/dF+N4+u7R/l6M5+n+r/b3ZPz76rmv9s9t79X8zfEf5aPGs5/ks6/kkI1rIf9sTMf2M5n/Gk+iP3uiU8f1tX5O7Ve6fW6/ujcO7cf52vb4ApF/UHTy/R0W93PRLk7PVX2ePzTvW12H2Vd2H4vrSJzb+Xkac8dCplnfKL5n0jeScWAxxmq+2Tho6lE1LxprguTeWAQWxn2f41xhrLOSmdTh19dXbgulQbFwWAwQpqFhoTDKKFxjVIuuFIcNobqOhcmiIpk7DSWmMQYaBsMbZBcJ4opkfZnIm4neQfSZzZMNo2BDrtV9HAQO+7M1O1xNiqYnoeFxYXrXjiAx9JbRUNBK2ZRhZIoEsR4som6IthDzCMPCEZ3XoYN+uDDmEA6AhhFXbcF0Tiz0jMncXWcmnfFmCrETWbAwSscbZRMP8zn1DAvjh1ggmsbNgaJ3kAEXkQZDB4OGA8zmB8P5XHUEk3mhGO8EjZ31OtNT3uT8nv7fzBxwshBI8liYUZGDhXFyRzW/bt9d2WSOw83F3P5ULpdxDlleTCMXQ3O9OnwDzDkqp+3yE1W+qbgOp1+Fav67/+PjA5sB2zJv7ij/FEpOcqEzvMFwQVzIOEEYFfmAqFn2K1GKhUNzU4kOenLGQ5EzsuEMOwTllUiPApJn/WYcjoVkjsSRm78oGAFh0HeybhXscxcZSWRDQXYgehFjAqNh/M8EscCUr8qdHT6iA6FhOhEXhkLI2HXWE2fn6BwSh0vDEf60e4ykLvOpYA0bofwOwcFEAlM4iKZSsckeVhENwiAzj83IGeRsTEjyOYdkgeGcJulLV+5xozFeRXpuEIskJWQVSRUL5k6gMk5Hcacw9So0dPZ33VyaQ4fTjbQwmMNObu7kn47MVUSGiOhTp86LPEF3nbsRNks/Ul3YDMigJtGl2tU+mGovg63TvUxlaNU+HCPfcoCpZE4hiUvtwyArKgWBYYAwUARNHViNnw2dUGvYTUvY1J8rQSyMNU2JIzQHh+GE74AYNJ2IgiEdYWPA8rlEGIvcKowUwiWbYMgPppKh2T4M0sfpwyWNusZ6ldmHYSNqXD/j+At3/3nUCrp7YPGolY0i93x65lCLeB7cvhrdqX0pvK/2Hcbt55ox/qdnD7WaavMcj/Gz0T5P8lGKgEct60rR96T9VSFJFp2P8nHyaDxqfSsnuB/7WqxvVTn0XSueIZxKP63UYyH/Sod4qBW3qrqS9c10Foda3299XUZSZ5EmeH6a51XwSUHTKfEEERVcxhpGHuJUXykiR5FFmdOoSj4RNYvs5o0O29zdtlMIZsLEuwisI+PMobS22DbTILqQUW3exg3G5C5YNAXaLbTAQCEY/WJ0pzKq4ygR9TaGm5NW5ZiOQUviROjdlYMcnYDgOBwMZV+mT1vSQITebHYT4xARQU0KRj7qtMmmsbo5zaTMcepYHPaTpoOtTspEc70rA1f7mTTapCC2OoUOE+N0A9QE1ZUE358/f7gZiz4txuZFCOJs1VQM5WoP0knqV4o13VaZeNiOUlRQHYUHp2EgWa2qYwwYKGWVblSB48rxx0n6paqrspNiNGzh1/ze39/TnFQVEV9RTN7QRhSe1mEU3bFkJZAuPFYlbjSRh3veN9vaWBF3CF2kr1hWNCAojdSlUuiuE1fRthtk3O2lq5+nfqtIehWCOZUh3ShRGZFzTM1FBM4haYfU6NT4UsBFDmAcjFSme55yCscr54fwa8Mx1JkpSenowfTAA9113YQiTGCEs3E/OaHgRLku/HZPY6CAOs552m5hQNdYuvASFw2tuxeu3h6hrmUQ0zVIXtQpDudSOfeKo/i5lsFdDDxR5+A3DDIIgoHs5ItTQmRKLig2zy19c48PKjrfOWQ/UWYWhJVTtdUlZKpctdI1lXp1DBzRe/ODE0XLdPMId6tXeky8T7Ut43hDpYCriSI0ne8sQjTyqY7i0BhHZoQQnn16AFx5+G5UV0X7V+Coyrc7xngX6dctoe067WUkdZReecLulgQuCM+Bq07Ehzkf5308FIwljO9XyumOFw1ZQBjctMSzm8e7RftRIK2704Ru5J1uacmtKefNDKoouwuHuweEpzlqBy5NCZTq/KZzoFtFH+ccq6scCpJWkat684WKjAp9KIio0iOHQ2HcuyetonkVKR0U8LTW/wowAHlscs+3mD4sAAAAAElFTkSuQmCC");
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 0;
|
||||||
|
margin-top: -24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 782px) {
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
|
||||||
|
width: 184px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 640px) {
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
|
||||||
|
width: 172px;
|
||||||
|
height: 33px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Typography
|
||||||
|
*/
|
||||||
|
.customize-control-typography {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper {
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper h5 {
|
||||||
|
margin: 0.67em 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .font-family,
|
||||||
|
.customize-control-typography .wrapper .font-size,
|
||||||
|
.customize-control-typography .wrapper .letter-spacing,
|
||||||
|
.customize-control-typography .wrapper .line-height,
|
||||||
|
.customize-control-typography .wrapper .text-align,
|
||||||
|
.customize-control-typography .wrapper .text-transform,
|
||||||
|
.customize-control-typography .wrapper .variant {
|
||||||
|
width: 100%;
|
||||||
|
float: none;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .font-size,
|
||||||
|
.customize-control-typography .wrapper .letter-spacing,
|
||||||
|
.customize-control-typography .wrapper .line-height,
|
||||||
|
.customize-control-typography .wrapper .text-transform {
|
||||||
|
width: 48%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices label {
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices input {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices input:checked + label {
|
||||||
|
border-color: #0085ba;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=customizer.css.map */
|
||||||
361
core/customizer/assets/customizer.css
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
/**
|
||||||
|
* Heading
|
||||||
|
*/
|
||||||
|
.customize-control-heading {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description
|
||||||
|
*/
|
||||||
|
.customize-control-description {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checkbox
|
||||||
|
*/
|
||||||
|
.customize-control-checkbox + .customize-control-checkbox {
|
||||||
|
margin-top: -12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio
|
||||||
|
*/
|
||||||
|
.customize-control-radio .customize-inside-control-row {
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Divider
|
||||||
|
*/
|
||||||
|
.customizer-divider {
|
||||||
|
border-bottom: 1px dashed #dcdcde;
|
||||||
|
margin: 4px -12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Color
|
||||||
|
*/
|
||||||
|
.customize-control-color[id*=is_dark],
|
||||||
|
.customize-control-color-alpha[id*=is_dark] {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark] .expand-setting,
|
||||||
|
.customize-control-color-alpha[id*=is_dark] .expand-setting {
|
||||||
|
position: absolute;
|
||||||
|
top: -82px;
|
||||||
|
right: 0;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.5;
|
||||||
|
transition: opacity 0.25s;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark] .expand-setting:before,
|
||||||
|
.customize-control-color-alpha[id*=is_dark] .expand-setting:before {
|
||||||
|
display: block;
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg width='14' height='15' viewBox='0 0 14 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.66536 4.16683C5.66523 5.09392 5.94124 6.00005 6.45818 6.76964C6.97513 7.53923 7.70959 8.1374 8.56788 8.48787C9.42618 8.83835 10.3694 8.92523 11.2773 8.73744C12.1852 8.54965 13.0165 8.09571 13.6654 7.4335V7.50016C13.6654 11.1822 10.6807 14.1668 6.9987 14.1668C3.3167 14.1668 0.332031 11.1822 0.332031 7.50016C0.332031 3.81816 3.3167 0.833496 6.9987 0.833496H7.06536C6.62139 1.26758 6.26879 1.78614 6.02835 2.35862C5.78791 2.93109 5.66449 3.54591 5.66536 4.16683ZM1.66536 7.50016C1.66488 8.69015 2.06238 9.84611 2.79463 10.7841C3.52687 11.7222 4.55179 12.3883 5.70631 12.6767C6.86082 12.9651 8.07862 12.859 9.16593 12.3755C10.2532 11.8919 11.1476 11.0586 11.7067 10.0082C10.7117 10.2426 9.67322 10.2189 8.68991 9.93931C7.7066 9.65973 6.81103 9.13355 6.08817 8.41069C5.36531 7.68783 4.83913 6.79226 4.55955 5.80895C4.27997 4.82564 4.25627 3.7872 4.4907 2.79216C3.63708 3.24692 2.92322 3.92527 2.42554 4.75459C1.92785 5.58391 1.66508 6.53297 1.66536 7.50016Z' fill='%23000000'/%3E%3C/svg%3E%0A");
|
||||||
|
background-size: contain;
|
||||||
|
width: 14px;
|
||||||
|
height: 15px;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark] .expand-setting:hover,
|
||||||
|
.customize-control-color-alpha[id*=is_dark] .expand-setting:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark].customize-control-color-open .expand-setting,
|
||||||
|
.customize-control-color-alpha[id*=is_dark].customize-control-color-open .expand-setting {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open),
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-title,
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-title {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .customize-control-content,
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .customize-control-content {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.customize-control-color[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container,
|
||||||
|
.customize-control-color-alpha[id*=is_dark]:not(.customize-control-color-open) .wp-picker-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select2
|
||||||
|
*/
|
||||||
|
.select2-dropdown {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container {
|
||||||
|
min-width: 100px;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--open .select2-dropdown--above,
|
||||||
|
.select2-container--open .select2-dropdown--below {
|
||||||
|
z-index: 9999999;
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--multiple,
|
||||||
|
.select2-container--default .select2-selection--single {
|
||||||
|
border-color: rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||||
|
background-color: rgba(255, 255, 255, 0);
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-customizer .select2-container {
|
||||||
|
z-index: 8 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-customizer .select2-container.select2-container--open {
|
||||||
|
z-index: 999999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collapsibles
|
||||||
|
*/
|
||||||
|
.customize-control-collapsible .customize-collapsible {
|
||||||
|
position: relative;
|
||||||
|
margin: 0 -12px;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3 {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px 14px;
|
||||||
|
color: #555;
|
||||||
|
background: white;
|
||||||
|
line-height: 21px;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3:after {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
right: 14px;
|
||||||
|
color: #a0a5aa;
|
||||||
|
font: 400 20px/1 dashicons;
|
||||||
|
content: "\f343";
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3:hover {
|
||||||
|
color: #0073aa;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible .customize-collapsible h3:hover:after {
|
||||||
|
color: #0073aa;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible.customize-control-collapsed {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.customize-control-collapsible.customize-control-collapsed .customize-collapsible h3:after {
|
||||||
|
content: "\f347";
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-hidden {
|
||||||
|
height: 0 !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
visibility: hidden;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alpha Color Picker CSS
|
||||||
|
*/
|
||||||
|
.customize-control-color-alpha .wp-picker-container .iris-picker {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-container {
|
||||||
|
max-width: 257px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-open + .wp-picker-input-wrap {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
|
||||||
|
float: left;
|
||||||
|
width: 195px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap .button {
|
||||||
|
margin-left: 0;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-picker-container .wp-picker-open ~ .wp-picker-holder .color-alpha-picker-container {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container {
|
||||||
|
border: 1px solid #dfdfdf;
|
||||||
|
border-top: none;
|
||||||
|
display: none;
|
||||||
|
background: #FFF;
|
||||||
|
padding: 0 11px 10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-widget-content,
|
||||||
|
.color-alpha-picker-container .ui-widget-header,
|
||||||
|
.color-alpha-picker-wrap .ui-state-focus {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-wrap a.iris-square-value:focus {
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-slider {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
height: 24px;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 88%;
|
||||||
|
width: calc(100% - 28px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-slider-handle,
|
||||||
|
.color-alpha-picker-container .ui-widget-content .ui-state-default {
|
||||||
|
color: #777;
|
||||||
|
background-color: #FFF;
|
||||||
|
text-shadow: 0 1px 0 #FFF;
|
||||||
|
text-decoration: none;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: -2px;
|
||||||
|
top: 0;
|
||||||
|
height: 26px;
|
||||||
|
width: 26px;
|
||||||
|
cursor: ew-resize;
|
||||||
|
font-size: 0;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 27px;
|
||||||
|
margin-left: -14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .ui-slider-handle.alpha {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .click-zone {
|
||||||
|
width: 14px;
|
||||||
|
height: 24px;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .max-click-zone {
|
||||||
|
right: 10px;
|
||||||
|
left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-alpha-picker-container .transparency {
|
||||||
|
height: 24px;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #FFF;
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOkAAAAYCAYAAAAf+dpfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzY5NzJDNTEwNzA3MTFFNEExREREODYzQUFCRDhDREMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzY5NzJDNTIwNzA3MTFFNEExREREODYzQUFCRDhDREMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozNjk3MkM0RjA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozNjk3MkM1MDA3MDcxMUU0QTFEREQ4NjNBQUJEOENEQyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PndQ2kgAAAbKSURBVHjarFyLUexIDFS7LhfSIJuXEmRDGiTjPt7VwnnNSN2SvVUUsLbno9Gn1aMx3t7eGBF/f+Lx+/j3r98vLy883Pd9bY//P/vh/v3z8zMW93//vZ/+56L9cz/H787t/7p+GtN+an8/tX1+nl/tH+/dF+N4+u7R/l6M5+n+r/b3ZPz76rmv9s9t79X8zfEf5aPGs5/ks6/kkI1rIf9sTMf2M5n/Gk+iP3uiU8f1tX5O7Ve6fW6/ujcO7cf52vb4ApF/UHTy/R0W93PRLk7PVX2ePzTvW12H2Vd2H4vrSJzb+Xkac8dCplnfKL5n0jeScWAxxmq+2Tho6lE1LxprguTeWAQWxn2f41xhrLOSmdTh19dXbgulQbFwWAwQpqFhoTDKKFxjVIuuFIcNobqOhcmiIpk7DSWmMQYaBsMbZBcJ4opkfZnIm4neQfSZzZMNo2BDrtV9HAQO+7M1O1xNiqYnoeFxYXrXjiAx9JbRUNBK2ZRhZIoEsR4som6IthDzCMPCEZ3XoYN+uDDmEA6AhhFXbcF0Tiz0jMncXWcmnfFmCrETWbAwSscbZRMP8zn1DAvjh1ggmsbNgaJ3kAEXkQZDB4OGA8zmB8P5XHUEk3mhGO8EjZ31OtNT3uT8nv7fzBxwshBI8liYUZGDhXFyRzW/bt9d2WSOw83F3P5ULpdxDlleTCMXQ3O9OnwDzDkqp+3yE1W+qbgOp1+Fav67/+PjA5sB2zJv7ij/FEpOcqEzvMFwQVzIOEEYFfmAqFn2K1GKhUNzU4kOenLGQ5EzsuEMOwTllUiPApJn/WYcjoVkjsSRm78oGAFh0HeybhXscxcZSWRDQXYgehFjAqNh/M8EscCUr8qdHT6iA6FhOhEXhkLI2HXWE2fn6BwSh0vDEf60e4ykLvOpYA0bofwOwcFEAlM4iKZSsckeVhENwiAzj83IGeRsTEjyOYdkgeGcJulLV+5xozFeRXpuEIskJWQVSRUL5k6gMk5Hcacw9So0dPZ33VyaQ4fTjbQwmMNObu7kn47MVUSGiOhTp86LPEF3nbsRNks/Ul3YDMigJtGl2tU+mGovg63TvUxlaNU+HCPfcoCpZE4hiUvtwyArKgWBYYAwUARNHViNnw2dUGvYTUvY1J8rQSyMNU2JIzQHh+GE74AYNJ2IgiEdYWPA8rlEGIvcKowUwiWbYMgPppKh2T4M0sfpwyWNusZ6ldmHYSNqXD/j+At3/3nUCrp7YPGolY0i93x65lCLeB7cvhrdqX0pvK/2Hcbt55ox/qdnD7WaavMcj/Gz0T5P8lGKgEct60rR96T9VSFJFp2P8nHyaDxqfSsnuB/7WqxvVTn0XSueIZxKP63UYyH/Sod4qBW3qrqS9c10Foda3299XUZSZ5EmeH6a51XwSUHTKfEEERVcxhpGHuJUXykiR5FFmdOoSj4RNYvs5o0O29zdtlMIZsLEuwisI+PMobS22DbTILqQUW3exg3G5C5YNAXaLbTAQCEY/WJ0pzKq4ygR9TaGm5NW5ZiOQUviROjdlYMcnYDgOBwMZV+mT1vSQITebHYT4xARQU0KRj7qtMmmsbo5zaTMcepYHPaTpoOtTspEc70rA1f7mTTapCC2OoUOE+N0A9QE1ZUE358/f7gZiz4txuZFCOJs1VQM5WoP0knqV4o13VaZeNiOUlRQHYUHp2EgWa2qYwwYKGWVblSB48rxx0n6paqrspNiNGzh1/ze39/TnFQVEV9RTN7QRhSe1mEU3bFkJZAuPFYlbjSRh3veN9vaWBF3CF2kr1hWNCAojdSlUuiuE1fRthtk3O2lq5+nfqtIehWCOZUh3ShRGZFzTM1FBM4haYfU6NT4UsBFDmAcjFSme55yCscr54fwa8Mx1JkpSenowfTAA9113YQiTGCEs3E/OaHgRLku/HZPY6CAOs552m5hQNdYuvASFw2tuxeu3h6hrmUQ0zVIXtQpDudSOfeKo/i5lsFdDDxR5+A3DDIIgoHs5ItTQmRKLig2zy19c48PKjrfOWQ/UWYWhJVTtdUlZKpctdI1lXp1DBzRe/ODE0XLdPMId6tXeky8T7Ut43hDpYCriSI0ne8sQjTyqY7i0BhHZoQQnn16AFx5+G5UV0X7V+Coyrc7xngX6dctoe067WUkdZReecLulgQuCM+Bq07Ehzkf5308FIwljO9XyumOFw1ZQBjctMSzm8e7RftRIK2704Ru5J1uacmtKefNDKoouwuHuweEpzlqBy5NCZTq/KZzoFtFH+ccq6scCpJWkat684WKjAp9KIio0iOHQ2HcuyetonkVKR0U8LTW/wowAHlscs+3mD4sAAAAAElFTkSuQmCC");
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4) inset;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 0;
|
||||||
|
margin-top: -24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 782px) {
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
|
||||||
|
width: 184px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 640px) {
|
||||||
|
.customize-control-color-alpha .wp-picker-input-wrap input[type=text].wp-color-picker.color-alpha-control {
|
||||||
|
width: 172px;
|
||||||
|
height: 33px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Typography
|
||||||
|
*/
|
||||||
|
.customize-control-typography {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper {
|
||||||
|
padding: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper h5 {
|
||||||
|
margin: 0.67em 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .font-family,
|
||||||
|
.customize-control-typography .wrapper .font-size,
|
||||||
|
.customize-control-typography .wrapper .letter-spacing,
|
||||||
|
.customize-control-typography .wrapper .line-height,
|
||||||
|
.customize-control-typography .wrapper .text-align,
|
||||||
|
.customize-control-typography .wrapper .text-transform,
|
||||||
|
.customize-control-typography .wrapper .variant {
|
||||||
|
width: 100%;
|
||||||
|
float: none;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .font-size,
|
||||||
|
.customize-control-typography .wrapper .letter-spacing,
|
||||||
|
.customize-control-typography .wrapper .line-height,
|
||||||
|
.customize-control-typography .wrapper .text-transform {
|
||||||
|
width: 48%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices label {
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices input {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.customize-control-typography .wrapper .text-align .text-align-choices input:checked + label {
|
||||||
|
border-color: #0085ba;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=customizer.css.map */
|
||||||
1374
core/customizer/assets/customizer.js
Normal file
1
core/customizer/assets/selectWoo.full.min.js
vendored
Normal file
1
core/customizer/assets/selectWoo.min.css
vendored
Normal file
1
core/customizer/assets/webfonts.json
Normal file
324
core/customizer/class-customizer.php
Normal file
@@ -0,0 +1,324 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customizer' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Theme Customizer
|
||||||
|
*/
|
||||||
|
class CSCO_Customizer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A reference to an instance of this class.
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
private static $instance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of all our panels.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $panels = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of all our sections.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $sections = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of all our fields.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $fields = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of field dependencies.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private static $dependencies = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the instance.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function get_instance() {
|
||||||
|
if ( null === self::$instance ) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class constructor
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
/** Include file helper */
|
||||||
|
require_once get_theme_file_path( '/core/customizer/class-helper.php' );
|
||||||
|
|
||||||
|
/** Include fonts modules */
|
||||||
|
require_once get_theme_file_path( '/core/customizer/modules/class-fonts.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/modules/class-fonts-google.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/modules/class-fonts-theme.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/modules/class-output-styles.php' );
|
||||||
|
|
||||||
|
/** Include files of controls */
|
||||||
|
if ( class_exists( 'WP_Customize_Control' ) ) {
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-dimension.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-divider.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-heading.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-multicheck.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-collapsible.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-color-alpha.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/controls/class-control-typography.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initialize actions */
|
||||||
|
add_action( 'customize_register', array( $this, 'customizer_register' ) );
|
||||||
|
add_action( 'customize_controls_enqueue_scripts', array( $this, 'customizer_controls_enqueue_scripts' ) );
|
||||||
|
add_filter( 'csco_customizer_field_add_setting_args', array( $this, 'field_add_setting_args' ) );
|
||||||
|
add_filter( 'csco_customizer_field_add_control_args', array( $this, 'field_add_control_args' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new panel.
|
||||||
|
*
|
||||||
|
* @param string $id The ID for this panel.
|
||||||
|
* @param array $args The panel arguments.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function add_panel( $id = '', $args = array() ) {
|
||||||
|
self::$panels[ $id ] = $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new section.
|
||||||
|
*
|
||||||
|
* @param string $id The ID for this section.
|
||||||
|
* @param array $args The section arguments.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function add_section( $id, $args ) {
|
||||||
|
self::$sections[ $id ] = $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new field
|
||||||
|
*
|
||||||
|
* @param array $args The field's arguments.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function add_field( $args ) {
|
||||||
|
if ( isset( $args['settings'] ) && isset( $args['type'] ) ) {
|
||||||
|
self::$fields[ $args['settings'] ] = $args;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register new panels, sections and fields
|
||||||
|
*
|
||||||
|
* @param object $wp_customize The component name.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function customizer_register( $wp_customize ) {
|
||||||
|
|
||||||
|
// Set panels.
|
||||||
|
foreach ( self::$panels as $panel_id => $panel_args ) {
|
||||||
|
$wp_customize->add_panel( $panel_id, $panel_args );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set sections.
|
||||||
|
foreach ( self::$sections as $section_id => $section_args ) {
|
||||||
|
$wp_customize->add_section( $section_id, $section_args );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register the custom control type.
|
||||||
|
$wp_customize->register_control_type( 'CSCO_Customize_Typography_Control' );
|
||||||
|
$wp_customize->register_control_type( 'CSCO_Customize_Multicheck_Control' );
|
||||||
|
|
||||||
|
// Set fields.
|
||||||
|
foreach ( self::$fields as $field_id => $field_args ) {
|
||||||
|
/**
|
||||||
|
* The csco_customizer_field_add_setting_args hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$params = apply_filters( 'csco_customizer_field_add_setting_args', $field_args, $wp_customize );
|
||||||
|
|
||||||
|
call_user_func( array( $wp_customize, 'add_setting' ), $field_id, $params );
|
||||||
|
/**
|
||||||
|
* The csco_customizer_field_add_control_args hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$args = apply_filters( 'csco_customizer_field_add_control_args', $field_args, $wp_customize );
|
||||||
|
|
||||||
|
switch ( $field_args['type'] ) {
|
||||||
|
case 'color':
|
||||||
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'image':
|
||||||
|
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'dimension':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Dimension_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'divider':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Divider_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'heading':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Heading_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'multicheck':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Multicheck_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'collapsible':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Collapsible_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'color-alpha':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Color_Alpha_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
case 'typography':
|
||||||
|
$wp_customize->add_control( new CSCO_Customize_Typography_Control( $wp_customize, $field_id, $args ) );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$wp_customize->add_control( $field_id, $args );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter setting arguments.
|
||||||
|
*
|
||||||
|
* @param array $args The field arguments.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function field_add_setting_args( $args ) {
|
||||||
|
|
||||||
|
$args = array(
|
||||||
|
'type' => isset( $args['type_mod'] ) ? $args['type_mod'] : 'theme_mod',
|
||||||
|
'capability' => isset( $args['capability'] ) ? $args['capability'] : 'edit_theme_options',
|
||||||
|
'theme_supports' => isset( $args['theme_supports'] ) ? $args['theme_supports'] : '',
|
||||||
|
'default' => isset( $args['default'] ) ? $args['default'] : '',
|
||||||
|
'transport' => isset( $args['transport'] ) ? $args['transport'] : 'refresh',
|
||||||
|
'sanitize_callback' => isset( $args['sanitize_callback'] ) ? $args['sanitize_callback'] : '',
|
||||||
|
'sanitize_js_callback' => isset( $args['sanitize_js_callback'] ) ? $args['sanitize_js_callback'] : '',
|
||||||
|
);
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter control arguments.
|
||||||
|
*
|
||||||
|
* @param array $args The field arguments.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function field_add_control_args( $args ) {
|
||||||
|
if ( isset( $args['active_callback'] ) ) {
|
||||||
|
if ( is_array( $args['active_callback'] ) ) {
|
||||||
|
if ( ! is_callable( $args['active_callback'] ) ) {
|
||||||
|
foreach ( $args['active_callback'] as $key => $val ) {
|
||||||
|
if ( is_callable( $val ) ) {
|
||||||
|
unset( $args['active_callback'][ $key ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( isset( $args['active_callback'][0] ) ) {
|
||||||
|
$args['required'] = $args['active_callback'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! empty( $args['required'] ) ) {
|
||||||
|
self::$dependencies[ $args['settings'] ] = $args['required'];
|
||||||
|
$args['active_callback'] = '__return_true';
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
// No need to proceed any further if we're using the default value.
|
||||||
|
if ( '__return_true' === $args['active_callback'] ) {
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
// Make sure the function is callable, otherwise fallback to __return_true.
|
||||||
|
if ( ! is_callable( $args['active_callback'] ) ) {
|
||||||
|
$args['active_callback'] = '__return_true';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue Customizer control scripts.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function customizer_controls_enqueue_scripts() {
|
||||||
|
wp_enqueue_style( 'wp-color-picker' );
|
||||||
|
wp_enqueue_script( 'wp-color-picker' );
|
||||||
|
|
||||||
|
// Register customize selectWoo scripts.
|
||||||
|
wp_register_script( 'selectWoo', get_theme_file_uri( '/core/customizer/assets/selectWoo.full.min.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/core/customizer/assets/selectWoo.full.min.js' ) ), true );
|
||||||
|
|
||||||
|
// Register customize scripts.
|
||||||
|
wp_register_script( 'cs-customizer', get_theme_file_uri( '/core/customizer/assets/customizer.js' ), array( 'jquery', 'customize-controls', 'selectWoo' ), filemtime( get_theme_file_path( '/core/customizer/assets/customizer.js' ) ), true );
|
||||||
|
|
||||||
|
// Localize customize scripts.
|
||||||
|
wp_localize_script( 'cs-customizer', 'cscoCustomizerConfig', array(
|
||||||
|
'dependencies' => self::$dependencies,
|
||||||
|
'advanced_settings' => esc_html__( 'Advanced settings', 'revision' ),
|
||||||
|
'noFileSelected' => esc_html__( 'No File Selected', 'revision' ),
|
||||||
|
'remove' => esc_html__( 'Remove', 'revision' ),
|
||||||
|
'default' => esc_html__( 'Default', 'revision' ),
|
||||||
|
'selectFile' => esc_html__( 'Select File', 'revision' ),
|
||||||
|
'standardFonts' => esc_html__( 'Standard Fonts', 'revision' ),
|
||||||
|
'googleFonts' => esc_html__( 'Google Fonts', 'revision' ),
|
||||||
|
'defaultCSSValues' => esc_html__( 'CSS Defaults', 'revision' ),
|
||||||
|
'defaultBrowserFamily' => esc_html__( 'Default Browser Font-Family', 'revision' ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Enqueue customize scripts.
|
||||||
|
wp_enqueue_script( 'cs-customizer' );
|
||||||
|
|
||||||
|
// Register customize select2 style.
|
||||||
|
wp_register_style( 'selectWoo', get_theme_file_uri( '/core/customizer/assets/selectWoo.min.css' ), array(), filemtime( get_theme_file_path( '/core/customizer/assets/selectWoo.min.css' ) ) );
|
||||||
|
|
||||||
|
// Register customize style.
|
||||||
|
wp_register_style( 'cs-customizer', get_theme_file_uri( '/core/customizer/assets/customizer.css' ), array( 'selectWoo' ), filemtime( get_theme_file_path( '/core/customizer/assets/customizer.css' ) ) );
|
||||||
|
|
||||||
|
// Enqueue customize style.
|
||||||
|
wp_enqueue_style( 'cs-customizer' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! function_exists( 'csco_customizer' ) ) {
|
||||||
|
/**
|
||||||
|
* Returns instanse of the Theme Customizer class.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function csco_customizer() {
|
||||||
|
return CSCO_Customizer::get_instance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
csco_customizer();
|
||||||
|
}
|
||||||
199
core/customizer/class-helper.php
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Helper methods
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple object containing static methods.
|
||||||
|
*/
|
||||||
|
class CSCO_Customizer_Helper {
|
||||||
|
/**
|
||||||
|
* Get the value of a field.
|
||||||
|
*
|
||||||
|
* @param string $field_id The field ID.
|
||||||
|
*/
|
||||||
|
public static function get_value( $field_id = '' ) {
|
||||||
|
|
||||||
|
// Make sure value is defined.
|
||||||
|
$value = __return_empty_string();
|
||||||
|
|
||||||
|
// We're using theme_mods so just get the value using get_theme_mod.
|
||||||
|
$default_value = __return_null();
|
||||||
|
|
||||||
|
if ( isset( CSCO_Customizer::$fields[ $field_id ] ) && isset( CSCO_Customizer::$fields[ $field_id ]['default'] ) ) {
|
||||||
|
$default_value = CSCO_Customizer::$fields[ $field_id ]['default'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = get_theme_mod( $field_id, $default_value );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_customizer_values_get_value hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
return apply_filters( 'csco_customizer_values_get_value', $value, $field_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the 2 values given the condition
|
||||||
|
*
|
||||||
|
* @param mixed $value1 The 1st value in the comparison.
|
||||||
|
* @param mixed $value2 The 2nd value in the comparison.
|
||||||
|
* @param string $operator The operator we'll use for the comparison.
|
||||||
|
* @return boolean whether The comparison has succeded (true) or failed (false).
|
||||||
|
*/
|
||||||
|
public static function compare_values( $value1, $value2, $operator ) {
|
||||||
|
if ( '===' === $operator ) {
|
||||||
|
return $value1 === $value2;
|
||||||
|
}
|
||||||
|
if ( '!==' === $operator ) {
|
||||||
|
return $value1 !== $value2;
|
||||||
|
}
|
||||||
|
if ( ( '!=' === $operator || 'not equal' === $operator ) ) {
|
||||||
|
return $value1 != $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
|
||||||
|
}
|
||||||
|
if ( ( '>=' === $operator || 'greater or equal' === $operator || 'equal or greater' === $operator ) ) {
|
||||||
|
return $value2 >= $value1;
|
||||||
|
}
|
||||||
|
if ( ( '<=' === $operator || 'smaller or equal' === $operator || 'equal or smaller' === $operator ) ) {
|
||||||
|
return $value2 <= $value1;
|
||||||
|
}
|
||||||
|
if ( ( '>' === $operator || 'greater' === $operator ) ) {
|
||||||
|
return $value2 > $value1;
|
||||||
|
}
|
||||||
|
if ( ( '<' === $operator || 'smaller' === $operator ) ) {
|
||||||
|
return $value2 < $value1;
|
||||||
|
}
|
||||||
|
if ( 'contains' === $operator || 'in' === $operator ) {
|
||||||
|
if ( is_array( $value1 ) && is_array( $value2 ) ) {
|
||||||
|
foreach ( $value2 as $val ) {
|
||||||
|
if ( in_array( $val, $value1 ) ) { // phpcs:ignore WordPress.PHP.StrictInArray
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( is_array( $value1 ) && ! is_array( $value2 ) ) {
|
||||||
|
return in_array( $value2, $value1 ); // phpcs:ignore WordPress.PHP.StrictInArray
|
||||||
|
}
|
||||||
|
if ( is_array( $value2 ) && ! is_array( $value1 ) ) {
|
||||||
|
return in_array( $value1, $value2 ); // phpcs:ignore WordPress.PHP.StrictInArray
|
||||||
|
}
|
||||||
|
return ( false !== strrpos( $value1, $value2 ) || false !== strpos( $value2, $value1 ) );
|
||||||
|
}
|
||||||
|
return $value1 == $value2; // phpcs:ignore WordPress.PHP.StrictComparisons
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process the active_callback parameter.
|
||||||
|
*
|
||||||
|
* @param array $field The current field.
|
||||||
|
*/
|
||||||
|
public static function active_callback( $field ) {
|
||||||
|
|
||||||
|
if ( isset( $field['active_callback'] ) && is_array( $field['active_callback'] ) ) {
|
||||||
|
if ( ! is_callable( $field['active_callback'] ) ) {
|
||||||
|
|
||||||
|
foreach ( $field['active_callback'] as $key => $val ) {
|
||||||
|
if ( is_callable( $val ) ) {
|
||||||
|
unset( $field['active_callback'][ $key ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( isset( $field['active_callback'][0] ) ) {
|
||||||
|
$field['required'] = $field['active_callback'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only continue if field dependencies are met.
|
||||||
|
if ( isset( $field['required'] ) && ! empty( $field['required'] ) ) {
|
||||||
|
$valid = true;
|
||||||
|
|
||||||
|
foreach ( $field['required'] as $requirement ) {
|
||||||
|
if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) {
|
||||||
|
|
||||||
|
$controller_value = self::get_value( $requirement['setting'] );
|
||||||
|
if ( ! self::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) {
|
||||||
|
$valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! $valid ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitizes typography controls
|
||||||
|
*
|
||||||
|
* @param array $value The value.
|
||||||
|
*/
|
||||||
|
public static function typography_sanitize( $value ) {
|
||||||
|
if ( ! is_array( $value ) ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $value as $key => $val ) {
|
||||||
|
switch ( $key ) {
|
||||||
|
case 'font-family':
|
||||||
|
$value['font-family'] = sanitize_text_field( $val );
|
||||||
|
break;
|
||||||
|
case 'font-weight':
|
||||||
|
if ( isset( $value['variant'] ) ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$value['variant'] = $val;
|
||||||
|
if ( isset( $value['font-style'] ) && 'italic' === $value['font-style'] ) {
|
||||||
|
$value['variant'] = ( '400' !== $val || 400 !== $val ) ? $value['variant'] . 'italic' : 'italic';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'variant':
|
||||||
|
// Use 'regular' instead of 400 for font-variant.
|
||||||
|
$value['variant'] = ( 400 === $val || '400' === $val ) ? 'regular' : $val;
|
||||||
|
|
||||||
|
// Get font-weight from variant.
|
||||||
|
$value['font-weight'] = filter_var( $value['variant'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
|
||||||
|
$value['font-weight'] = ( 'regular' === $value['variant'] || 'italic' === $value['variant'] ) ? 400 : absint( $value['font-weight'] );
|
||||||
|
|
||||||
|
// Get font-style from variant.
|
||||||
|
if ( ! isset( $value['font-style'] ) ) {
|
||||||
|
$value['font-style'] = ( false === strpos( $value['variant'], 'italic' ) ) ? 'normal' : 'italic';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'font-size':
|
||||||
|
case 'letter-spacing':
|
||||||
|
case 'word-spacing':
|
||||||
|
case 'line-height':
|
||||||
|
$value[ $key ] = '' === trim( $value[ $key ] ) ? '' : sanitize_text_field( $val );
|
||||||
|
break;
|
||||||
|
case 'text-align':
|
||||||
|
if ( ! in_array( $val, array( '', 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) {
|
||||||
|
$value['text-align'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'text-transform':
|
||||||
|
if ( ! in_array( $val, array( '', 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) {
|
||||||
|
$value['text-transform'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'text-decoration':
|
||||||
|
if ( ! in_array( $val, array( '', 'none', 'underline', 'overline', 'line-through', 'initial', 'inherit' ), true ) ) {
|
||||||
|
$value['text-transform'] = '';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
40
core/customizer/controls/class-control-collapsible.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Collapsible
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Collapsible_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Collapsible
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Collapsible_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'collapsible';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control content.
|
||||||
|
*/
|
||||||
|
protected function render_content() {
|
||||||
|
$collapsed_class = null;
|
||||||
|
|
||||||
|
if ( isset( $this->input_attrs['collapsed'] ) && $this->input_attrs['collapsed'] ) {
|
||||||
|
$collapsed_class = 'customize-collapsed';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="customize-collapsible <?php echo esc_attr( $collapsed_class ); ?>"><h3><?php echo esc_html( $this->label ); ?></h3></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
72
core/customizer/controls/class-control-color-alpha.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Color Alpha
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Color_Alpha_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Color Alpha
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Color_Alpha_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'color-alpha';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add support for palettes to be passed in.
|
||||||
|
*
|
||||||
|
* Supported palette values are true, false, or an array of RGBa and Hex colors.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $palette;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add support for showing the opacity value on the slider handle.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $alpha;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control.
|
||||||
|
*/
|
||||||
|
public function render_content() {
|
||||||
|
|
||||||
|
if ( is_array( $this->palette ) ) {
|
||||||
|
$palette = implode( '|', $this->palette );
|
||||||
|
} else {
|
||||||
|
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
$alpha = ( false === $this->alpha || 'false' === $this->alpha ) ? 'false' : 'true';
|
||||||
|
?>
|
||||||
|
<label>
|
||||||
|
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( isset( $this->description ) && $this->description ) {
|
||||||
|
?>
|
||||||
|
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<input class="color-alpha-control" type="text" data-alpha="<?php echo esc_attr( $alpha ); ?>" data-palette="<?php echo esc_attr( $palette ); ?>" data-default-color="<?php echo esc_attr( $this->settings['default']->default ); ?>" <?php $this->link(); ?> />
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
47
core/customizer/controls/class-control-dimension.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Dimension
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Dimension_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Dimension
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Dimension_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'dimension';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control content.
|
||||||
|
*/
|
||||||
|
protected function render_content() {
|
||||||
|
?>
|
||||||
|
<label>
|
||||||
|
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( isset( $this->description ) && $this->description ) {
|
||||||
|
?>
|
||||||
|
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<input type="text" <?php $this->link(); ?> value="<?php echo esc_attr( $this->value() ); ?>"/>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
core/customizer/controls/class-control-divider.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Divider
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Divider_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Divider
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Divider_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'divider';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control content.
|
||||||
|
*/
|
||||||
|
protected function render_content() {
|
||||||
|
?>
|
||||||
|
<div class="customizer-divider"></div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
core/customizer/controls/class-control-heading.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Heading
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Heading_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Heading
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Heading_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'heading';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control content.
|
||||||
|
*/
|
||||||
|
protected function render_content() {
|
||||||
|
?>
|
||||||
|
<label>
|
||||||
|
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( isset( $this->description ) && $this->description ) {
|
||||||
|
?>
|
||||||
|
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</label>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
115
core/customizer/controls/class-control-multicheck.php
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Multicheck
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Multicheck_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Multicheck
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Multicheck_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'multicheck';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
|
||||||
|
* @param string $id Control ID.
|
||||||
|
* @param array $args The args.
|
||||||
|
*/
|
||||||
|
public function __construct( $manager, $id, $args = array() ) {
|
||||||
|
|
||||||
|
parent::__construct( $manager, $id, $args );
|
||||||
|
|
||||||
|
// Init choices.
|
||||||
|
if ( ! is_array( $this->choices ) ) {
|
||||||
|
$this->choices = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control's content.
|
||||||
|
*/
|
||||||
|
protected function render_content() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the $sanitize_callback
|
||||||
|
*/
|
||||||
|
protected function sanitize_callback() {
|
||||||
|
|
||||||
|
// If a custom sanitize_callback has been defined,
|
||||||
|
// then we don't need to proceed any further.
|
||||||
|
if ( ! empty( $this->sanitize_callback ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->sanitize_callback = array( $this, 'sanitize' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sanitize method that will be used as a falback
|
||||||
|
*
|
||||||
|
* @param string|array $value The control's value.
|
||||||
|
*/
|
||||||
|
public function sanitize( $value ) {
|
||||||
|
$value = ( ! is_array( $value ) ) ? explode( ',', $value ) : $value;
|
||||||
|
return ( ! empty( $value ) ) ? array_map( 'sanitize_text_field', $value ) : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the parameters passed to the JavaScript via JSON.
|
||||||
|
*
|
||||||
|
* @see WP_Customize_Control::to_json()
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
// Value.
|
||||||
|
$this->json['value'] = $this->value();
|
||||||
|
|
||||||
|
// The link.
|
||||||
|
$this->json['link'] = $this->get_link();
|
||||||
|
|
||||||
|
// Choices.
|
||||||
|
$this->json['choices'] = $this->choices;
|
||||||
|
|
||||||
|
// The ID.
|
||||||
|
$this->json['id'] = $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Underscore (JS) template for this control's content (but not its container).
|
||||||
|
*
|
||||||
|
* Class variables for this control class are available in the `data` JS object;
|
||||||
|
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||||
|
*
|
||||||
|
* @see WP_Customize_Control::print_template()
|
||||||
|
*/
|
||||||
|
protected function content_template() {
|
||||||
|
?>
|
||||||
|
<# if ( ! data.choices ) { return; } #>
|
||||||
|
|
||||||
|
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||||
|
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<# for ( key in data.choices ) { #>
|
||||||
|
<li><label<# if ( _.contains( data.value, key ) ) { #> class="checked"<# } #>><input {{{ data.inputAttrs }}} type="checkbox" value="{{ key }}"<# if ( _.contains( data.value, key ) ) { #> checked<# } #> />{{ data.choices[ key ] }}</label></li>
|
||||||
|
<# } #>
|
||||||
|
</ul>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
278
core/customizer/controls/class-control-typography.php
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Typography
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customize_Typography_Control' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Customize Typography
|
||||||
|
*/
|
||||||
|
class CSCO_Customize_Typography_Control extends WP_Customize_Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Control's Type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $type = 'typography';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
|
||||||
|
* @param string $id Control ID.
|
||||||
|
* @param array $args The args.
|
||||||
|
*/
|
||||||
|
public function __construct( $manager, $id, $args = array() ) {
|
||||||
|
|
||||||
|
parent::__construct( $manager, $id, $args );
|
||||||
|
|
||||||
|
// Init choices.
|
||||||
|
if ( ! is_array( $this->choices ) ) {
|
||||||
|
$this->choices = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_customizer_fonts_choices hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$this->choices = apply_filters( 'csco_customizer_fonts_choices', wp_parse_args(
|
||||||
|
$this->choices,
|
||||||
|
array(
|
||||||
|
'variant' => array(),
|
||||||
|
'fonts' => array(
|
||||||
|
'standard' => array(),
|
||||||
|
'google' => array(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the control's content.
|
||||||
|
*/
|
||||||
|
protected function render_content() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the parameters passed to the JavaScript via JSON.
|
||||||
|
*
|
||||||
|
* @see WP_Customize_Control::to_json()
|
||||||
|
*/
|
||||||
|
public function to_json() {
|
||||||
|
parent::to_json();
|
||||||
|
|
||||||
|
// Default value.
|
||||||
|
$this->json['default'] = $this->setting->default;
|
||||||
|
|
||||||
|
if ( isset( $this->default ) ) {
|
||||||
|
$this->json['default'] = $this->default;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value.
|
||||||
|
$this->json['value'] = $this->value();
|
||||||
|
|
||||||
|
// The link.
|
||||||
|
$this->json['link'] = $this->get_link();
|
||||||
|
|
||||||
|
// Choices.
|
||||||
|
$this->json['choices'] = $this->choices;
|
||||||
|
|
||||||
|
// The ID.
|
||||||
|
$this->json['id'] = $this->id;
|
||||||
|
|
||||||
|
// The filter value.
|
||||||
|
if ( is_array( $this->json['value'] ) ) {
|
||||||
|
foreach ( array_keys( $this->json['value'] ) as $key ) {
|
||||||
|
if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) {
|
||||||
|
unset( $this->json['value'][ $key ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $this->json['default'][ $key ] ) ) {
|
||||||
|
unset( $this->json['value'][ $key ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) {
|
||||||
|
unset( $this->json['value'][ $key ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->json['show_variants'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Underscore (JS) template for this control's content (but not its container).
|
||||||
|
*
|
||||||
|
* Class variables for this control class are available in the `data` JS object;
|
||||||
|
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||||
|
*
|
||||||
|
* @see WP_Customize_Control::print_template()
|
||||||
|
*/
|
||||||
|
protected function content_template() {
|
||||||
|
?>
|
||||||
|
<label class="customizer-text">
|
||||||
|
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
|
||||||
|
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['font-family'] ) ) { #>
|
||||||
|
<# data.value['font-family'] = data.value['font-family'] || data['default']['font-family']; #>
|
||||||
|
|
||||||
|
<# if ( data.choices['fonts'] ) { data.fonts = data.choices['fonts']; } #>
|
||||||
|
|
||||||
|
<div class="font-family">
|
||||||
|
<h5><?php esc_html_e( 'Font Family', 'revision' ); ?></h5>
|
||||||
|
<select {{{ data.inputAttrs }}} id="cs-typography-font-family-{{{ data.id }}}" placeholder="<?php esc_attr_e( 'Select Font Family', 'revision' ); ?>"></select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<# if ( true === data.show_variants || false !== data.default.variant ) { #>
|
||||||
|
<div class="variant cs-variant-wrapper">
|
||||||
|
<h5><?php esc_html_e( 'Variant', 'revision' ); ?></h5>
|
||||||
|
<select {{{ data.inputAttrs }}} class="variant" id="cs-typography-variant-{{{ data.id }}}"></select>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['font-size'] ) ) { #>
|
||||||
|
<# data.value['font-size'] = data.value['font-size'] || data['default']['font-size']; #>
|
||||||
|
<div class="font-size">
|
||||||
|
<h5><?php esc_html_e( 'Font Size', 'revision' ); ?></h5>
|
||||||
|
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['font-size'] }}"/>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['line-height'] ) ) { #>
|
||||||
|
<# data.value['line-height'] = data.value['line-height'] || data['default']['line-height']; #>
|
||||||
|
<div class="line-height">
|
||||||
|
<h5><?php esc_html_e( 'Line Height', 'revision' ); ?></h5>
|
||||||
|
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['line-height'] }}"/>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['letter-spacing'] ) ) { #>
|
||||||
|
<# data.value['letter-spacing'] = data.value['letter-spacing'] || data['default']['letter-spacing']; #>
|
||||||
|
<div class="letter-spacing">
|
||||||
|
<h5><?php esc_html_e( 'Letter Spacing', 'revision' ); ?></h5>
|
||||||
|
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['letter-spacing'] }}"/>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['word-spacing'] ) ) { #>
|
||||||
|
<# data.value['word-spacing'] = data.value['word-spacing'] || data['default']['word-spacing']; #>
|
||||||
|
<div class="word-spacing">
|
||||||
|
<h5><?php esc_html_e( 'Word Spacing', 'revision' ); ?></h5>
|
||||||
|
<input {{{ data.inputAttrs }}} type="text" value="{{ data.value['word-spacing'] }}"/>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['text-align'] ) ) { #>
|
||||||
|
<# data.value['text-align'] = data.value['text-align'] || data['default']['text-align']; #>
|
||||||
|
<div class="text-align">
|
||||||
|
<h5><?php esc_html_e( 'Text Align', 'revision' ); ?></h5>
|
||||||
|
<div class="text-align-choices">
|
||||||
|
<input {{{ data.inputAttrs }}} type="radio" value="inherit" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-inherit" <# if ( data.value['text-align'] === 'inherit' ) { #> checked="checked"<# } #>>
|
||||||
|
<label for="{{ data.id }}-text-align-inherit">
|
||||||
|
<span class="dashicons dashicons-editor-removeformatting"></span>
|
||||||
|
<span class="screen-reader-text"><?php esc_html_e( 'Inherit', 'revision' ); ?></span>
|
||||||
|
</label>
|
||||||
|
</input>
|
||||||
|
<input {{{ data.inputAttrs }}} type="radio" value="left" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-left" <# if ( data.value['text-align'] === 'left' ) { #> checked="checked"<# } #>>
|
||||||
|
<label for="{{ data.id }}-text-align-left">
|
||||||
|
<span class="dashicons dashicons-editor-alignleft"></span>
|
||||||
|
<span class="screen-reader-text"><?php esc_html_e( 'Left', 'revision' ); ?></span>
|
||||||
|
</label>
|
||||||
|
</input>
|
||||||
|
<input {{{ data.inputAttrs }}} type="radio" value="center" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-center" <# if ( data.value['text-align'] === 'center' ) { #> checked="checked"<# } #>>
|
||||||
|
<label for="{{ data.id }}-text-align-center">
|
||||||
|
<span class="dashicons dashicons-editor-aligncenter"></span>
|
||||||
|
<span class="screen-reader-text"><?php esc_html_e( 'Center', 'revision' ); ?></span>
|
||||||
|
</label>
|
||||||
|
</input>
|
||||||
|
<input {{{ data.inputAttrs }}} type="radio" value="right" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-right" <# if ( data.value['text-align'] === 'right' ) { #> checked="checked"<# } #>>
|
||||||
|
<label for="{{ data.id }}-text-align-right">
|
||||||
|
<span class="dashicons dashicons-editor-alignright"></span>
|
||||||
|
<span class="screen-reader-text"><?php esc_html_e( 'Right', 'revision' ); ?></span>
|
||||||
|
</label>
|
||||||
|
</input>
|
||||||
|
<input {{{ data.inputAttrs }}} type="radio" value="justify" name="_customize-typography-text-align-radio-{{ data.id }}" id="{{ data.id }}-text-align-justify" <# if ( data.value['text-align'] === 'justify' ) { #> checked="checked"<# } #>>
|
||||||
|
<label for="{{ data.id }}-text-align-justify">
|
||||||
|
<span class="dashicons dashicons-editor-justify"></span>
|
||||||
|
<span class="screen-reader-text"><?php esc_html_e( 'Justify', 'revision' ); ?></span>
|
||||||
|
</label>
|
||||||
|
</input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['text-transform'] ) ) { #>
|
||||||
|
<# data.value['text-transform'] = data.value['text-transform'] || data['default']['text-transform']; #>
|
||||||
|
<div class="text-transform">
|
||||||
|
<h5><?php esc_html_e( 'Text Transform', 'revision' ); ?></h5>
|
||||||
|
<select {{{ data.inputAttrs }}} id="cs-typography-text-transform-{{{ data.id }}}">
|
||||||
|
<option value=""<# if ( '' === data.value['text-transform'] ) { #>selected<# } #>></option>
|
||||||
|
<option value="none"<# if ( 'none' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'None', 'revision' ); ?></option>
|
||||||
|
<option value="capitalize"<# if ( 'capitalize' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Capitalize', 'revision' ); ?></option>
|
||||||
|
<option value="uppercase"<# if ( 'uppercase' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Uppercase', 'revision' ); ?></option>
|
||||||
|
<option value="lowercase"<# if ( 'lowercase' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Lowercase', 'revision' ); ?></option>
|
||||||
|
<option value="initial"<# if ( 'initial' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Initial', 'revision' ); ?></option>
|
||||||
|
<option value="inherit"<# if ( 'inherit' === data.value['text-transform'] ) { #>selected<# } #>><?php esc_html_e( 'Inherit', 'revision' ); ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
<# if ( ! _.isUndefined( data.default['text-decoration'] ) ) { #>
|
||||||
|
<# data.value['text-decoration'] = data.value['text-decoration'] || data['default']['text-decoration']; #>
|
||||||
|
<div class="text-decoration">
|
||||||
|
<h5><?php esc_html_e( 'Text Decoration', 'revision' ); ?></h5>
|
||||||
|
<select {{{ data.inputAttrs }}} id="cs-typography-text-decoration-{{{ data.id }}}">
|
||||||
|
<option value=""<# if ( '' === data.value['text-decoration'] ) { #>selected<# } #>></option>
|
||||||
|
<option value="none"<# if ( 'none' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'None', 'revision' ); ?></option>
|
||||||
|
<option value="underline"<# if ( 'underline' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Underline', 'revision' ); ?></option>
|
||||||
|
<option value="overline"<# if ( 'overline' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Overline', 'revision' ); ?></option>
|
||||||
|
<option value="line-through"<# if ( 'line-through' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Line-Through', 'revision' ); ?></option>
|
||||||
|
<option value="initial"<# if ( 'initial' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Initial', 'revision' ); ?></option>
|
||||||
|
<option value="inherit"<# if ( 'inherit' === data.value['text-decoration'] ) { #>selected<# } #>><?php esc_html_e( 'Inherit', 'revision' ); ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<# } #>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<input class="typography-hidden-value" type="hidden" {{{ data.link }}}>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats variants.
|
||||||
|
*
|
||||||
|
* @param array $variants The variants.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function format_variants_array( $variants ) {
|
||||||
|
$all_variants = CSCO_Customizer_Fonts::get_all_variants();
|
||||||
|
|
||||||
|
$final_variants = array();
|
||||||
|
foreach ( $variants as $variant ) {
|
||||||
|
if ( is_string( $variant ) ) {
|
||||||
|
$final_variants[] = array(
|
||||||
|
'id' => $variant,
|
||||||
|
'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant,
|
||||||
|
);
|
||||||
|
} elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) {
|
||||||
|
$final_variants[] = $variant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $final_variants;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
218
core/customizer/modules/class-fonts-google.php
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Fonts Google
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customizer_Fonts_Google' ) ) {
|
||||||
|
/**
|
||||||
|
* Customizer Fonts Google Class.
|
||||||
|
*/
|
||||||
|
final class CSCO_Customizer_Fonts_Google {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array of fonts
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $fonts_output = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of all google fonts.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $google_fonts = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fonts to load.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fonts_to_load = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->google_fonts = CSCO_Customizer_Fonts::get_google_fonts();
|
||||||
|
|
||||||
|
/** Initialize actions */
|
||||||
|
add_action( 'wp_loaded', array( $this, 'populate_fonts' ) );
|
||||||
|
add_filter( 'wp_resource_hints', array( $this, 'resource_hints' ), 10, 2 );
|
||||||
|
|
||||||
|
if ( ! is_admin() || is_customize_preview() ) {
|
||||||
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_google_fonts' ), 999 );
|
||||||
|
} else {
|
||||||
|
add_action( 'enqueue_block_assets', array( $this, 'enqueue_google_fonts' ), 999 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loader for Google Fonts.
|
||||||
|
*/
|
||||||
|
public function populate_fonts() {
|
||||||
|
// Go through our fields and populate $this->fonts_output.
|
||||||
|
$this->loop_fields();
|
||||||
|
|
||||||
|
// Goes through $this->fonts_output and adds or removes things as needed.
|
||||||
|
$this->process_fonts();
|
||||||
|
|
||||||
|
foreach ( $this->fonts_output as $font => $weights ) {
|
||||||
|
foreach ( $weights as $key => $value ) {
|
||||||
|
if ( 'italic' === $value ) {
|
||||||
|
$weights[ $key ] = '400i';
|
||||||
|
} else {
|
||||||
|
$weights[ $key ] = str_replace( array( 'regular', 'bold', 'italic' ), array( '400', '', 'i' ), $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fonts_to_load[] = array(
|
||||||
|
'family' => $font,
|
||||||
|
'weights' => $weights,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Goes through all our fields and then populates the $this->fonts_output property.
|
||||||
|
*/
|
||||||
|
public function loop_fields() {
|
||||||
|
$fields = CSCO_Customizer::$fields;
|
||||||
|
|
||||||
|
if ( is_array( $fields ) && $fields ) {
|
||||||
|
foreach ( $fields as $field ) {
|
||||||
|
if ( ! isset( $field['type'] ) || false === strpos( $field['type'], 'typography' ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check active callback.
|
||||||
|
if ( ! CSCO_Customizer_Helper::active_callback( $field ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the value.
|
||||||
|
$value = CSCO_Customizer_Helper::get_value( $field['settings'] );
|
||||||
|
|
||||||
|
// If we don't have a font-family then we can skip this.
|
||||||
|
if ( ! isset( $value['font-family'] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not a google-font, then we can skip this.
|
||||||
|
if ( ! isset( $value['font-family'] ) || ! CSCO_Customizer_Fonts::is_google_font( $value['font-family'] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set a default value for variants.
|
||||||
|
if ( ! isset( $value['variant'] ) ) {
|
||||||
|
$value['variant'] = 'regular';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the requested google-font.
|
||||||
|
if ( ! isset( $this->fonts_output[ $value['font-family'] ] ) ) {
|
||||||
|
$this->fonts_output[ $value['font-family'] ] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! in_array( $value['variant'], $this->fonts_output[ $value['font-family'] ], true ) ) {
|
||||||
|
$this->fonts_output[ $value['font-family'] ][] = $value['variant'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $field['choices']['variant'] ) && is_array( $field['choices']['variant'] ) ) {
|
||||||
|
foreach ( $field['choices']['variant'] as $extra_variant ) {
|
||||||
|
if ( ! in_array( $extra_variant, $this->fonts_output[ $value['font-family'] ], true ) ) {
|
||||||
|
$this->fonts_output[ $value['font-family'] ][] = $extra_variant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the vbalidity of the selected font as well as its properties.
|
||||||
|
* This is vital to make sure that the google-font script that we'll generate later
|
||||||
|
* does not contain any invalid options.
|
||||||
|
*/
|
||||||
|
public function process_fonts() {
|
||||||
|
|
||||||
|
// Early exit if font-family is empty.
|
||||||
|
if ( empty( $this->fonts_output ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $this->fonts_output as $font => $variants ) {
|
||||||
|
|
||||||
|
// Determine if this is indeed a google font or not.
|
||||||
|
// If it's not, then just remove it from the array.
|
||||||
|
if ( ! array_key_exists( $font, $this->google_fonts ) ) {
|
||||||
|
unset( $this->fonts_output[ $font ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all valid font variants for this font.
|
||||||
|
$font_variants = array();
|
||||||
|
|
||||||
|
if ( isset( $this->google_fonts[ $font ]['variants'] ) ) {
|
||||||
|
$font_variants = $this->google_fonts[ $font ]['variants'];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $variants as $variant ) {
|
||||||
|
// If this is not a valid variant for this font-family
|
||||||
|
// then unset it and move on to the next one.
|
||||||
|
if ( ! in_array( strval( $variant ), $font_variants, true ) ) {
|
||||||
|
$variant_key = array_search( $variant, $this->fonts_output[ $font ], true );
|
||||||
|
unset( $this->fonts_output[ $font ][ $variant_key ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add preconnect for Google Fonts.
|
||||||
|
*
|
||||||
|
* @param array $urls URLs to print for resource hints.
|
||||||
|
* @param string $relation_type The relation type the URLs are printed.
|
||||||
|
*/
|
||||||
|
public function resource_hints( $urls, $relation_type ) {
|
||||||
|
$fonts_to_load = $this->fonts_output;
|
||||||
|
|
||||||
|
if ( ! empty( $fonts_to_load ) && 'preconnect' === $relation_type ) {
|
||||||
|
$urls[] = array(
|
||||||
|
'href' => 'https://fonts.gstatic.com',
|
||||||
|
'crossorigin',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue Google fonts.
|
||||||
|
*/
|
||||||
|
public function enqueue_google_fonts() {
|
||||||
|
|
||||||
|
foreach ( $this->fonts_to_load as $font ) {
|
||||||
|
// Set family.
|
||||||
|
$family = str_replace( ' ', '+', trim( $font['family'] ) );
|
||||||
|
|
||||||
|
// Set weights.
|
||||||
|
$weights = join( ',', $font['weights'] );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_customizer_google_fonts_subset hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$subset = apply_filters( 'csco_customizer_google_fonts_subset', 'latin,latin-ext,cyrillic,cyrillic-ext,vietnamese' );
|
||||||
|
|
||||||
|
$url = "https://fonts.googleapis.com/css?family={$family}:{$weights}&subset={$subset}&display=swap";
|
||||||
|
|
||||||
|
wp_enqueue_style( md5( $url ), $url, array(), csco_get_theme_data( 'Version' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Customizer_Fonts_Google();
|
||||||
|
}
|
||||||
250
core/customizer/modules/class-fonts-theme.php
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Theme Fonts Google
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customizer_Fonts_Theme' ) ) {
|
||||||
|
/**
|
||||||
|
* Customizer Fonts Theme Class.
|
||||||
|
*/
|
||||||
|
final class CSCO_Customizer_Fonts_Theme {
|
||||||
|
/**
|
||||||
|
* The theme fonts.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $fonts_output = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The theme all variants.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $variants_output = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class constructor
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
/**
|
||||||
|
* The csco_theme_fonts hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$this->fonts_output = apply_filters( 'csco_theme_fonts', array() );
|
||||||
|
|
||||||
|
/** Initialize actions */
|
||||||
|
add_action( 'wp', array( $this, 'process_fonts' ) );
|
||||||
|
add_filter( 'admin_init', array( $this, 'set_variants_output' ) );
|
||||||
|
add_filter( 'template_redirect', array( $this, 'set_variants_output' ) );
|
||||||
|
add_filter( 'csco_customizer_dynamic_css', array( $this, 'dynamic_css_fonts_stack' ) );
|
||||||
|
add_filter( 'csco_customizer_fonts_choices', array( $this, 'customizer_fonts_choices' ), 999 );
|
||||||
|
|
||||||
|
if ( ! is_admin() || is_customize_preview() ) {
|
||||||
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_theme_fonts' ), 999 );
|
||||||
|
} else {
|
||||||
|
add_action( 'enqueue_block_assets', array( $this, 'enqueue_theme_fonts' ), 999 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get stack the variants that are used in the theme.
|
||||||
|
*/
|
||||||
|
public function set_variants_output() {
|
||||||
|
$fields = CSCO_Customizer::$fields;
|
||||||
|
|
||||||
|
$extra_variants = array();
|
||||||
|
|
||||||
|
if ( is_array( $fields ) && $fields ) {
|
||||||
|
foreach ( $fields as $field ) {
|
||||||
|
if ( ! isset( $field['type'] ) || false === strpos( $field['type'], 'typography' ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check active callback.
|
||||||
|
if ( ! CSCO_Customizer_Helper::active_callback( $field ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$field_value = CSCO_Customizer_Helper::get_value( $field['settings'] );
|
||||||
|
|
||||||
|
if ( ! isset( $field_value['font-family'] ) || ! $field_value['font-family'] ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set font-family.
|
||||||
|
$font_family = $field_value['font-family'];
|
||||||
|
|
||||||
|
// Set font-weight.
|
||||||
|
$font_weight = ( isset( $field_value['font-weight'] ) && $field_value['font-weight'] ) ? $field_value['font-weight'] : 400;
|
||||||
|
|
||||||
|
$font_weight = ( 'regular' === $font_weight ) ? 400 : absint( $font_weight );
|
||||||
|
|
||||||
|
// Set font-style.
|
||||||
|
$font_style = ( isset( $field_value['font-style'] ) && $field_value['font-style'] ) ? $field_value['font-style'] : 'normal';
|
||||||
|
|
||||||
|
// Add hash.
|
||||||
|
array_push( $extra_variants, $font_family . $font_weight . $font_style );
|
||||||
|
|
||||||
|
if ( ! isset( $field['choices']['variant'] ) || ! $field['choices']['variant'] ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add all possible variations from choices.
|
||||||
|
foreach ( $field['choices']['variant'] as $variant ) {
|
||||||
|
// Get font-weight from variant.
|
||||||
|
$font_weight = $this->get_font_weight( $variant );
|
||||||
|
|
||||||
|
// Get font-style from variant.
|
||||||
|
$font_style = $this->get_font_style( $variant );
|
||||||
|
|
||||||
|
// Add hash of choices.
|
||||||
|
array_push( $extra_variants, $font_family . $font_weight . $font_style );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->variants_output = $extra_variants;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process fonts
|
||||||
|
*/
|
||||||
|
public function process_fonts() {
|
||||||
|
foreach ( $this->fonts_output as $key => $font ) {
|
||||||
|
if ( ! isset( $font['name'] ) || ! isset( $font['variants'] ) ) {
|
||||||
|
unset( $this->fonts_output[ $key ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new fonts for choices
|
||||||
|
*
|
||||||
|
* @param array $fonts List fonts.
|
||||||
|
*/
|
||||||
|
public function customizer_fonts_choices( $fonts ) {
|
||||||
|
|
||||||
|
if ( is_customize_preview() ) {
|
||||||
|
|
||||||
|
// Add new section.
|
||||||
|
if ( $this->fonts_output ) {
|
||||||
|
$fonts['fonts']['families']['theme'] = array(
|
||||||
|
'text' => esc_html__( 'Theme Fonts', 'revision' ),
|
||||||
|
'children' => array(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new font.
|
||||||
|
foreach ( $this->fonts_output as $slug => $font ) {
|
||||||
|
$fonts['fonts']['families']['theme']['children'][] = array(
|
||||||
|
'text' => $font['name'],
|
||||||
|
'id' => $slug,
|
||||||
|
);
|
||||||
|
|
||||||
|
$fonts['fonts']['variants'][ $slug ] = $font['variants'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fonts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend font stack for dynamic styles
|
||||||
|
*
|
||||||
|
* @param string $style The dynamic css.
|
||||||
|
*/
|
||||||
|
public function dynamic_css_fonts_stack( $style ) {
|
||||||
|
|
||||||
|
foreach ( $this->fonts_output as $slug => $font ) {
|
||||||
|
$style = str_replace( sprintf( 'font-family:%s;', $slug ), sprintf( 'font-family:%s,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";', $slug ), $style );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $style;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get font-weight from variant.
|
||||||
|
*
|
||||||
|
* @param string $variant The variant of font.
|
||||||
|
*/
|
||||||
|
public function get_font_weight( $variant = 'regular' ) {
|
||||||
|
$font_weight = filter_var( $variant, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
|
||||||
|
|
||||||
|
return ( 'regular' === $variant || 'italic' === $variant ) ? 400 : absint( $font_weight );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get font-style from variant.
|
||||||
|
*
|
||||||
|
* @param string $variant The variant of font.
|
||||||
|
*/
|
||||||
|
public function get_font_style( $variant = 'regular' ) {
|
||||||
|
return ( false === strpos( $variant, 'italic' ) ) ? 'normal' : 'italic';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all our styles and returns them as a string.
|
||||||
|
*
|
||||||
|
* @param string $method Webfonts Load Method.
|
||||||
|
*/
|
||||||
|
public function get_styles_theme_fonts( $method = null ) {
|
||||||
|
ob_start();
|
||||||
|
foreach ( $this->fonts_output as $slug => $font ) {
|
||||||
|
|
||||||
|
foreach ( $font['variants'] as $variant ) {
|
||||||
|
$font_family = $slug;
|
||||||
|
|
||||||
|
// Get font-weight from variant.
|
||||||
|
$font_weight = $this->get_font_weight( $variant );
|
||||||
|
|
||||||
|
// Get font-style from variant.
|
||||||
|
$font_style = $this->get_font_style( $variant );
|
||||||
|
|
||||||
|
// Get font path.
|
||||||
|
$font_path = get_theme_file_uri( sprintf( 'assets/static/fonts/%s-%s', $slug, $variant ) );
|
||||||
|
|
||||||
|
// Get hash from font.
|
||||||
|
$hash = $font_family . $font_weight . $font_style;
|
||||||
|
|
||||||
|
// Check whether the font is used in the theme.
|
||||||
|
if ( ! in_array( $hash, $this->variants_output, true ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
@font-face {
|
||||||
|
font-family: <?php echo esc_html( $slug ); ?>;
|
||||||
|
src: url('<?php echo esc_html( $font_path ); ?>.woff2') format('woff2'),
|
||||||
|
url('<?php echo esc_html( $font_path ); ?>.woff') format('woff');
|
||||||
|
font-weight: <?php echo esc_html( $font_weight ); ?>;
|
||||||
|
font-style: <?php echo esc_html( $font_style ); ?>;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$styles = ob_get_clean();
|
||||||
|
|
||||||
|
// Remove extra characters.
|
||||||
|
$styles = str_replace( array( "\t", "\r", "\n" ), '', $styles );
|
||||||
|
|
||||||
|
return $styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue theme fonts.
|
||||||
|
*/
|
||||||
|
public function enqueue_theme_fonts() {
|
||||||
|
wp_register_style( 'cs-theme-fonts', false, array(), csco_get_theme_data( 'Version' ) );
|
||||||
|
|
||||||
|
wp_enqueue_style( 'cs-theme-fonts' );
|
||||||
|
|
||||||
|
wp_add_inline_style( 'cs-theme-fonts', $this->get_styles_theme_fonts() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Customizer_Fonts_Theme();
|
||||||
|
}
|
||||||
194
core/customizer/modules/class-fonts.php
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Customizer Fonts
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customizer_Fonts' ) ) {
|
||||||
|
/**
|
||||||
|
* Customizer Fonts Class.
|
||||||
|
*/
|
||||||
|
final class CSCO_Customizer_Fonts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of our google fonts.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @var null|object
|
||||||
|
*/
|
||||||
|
public static $google_fonts = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
/** Initialize actions */
|
||||||
|
add_action( 'wp_ajax_csco_typography_fonts_google_all_get', array( $this, 'get_googlefonts_json' ) );
|
||||||
|
add_action( 'wp_ajax_nopriv_csco_typography_fonts_google_all_get', array( $this, 'get_googlefonts_json' ) );
|
||||||
|
add_action( 'wp_ajax_csco_typography_fonts_standard_all_get', array( $this, 'get_standardfonts_json' ) );
|
||||||
|
add_action( 'wp_ajax_nopriv_csco_typography_fonts_standard_all_get', array( $this, 'get_standardfonts_json' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the googlefonts JSON file.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function get_googlefonts_json() {
|
||||||
|
require get_theme_file_path( '/core/customizer/assets/webfonts.json' ); // phpcs:ignore.
|
||||||
|
wp_die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the standard fonts JSON.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function get_standardfonts_json() {
|
||||||
|
echo wp_json_encode( self::get_standard_fonts() );
|
||||||
|
wp_die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of all available variants.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function get_all_variants() {
|
||||||
|
return array(
|
||||||
|
'100' => esc_html__( 'Ultra-Light 100', 'revision' ),
|
||||||
|
'100light' => esc_html__( 'Ultra-Light 100', 'revision' ),
|
||||||
|
'100italic' => esc_html__( 'Ultra-Light 100 Italic', 'revision' ),
|
||||||
|
'200' => esc_html__( 'Light 200', 'revision' ),
|
||||||
|
'200italic' => esc_html__( 'Light 200 Italic', 'revision' ),
|
||||||
|
'300' => esc_html__( 'Book 300', 'revision' ),
|
||||||
|
'300italic' => esc_html__( 'Book 300 Italic', 'revision' ),
|
||||||
|
'400' => esc_html__( 'Normal 400', 'revision' ),
|
||||||
|
'regular' => esc_html__( 'Normal 400', 'revision' ),
|
||||||
|
'italic' => esc_html__( 'Normal 400 Italic', 'revision' ),
|
||||||
|
'500' => esc_html__( 'Medium 500', 'revision' ),
|
||||||
|
'500italic' => esc_html__( 'Medium 500 Italic', 'revision' ),
|
||||||
|
'600' => esc_html__( 'Semi-Bold 600', 'revision' ),
|
||||||
|
'600bold' => esc_html__( 'Semi-Bold 600', 'revision' ),
|
||||||
|
'600italic' => esc_html__( 'Semi-Bold 600 Italic', 'revision' ),
|
||||||
|
'700' => esc_html__( 'Bold 700', 'revision' ),
|
||||||
|
'700italic' => esc_html__( 'Bold 700 Italic', 'revision' ),
|
||||||
|
'800' => esc_html__( 'Extra-Bold 800', 'revision' ),
|
||||||
|
'800bold' => esc_html__( 'Extra-Bold 800', 'revision' ),
|
||||||
|
'800italic' => esc_html__( 'Extra-Bold 800 Italic', 'revision' ),
|
||||||
|
'900' => esc_html__( 'Ultra-Bold 900', 'revision' ),
|
||||||
|
'900bold' => esc_html__( 'Ultra-Bold 900', 'revision' ),
|
||||||
|
'900italic' => esc_html__( 'Ultra-Bold 900 Italic', 'revision' ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of standard websafe fonts.
|
||||||
|
*
|
||||||
|
* @return array Standard websafe fonts.
|
||||||
|
*/
|
||||||
|
public static function get_standard_fonts() {
|
||||||
|
$standard_fonts = array(
|
||||||
|
'serif' => array(
|
||||||
|
'label' => 'Serif',
|
||||||
|
'stack' => 'Georgia,Times,"Times New Roman",serif',
|
||||||
|
),
|
||||||
|
'sans-serif' => array(
|
||||||
|
'label' => 'Sans Serif',
|
||||||
|
'stack' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',
|
||||||
|
),
|
||||||
|
'monospace' => array(
|
||||||
|
'label' => 'Monospace',
|
||||||
|
'stack' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_customizer_fonts_standard_fonts hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
return apply_filters( 'csco_customizer_fonts_standard_fonts', $standard_fonts );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an array of all available Google Fonts.
|
||||||
|
*
|
||||||
|
* @return array All Google Fonts.
|
||||||
|
*/
|
||||||
|
public static function get_google_fonts() {
|
||||||
|
|
||||||
|
// Get fonts from cache.
|
||||||
|
self::$google_fonts = get_site_transient( 'csco_customizer_googlefonts_cache' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the cache if we're using action=cs-googlefonts-reset-cache in the URL.
|
||||||
|
*
|
||||||
|
* Note to code reviewers:
|
||||||
|
* There's no need to check nonces or anything else, this is a simple true/false evaluation.
|
||||||
|
*/
|
||||||
|
if ( ! empty( $_GET['action'] ) && 'cs-googlefonts-reset-cache' === $_GET['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||||
|
self::$google_fonts = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If cache is populated, return cached fonts array.
|
||||||
|
if ( self::$google_fonts ) {
|
||||||
|
return self::$google_fonts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we got this far, cache was empty so we need to get from JSON.
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
require get_theme_file_path( '/core/customizer/assets/webfonts.json' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||||
|
|
||||||
|
$fonts_json = ob_get_clean();
|
||||||
|
$fonts = json_decode( $fonts_json, true );
|
||||||
|
|
||||||
|
$google_fonts = array();
|
||||||
|
if ( is_array( $fonts ) ) {
|
||||||
|
foreach ( $fonts['items'] as $font ) {
|
||||||
|
$google_fonts[ $font['family'] ] = array(
|
||||||
|
'label' => $font['family'],
|
||||||
|
'variants' => $font['variants'],
|
||||||
|
'category' => $font['category'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the 'csco_customizer_fonts_google_fonts' filter
|
||||||
|
*
|
||||||
|
* The csco_customizer_fonts_google_fonts hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
self::$google_fonts = apply_filters( 'csco_customizer_fonts_google_fonts', $google_fonts );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the array in cache.
|
||||||
|
*
|
||||||
|
* The csco_customizer_googlefonts_transient_time hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$cache_time = apply_filters( 'csco_customizer_googlefonts_transient_time', DAY_IN_SECONDS );
|
||||||
|
set_site_transient( 'csco_customizer_googlefonts_cache', self::$google_fonts, $cache_time );
|
||||||
|
|
||||||
|
return self::$google_fonts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a font-name is a valid google font or not.
|
||||||
|
*
|
||||||
|
* @param string $fontname The name of the font we want to check.
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function is_google_font( $fontname ) {
|
||||||
|
return ( array_key_exists( $fontname, self::$google_fonts ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Customizer_Fonts();
|
||||||
|
}
|
||||||
240
core/customizer/modules/class-output-styles.php
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Theme Customizer Output Styles
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Exit if accessed directly.
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customizer_Output_Styles' ) ) {
|
||||||
|
/**
|
||||||
|
* Class Theme Customizer Output
|
||||||
|
*/
|
||||||
|
class CSCO_Customizer_Output_Styles {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class constructor
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
if ( ! is_admin() || is_customize_preview() ) {
|
||||||
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_output_styles' ), 999 );
|
||||||
|
} else {
|
||||||
|
add_action( 'enqueue_block_assets', array( $this, 'enqueue_output_styles' ), 999 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all our styles and returns them as a string.
|
||||||
|
*/
|
||||||
|
public function get_output_styles() {
|
||||||
|
|
||||||
|
$output_styles = __return_empty_string();
|
||||||
|
|
||||||
|
// Get an array of all our fields.
|
||||||
|
$fields = CSCO_Customizer::$fields;
|
||||||
|
|
||||||
|
// Check if we need to exit early.
|
||||||
|
if ( empty( $fields ) || ! is_array( $fields ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initially we're going to format our styles as an array.
|
||||||
|
// This is going to make processing them a lot easier
|
||||||
|
// and make sure there are no duplicate styles etc.
|
||||||
|
$css = array();
|
||||||
|
|
||||||
|
// Start parsing our fields.
|
||||||
|
foreach ( $fields as $field ) {
|
||||||
|
// No need to process fields without an output, or an improperly-formatted output.
|
||||||
|
if ( ! isset( $field['output'] ) || empty( $field['output'] ) || ! is_array( $field['output'] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the value of this field.
|
||||||
|
$value = CSCO_Customizer_Helper::get_value( $field['settings'] );
|
||||||
|
|
||||||
|
// Check active callback.
|
||||||
|
if ( ! CSCO_Customizer_Helper::active_callback( $field ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start parsing the output arguments of the field.
|
||||||
|
foreach ( $field['output'] as $output ) {
|
||||||
|
|
||||||
|
if ( is_admin() && ! is_customize_preview() ) {
|
||||||
|
// Check if this is an admin style.
|
||||||
|
if ( ! isset( $output['context'] ) || ! in_array( 'editor', $output['context'], true ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} elseif ( isset( $output['context'] ) && ! in_array( 'front', $output['context'], true ) ) {
|
||||||
|
// Check if this is a frontend style.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = wp_parse_args(
|
||||||
|
$output, array(
|
||||||
|
'element' => '',
|
||||||
|
'property' => '',
|
||||||
|
'media_query' => 'global',
|
||||||
|
'prefix' => '',
|
||||||
|
'units' => '',
|
||||||
|
'suffix' => '',
|
||||||
|
'value_pattern' => '$',
|
||||||
|
'choice' => '',
|
||||||
|
'convert' => '',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// If element is an array, convert it to a string.
|
||||||
|
if ( is_array( $output['element'] ) ) {
|
||||||
|
$output['element'] = implode( ',', $output['element'] );
|
||||||
|
}
|
||||||
|
// Simple fields.
|
||||||
|
if ( ! is_array( $value ) ) {
|
||||||
|
$value_pattern = str_replace( '$', ( $value ? $value : '' ), $output['value_pattern'] );
|
||||||
|
|
||||||
|
if ( 'rgb' === $output['convert'] ) {
|
||||||
|
$value_pattern = csco_hex2rgba( $value_pattern, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && $value_pattern ) {
|
||||||
|
$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value_pattern . $output['units'] . $output['suffix'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( 'typography' === $field['type'] ) {
|
||||||
|
|
||||||
|
$value = CSCO_Customizer_Helper::typography_sanitize( $value );
|
||||||
|
|
||||||
|
$properties = array(
|
||||||
|
'font-family',
|
||||||
|
'font-size',
|
||||||
|
'variant',
|
||||||
|
'font-weight',
|
||||||
|
'font-style',
|
||||||
|
'letter-spacing',
|
||||||
|
'word-spacing',
|
||||||
|
'line-height',
|
||||||
|
'text-align',
|
||||||
|
'text-transform',
|
||||||
|
'text-decoration',
|
||||||
|
'color',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $properties as $property ) {
|
||||||
|
// Early exit if the value is not in the defaults.
|
||||||
|
if ( ! isset( $field['default'][ $property ] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Early exit if the value is not saved in the values.
|
||||||
|
if ( ! isset( $value[ $property ] ) || ! $value[ $property ] ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take care of variants.
|
||||||
|
if ( 'variant' === $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) {
|
||||||
|
|
||||||
|
// Get the font_weight.
|
||||||
|
$font_weight = str_replace( 'italic', '', $value['variant'] );
|
||||||
|
$font_weight = in_array( $font_weight, array( '', 'regular' ), true ) ? '400' : $font_weight;
|
||||||
|
|
||||||
|
$css[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight;
|
||||||
|
|
||||||
|
// Is this italic?
|
||||||
|
$is_italic = ( false !== strpos( $value['variant'], 'italic' ) );
|
||||||
|
if ( $is_italic ) {
|
||||||
|
$css[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic';
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $value[ $property ] . $output['suffix'];
|
||||||
|
}
|
||||||
|
} elseif ( 'multicolor' === $field['type'] ) {
|
||||||
|
|
||||||
|
if ( ! empty( $output['element'] ) && ! empty( $output['property'] ) && ! empty( $output['choice'] ) ) {
|
||||||
|
$css[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value[ $output['choice'] ] . $output['units'] . $output['suffix'];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach ( $value as $key => $subvalue ) {
|
||||||
|
$property = $key;
|
||||||
|
|
||||||
|
if ( false !== strpos( $output['property'], '%%' ) ) {
|
||||||
|
|
||||||
|
$property = str_replace( '%%', $key, $output['property'] );
|
||||||
|
|
||||||
|
} elseif ( ! empty( $output['property'] ) ) {
|
||||||
|
|
||||||
|
$output['property'] = $output['property'] . '-' . $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'background-image' === $output['property'] && false === strpos( $subvalue, 'url(' ) ) {
|
||||||
|
$subvalue = sprintf( 'url("%s")', set_url_scheme( $subvalue ) );
|
||||||
|
}
|
||||||
|
if ( $subvalue ) {
|
||||||
|
$css[ $output['media_query'] ][ $output['element'] ][ $property ] = $subvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process the array of CSS properties and produce the final CSS.
|
||||||
|
if ( ! is_array( $css ) || empty( $css ) ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $css as $media_query => $styles ) {
|
||||||
|
$output_styles .= ( 'global' !== $media_query ) ? $media_query . '{' : '';
|
||||||
|
|
||||||
|
foreach ( $styles as $style => $style_array ) {
|
||||||
|
$css_for_style = '';
|
||||||
|
|
||||||
|
foreach ( $style_array as $property => $value ) {
|
||||||
|
if ( is_string( $value ) && '' !== $value ) {
|
||||||
|
$css_for_style .= sprintf( '%s:%s;', $property, $value );
|
||||||
|
} elseif ( is_array( $value ) ) {
|
||||||
|
foreach ( $value as $subvalue ) {
|
||||||
|
if ( is_string( $subvalue ) && '' !== $subvalue ) {
|
||||||
|
$css_for_style .= sprintf( '%s:%s;', $property, $subvalue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$value = ( is_string( $value ) ) ? $value : '';
|
||||||
|
}
|
||||||
|
if ( '' !== $css_for_style ) {
|
||||||
|
$output_styles .= $style . sprintf( '{%s}', $css_for_style );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$output_styles .= ( 'global' !== $media_query ) ? '}' : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_customizer_output_styles hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$output_styles = apply_filters( 'csco_customizer_output_styles', $output_styles );
|
||||||
|
|
||||||
|
return $output_styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue output styles.
|
||||||
|
*/
|
||||||
|
public function enqueue_output_styles() {
|
||||||
|
wp_register_style( 'cs-customizer-output-styles', false, array(), csco_get_theme_data( 'Version' ) );
|
||||||
|
|
||||||
|
wp_enqueue_style( 'cs-customizer-output-styles' );
|
||||||
|
|
||||||
|
wp_add_inline_style( 'cs-customizer-output-styles', $this->get_output_styles() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Customizer_Output_Styles();
|
||||||
|
}
|
||||||
365
core/theme-dashboard/assets/theme-dashboard-rtl.css
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
/* Theme Dashboard */
|
||||||
|
.cs-theme-dashboard .button {
|
||||||
|
transition: 0.25s;
|
||||||
|
box-shadow: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-button:not(:hover) {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-button-primary {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-separator {
|
||||||
|
background: #F0F0F0;
|
||||||
|
height: 1px;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-heading {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-description {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-description:not(:first-child) {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0px 6px;
|
||||||
|
border-radius: 9px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge-success {
|
||||||
|
background: #DEF3ED;
|
||||||
|
color: #3FB28F;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge-info {
|
||||||
|
background: #007CBA;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge-warning {
|
||||||
|
background: #F8E4E4;
|
||||||
|
color: #F58787;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: #FFFFFF;
|
||||||
|
margin: 0 -20px 0 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-col {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-left: 1px solid #f0f0f0;
|
||||||
|
padding: 0 24px;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 60px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-col:first-child {
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-col-logo {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-logo a {
|
||||||
|
display: inline-block;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: #000000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-logo a:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-link-documentation {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-link-documentation:hover span {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-link-documentation i {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero {
|
||||||
|
background: #FFFFFF;
|
||||||
|
display: flex;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-hello {
|
||||||
|
margin-top: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-title {
|
||||||
|
margin-top: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 2rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-badge {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-desc {
|
||||||
|
margin-top: 1rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-go {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-notion {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-warning {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: #dc3232;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-content {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image span {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image img {
|
||||||
|
display: block;
|
||||||
|
zoom: 0.5;
|
||||||
|
}
|
||||||
|
@media (min-width: 1360px) {
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1 0 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .cs-hero {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .form-table {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .form-table th {
|
||||||
|
padding: 12px 0 12px 10px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .form-table td {
|
||||||
|
padding: 12px 10px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-main-content {
|
||||||
|
flex: 1 0 calc(100% - 296px);
|
||||||
|
max-width: calc(100% - 296px);
|
||||||
|
width: 100%;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-sidebar {
|
||||||
|
flex: 1 0 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-main-sidebar {
|
||||||
|
flex: 1 0 276px;
|
||||||
|
max-width: 276px;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 0px 0px 2px 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel + .cs-panel {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel .cs-panel-head {
|
||||||
|
padding: 16px 24px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel .cs-panel-title {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel .cs-panel-content {
|
||||||
|
height: 100%;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab {
|
||||||
|
margin: -16px 0;
|
||||||
|
margin-left: 40px;
|
||||||
|
border-bottom: 4px solid transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
|
||||||
|
display: block;
|
||||||
|
padding: 14px 16px;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 16px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
|
||||||
|
background: #f8f9fd;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
|
||||||
|
background: transparent;
|
||||||
|
border-color: #007CBA;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab.cs-panel-tab-active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-general {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-support .cs-button-wrap {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-community .cs-button-wrap {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-changelog .cs-panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice.cs-theme-dashboard-notice {
|
||||||
|
margin: 20px 0;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0 !important;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.notice.cs-theme-dashboard-notice + .notice.updated {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cs-activation .cs-activation-postbox {
|
||||||
|
margin-right: -24px;
|
||||||
|
margin-left: -2px;
|
||||||
|
padding-right: 24px;
|
||||||
|
padding-left: 24px;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-activation-postbox + .cs-activation-postbox {
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
margin-top: 2rem;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-msg {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-form {
|
||||||
|
max-width: 864px;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-updates {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-newsletter {
|
||||||
|
margin: 10px 0 0 15px;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-supported_until {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=theme-dashboard.css.map */
|
||||||
365
core/theme-dashboard/assets/theme-dashboard.css
Normal file
@@ -0,0 +1,365 @@
|
|||||||
|
/* Theme Dashboard */
|
||||||
|
.cs-theme-dashboard .button {
|
||||||
|
transition: 0.25s;
|
||||||
|
box-shadow: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-button:not(:hover) {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-button-primary {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-separator {
|
||||||
|
background: #F0F0F0;
|
||||||
|
height: 1px;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-heading {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-description {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-description:not(:first-child) {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0px 6px;
|
||||||
|
border-radius: 9px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge-success {
|
||||||
|
background: #DEF3ED;
|
||||||
|
color: #3FB28F;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge-info {
|
||||||
|
background: #007CBA;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-badge-warning {
|
||||||
|
background: #F8E4E4;
|
||||||
|
color: #F58787;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: #FFFFFF;
|
||||||
|
margin: 0 0 0 -20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-col {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-right: 1px solid #f0f0f0;
|
||||||
|
padding: 0 24px;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 60px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-col:first-child {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-header-col-logo {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-logo a {
|
||||||
|
display: inline-block;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: #000000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-logo a:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-link-documentation {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-link-documentation:hover span {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-header .cs-link-documentation i {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero {
|
||||||
|
background: #FFFFFF;
|
||||||
|
display: flex;
|
||||||
|
border-radius: 2px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-hello {
|
||||||
|
margin-top: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-title {
|
||||||
|
margin-top: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 2rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-badge {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-desc {
|
||||||
|
margin-top: 1rem;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-go {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-notion {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-warning {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: #dc3232;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-content {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image span {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image img {
|
||||||
|
display: block;
|
||||||
|
zoom: 0.5;
|
||||||
|
}
|
||||||
|
@media (min-width: 1360px) {
|
||||||
|
.cs-theme-dashboard .cs-hero .cs-hero-image {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1 0 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .cs-hero {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .form-table {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .form-table th {
|
||||||
|
padding: 12px 10px 12px 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-content .form-table td {
|
||||||
|
padding: 12px 10px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-main-content {
|
||||||
|
flex: 1 0 calc(100% - 296px);
|
||||||
|
max-width: calc(100% - 296px);
|
||||||
|
width: 100%;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-main-sidebar {
|
||||||
|
flex: 1 0 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-main-sidebar {
|
||||||
|
flex: 1 0 276px;
|
||||||
|
max-width: 276px;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 0px 0px 2px 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel + .cs-panel {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel .cs-panel-head {
|
||||||
|
padding: 16px 24px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel .cs-panel-title {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel .cs-panel-content {
|
||||||
|
height: 100%;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab {
|
||||||
|
margin: -16px 0;
|
||||||
|
margin-right: 40px;
|
||||||
|
border-bottom: 4px solid transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
|
||||||
|
display: block;
|
||||||
|
padding: 14px 16px;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 16px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
|
||||||
|
background: #f8f9fd;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
|
||||||
|
background: transparent;
|
||||||
|
border-color: #007CBA;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab.cs-panel-tab-active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-general {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-support .cs-button-wrap {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-community .cs-button-wrap {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-changelog .cs-panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice.cs-theme-dashboard-notice {
|
||||||
|
margin: 20px 0;
|
||||||
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0 !important;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.notice.cs-theme-dashboard-notice + .notice.updated {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cs-activation .cs-activation-postbox {
|
||||||
|
margin-left: -24px;
|
||||||
|
margin-right: -2px;
|
||||||
|
padding-left: 24px;
|
||||||
|
padding-right: 24px;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-activation-postbox + .cs-activation-postbox {
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
margin-top: 2rem;
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-msg {
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-form {
|
||||||
|
max-width: 864px;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-updates {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-newsletter {
|
||||||
|
margin: 10px 15px 0 0;
|
||||||
|
}
|
||||||
|
.cs-activation .cs-theme-license-supported_until {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=theme-dashboard.css.map */
|
||||||
53
core/theme-dashboard/assets/theme-dashboard.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
( function( $ ) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Theme Dashboard */
|
||||||
|
|
||||||
|
var cscoThemeDashboard = {};
|
||||||
|
|
||||||
|
( function() {
|
||||||
|
var $this;
|
||||||
|
|
||||||
|
cscoThemeDashboard = {
|
||||||
|
|
||||||
|
/** Initialize */
|
||||||
|
init: function( e ) {
|
||||||
|
|
||||||
|
$this = cscoThemeDashboard;
|
||||||
|
|
||||||
|
// Init events.
|
||||||
|
$this.events( e );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Events */
|
||||||
|
events: function( e ) {
|
||||||
|
|
||||||
|
$( document ).on( 'click', '.cs-panel-tabs .cs-panel-tab a', function( e ) {
|
||||||
|
$this.activePanel( e, this );
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Active Panel */
|
||||||
|
activePanel: function( e, object ) {
|
||||||
|
let $index = $( object ).closest( '.cs-panel-tab' ).index();
|
||||||
|
|
||||||
|
// Set location.
|
||||||
|
window.history.replaceState( '', '', $( object ).attr( 'href' ) );
|
||||||
|
|
||||||
|
// Nav Tabs.
|
||||||
|
$( object ).closest( '.cs-panel-tab' ).addClass( 'cs-panel-tab-active' ).siblings().removeClass( 'cs-panel-tab-active' );
|
||||||
|
|
||||||
|
// Content Tabs.
|
||||||
|
$( '.cs-panel-content-tabs .cs-panel-tab' ).eq( $index ).addClass( 'cs-panel-tab-active' ).siblings().removeClass( 'cs-panel-tab-active' );
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
} )();
|
||||||
|
|
||||||
|
// Initialize.
|
||||||
|
cscoThemeDashboard.init();
|
||||||
|
|
||||||
|
} )( jQuery );
|
||||||
391
core/theme-dashboard/class-theme-dashboard.php
Normal file
@@ -0,0 +1,391 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Theme Dashboard
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Theme_Dashboard' ) ) {
|
||||||
|
/**
|
||||||
|
* Theme Dashboard Class.
|
||||||
|
*/
|
||||||
|
class CSCO_Theme_Dashboard {
|
||||||
|
/**
|
||||||
|
* The slug name to refer to this menu by.
|
||||||
|
*
|
||||||
|
* @var string $menu_slug The menu slug.
|
||||||
|
*/
|
||||||
|
public $menu_slug = 'theme-dashboard';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The settings of page.
|
||||||
|
*
|
||||||
|
* @var array $settings The settings.
|
||||||
|
*/
|
||||||
|
public $settings = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$self = $this;
|
||||||
|
|
||||||
|
/** Include files */
|
||||||
|
if ( ! function_exists( 'get_plugin_data' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Initialize actions */
|
||||||
|
add_action( 'init', array( $this, 'set_settings' ) );
|
||||||
|
|
||||||
|
add_action( 'init', function () use ( $self ) {
|
||||||
|
add_action( 'admin_menu', array( $self, 'add_menu_page' ) );
|
||||||
|
} );
|
||||||
|
|
||||||
|
add_action( 'admin_notices', array( $this, 'notice' ) );
|
||||||
|
|
||||||
|
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 5 );
|
||||||
|
add_action( 'admin_enqueue_scripts', array( $this, 'notice_enqueue_scripts' ), 5 );
|
||||||
|
|
||||||
|
add_action( 'wp_ajax_csco_dashboard_dismissed_handler', array( $this, 'dismissed_handler' ) );
|
||||||
|
|
||||||
|
add_action( 'switch_theme', array( $this, 'reset_notices' ) );
|
||||||
|
add_action( 'after_switch_theme', array( $this, 'reset_notices' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add menu page
|
||||||
|
*/
|
||||||
|
public function add_menu_page() {
|
||||||
|
add_submenu_page( 'themes.php', esc_html__( 'Theme Dashboard', 'revision' ), esc_html__( 'Theme Dashboard', 'revision' ), 'manage_options', $this->menu_slug, array( $this, 'render_page' ), 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings
|
||||||
|
*
|
||||||
|
* @param array $settings The settings.
|
||||||
|
*/
|
||||||
|
public function set_settings( $settings ) {
|
||||||
|
$theme = wp_get_theme( get_template() );
|
||||||
|
|
||||||
|
// Hero.
|
||||||
|
/* translators: Theme Name */
|
||||||
|
$this->settings['hero_title'] = sprintf( esc_html__( 'Welcome to %1$s', 'revision' ), $theme->get('Name') );
|
||||||
|
/* translators: Theme Name */
|
||||||
|
$this->settings['hero_desc'] = sprintf( esc_html__( '%1$s is now installed and activated. To help you with the next step, we\'ve gathered together on this page all the resources you might need. We hope you enjoy using this theme.', 'revision' ), $theme->get('Name') );
|
||||||
|
$this->settings['hero_image'] = __return_false();
|
||||||
|
|
||||||
|
// Documentation.
|
||||||
|
$this->settings['documentation_link'] = sprintf( 'https://codesupply.co/documentation/%s/', $theme->get('TextDomain') );
|
||||||
|
|
||||||
|
// Changelog.
|
||||||
|
$this->settings['changelog_link'] = sprintf( 'https://codesupply.co/documentation/%s/changelog/', $theme->get('TextDomain') );
|
||||||
|
|
||||||
|
// Support.
|
||||||
|
$this->settings['support_link'] = 'https://codesupply.co/support/';
|
||||||
|
|
||||||
|
// Community.
|
||||||
|
$this->settings['community_link'] = 'https://www.facebook.com/codesupplyco/';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Hero
|
||||||
|
*
|
||||||
|
* @param string $location The location.
|
||||||
|
*/
|
||||||
|
public function render_hero( $location = null ) {
|
||||||
|
global $pagenow;
|
||||||
|
|
||||||
|
$theme = wp_get_theme( get_template() );
|
||||||
|
|
||||||
|
$screen = get_current_screen();
|
||||||
|
?>
|
||||||
|
<div class="cs-hero">
|
||||||
|
<div class="cs-hero-content">
|
||||||
|
<div class="cs-hero-hello">
|
||||||
|
<?php esc_html_e( 'Hello, ', 'revision' ); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$current_user = wp_get_current_user();
|
||||||
|
|
||||||
|
echo esc_html( $current_user->display_name );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php esc_html_e( '👋🏻', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-hero-title">
|
||||||
|
<?php echo wp_kses( $this->settings['hero_title'], 'content' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ( isset( $this->settings['hero_desc'] ) && $this->settings['hero_desc'] ) { ?>
|
||||||
|
<div class="cs-hero-desc">
|
||||||
|
<?php echo wp_kses( $this->settings['hero_desc'], 'content' ); ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<a href="<?php echo esc_url( admin_url( '/themes.php?page=theme-demos' ) ); ?>" class="cs-hero-go button button-primary">
|
||||||
|
<?php esc_html_e( 'Go to Theme Demos', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ( isset( $this->settings['hero_image'] ) && $this->settings['hero_image'] ) { ?>
|
||||||
|
<div class="cs-hero-image">
|
||||||
|
<span>
|
||||||
|
<img src="<?php echo esc_url( $this->settings['hero_image'] ); ?>">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render page
|
||||||
|
*/
|
||||||
|
public function render_page() {
|
||||||
|
?>
|
||||||
|
<div class="cs-wrap cs-theme-dashboard">
|
||||||
|
<div class="cs-header">
|
||||||
|
<div class="cs-header-left">
|
||||||
|
<div class="cs-header-col cs-header-col-logo">
|
||||||
|
<div class="cs-logo">
|
||||||
|
<a target="_blank" href="<?php echo esc_url( 'https://codesupply.co/' ); ?>">
|
||||||
|
Code Supply Co.
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-header-right">
|
||||||
|
<a href="<?php echo esc_url( $this->settings['documentation_link'] ); ?>" class="cs-link-documentation" target="_blank">
|
||||||
|
<span><?php esc_html_e( 'Documentation', 'revision' ); ?></span>
|
||||||
|
|
||||||
|
<i class="dashicons dashicons-external"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="wrap">
|
||||||
|
|
||||||
|
<h1 class="hidden"><?php esc_html_e( 'Theme Dashboard', 'revision' ); ?></h1>
|
||||||
|
|
||||||
|
<div class="cs-main">
|
||||||
|
<div class="cs-main-content">
|
||||||
|
<?php $this->render_hero(); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$dashboard_tabs = apply_filters( 'csco_theme_dashboard_tabs', array() );
|
||||||
|
|
||||||
|
if ( $dashboard_tabs ) {
|
||||||
|
// Sort priority.
|
||||||
|
usort( $dashboard_tabs, function ( $item1, $item2 ) {
|
||||||
|
if ( $item1['priority'] === $item2['priority'] ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $item1['priority'] < $item2['priority'] ? -1 : 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set active tab.
|
||||||
|
$active_tab = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : $dashboard_tabs[0]['slug']; // phpcs:ignore.
|
||||||
|
?>
|
||||||
|
<div class="cs-panel cs-panel-general">
|
||||||
|
<div class="cs-panel-head cs-panel-tabs">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
foreach ( $dashboard_tabs as $tab_data ) {
|
||||||
|
$tab_url = add_query_arg( array(
|
||||||
|
'page' => $this->menu_slug,
|
||||||
|
'tab' => $tab_data['slug'],
|
||||||
|
), admin_url( 'themes.php' ) );
|
||||||
|
|
||||||
|
$tab_status = __return_empty_string();
|
||||||
|
|
||||||
|
if ( $active_tab === $tab_data['slug'] ) {
|
||||||
|
$tab_status = 'cs-panel-tab-active';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="cs-panel-tab <?php echo esc_attr( $tab_status ); ?>">
|
||||||
|
<h3 class="cs-panel-title">
|
||||||
|
<a href="<?php echo esc_url( $tab_url ); ?>">
|
||||||
|
<?php echo esc_html( $tab_data['label'] ); ?>
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-panel-content cs-panel-content-tabs">
|
||||||
|
<?php
|
||||||
|
foreach ( $dashboard_tabs as $tab_data ) {
|
||||||
|
$tab_status = __return_empty_string();
|
||||||
|
|
||||||
|
if ( $active_tab === $tab_data['slug'] ) {
|
||||||
|
$tab_status = 'cs-panel-tab-active';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div id="<?php echo esc_url( $tab_data['slug'] ); ?>" class="cs-panel-tab <?php echo esc_attr( $tab_status ); ?>">
|
||||||
|
<?php call_user_func( 'printf', '%s', $tab_data['content'] ); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-main-sidebar">
|
||||||
|
<div class="cs-panel cs-panel-changelog">
|
||||||
|
<div class="cs-panel-head">
|
||||||
|
<h3 class="cs-panel-title"><?php esc_html_e( 'Changelog', 'revision' ); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="cs-panel-content">
|
||||||
|
<div class="cs-description"><?php esc_html_e( 'Keep informed with the latest changes about each theme.', 'revision' ); ?></div>
|
||||||
|
|
||||||
|
<a href="<?php echo esc_url( $this->settings['changelog_link'] ); ?>" class="cs-changelog-link" target="_blank">
|
||||||
|
<?php echo esc_html_e( 'See the Changelog', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-panel cs-panel-support">
|
||||||
|
<div class="cs-panel-head">
|
||||||
|
<h3 class="cs-panel-title"><?php esc_html_e( 'Support', 'revision' ); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="cs-panel-content">
|
||||||
|
<div class="cs-content-primary">
|
||||||
|
<div class="cs-title">
|
||||||
|
<?php echo esc_html__( 'Need help? We\'re here for you!', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-description"><?php esc_html_e( 'Have a question? Hit a bug? Get the help you need, when you need it from our friendly support staff.', 'revision' ); ?></div>
|
||||||
|
|
||||||
|
<div class="cs-button-wrap">
|
||||||
|
<a href="<?php echo esc_url( $this->settings['support_link'] ); ?>" class="cs-button button" target="_blank">
|
||||||
|
<?php echo esc_html_e( 'Get Support', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-panel cs-panel-community">
|
||||||
|
<div class="cs-panel-head">
|
||||||
|
<h3 class="cs-panel-title"><?php esc_html_e( 'Community', 'revision' ); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="cs-panel-content">
|
||||||
|
<div class="cs-title">
|
||||||
|
<?php echo esc_html__( 'Join our Facebook community', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-description"><?php esc_html_e( 'Discuss products and ask for community support or help the community.', 'revision' ); ?></div>
|
||||||
|
|
||||||
|
<div class="cs-button-wrap">
|
||||||
|
<a href="<?php echo esc_url( $this->settings['community_link'] ); ?>" class="cs-button button" target="_blank">
|
||||||
|
<?php echo esc_html_e( 'Join Now', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notice
|
||||||
|
*/
|
||||||
|
public function notice() {
|
||||||
|
global $pagenow;
|
||||||
|
|
||||||
|
$screen = get_current_screen();
|
||||||
|
|
||||||
|
if ( 'themes.php' === $pagenow && 'themes' === $screen->base ) {
|
||||||
|
$transient_name = sprintf( '%s_hero_notice', get_template() );
|
||||||
|
|
||||||
|
if ( ! get_transient( $transient_name ) ) {
|
||||||
|
?>
|
||||||
|
<div class="cs-dashboard-notice notice notice-success cs-theme-dashboard cs-theme-dashboard-notice is-dismissible" data-notice="<?php echo esc_attr( $transient_name ); ?>">
|
||||||
|
<?php $this->render_hero( 'themes' ); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purified from the database information about notification.
|
||||||
|
*/
|
||||||
|
public function reset_notices() {
|
||||||
|
delete_transient( sprintf( '%s_hero_notice', get_template() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dismissed handler
|
||||||
|
*/
|
||||||
|
public function dismissed_handler() {
|
||||||
|
wp_verify_nonce( null );
|
||||||
|
|
||||||
|
if ( isset( $_POST['notice'] ) ) { // Input var ok; sanitization ok.
|
||||||
|
|
||||||
|
set_transient( sanitize_text_field( wp_unslash( $_POST['notice'] ) ), true, 90 * DAY_IN_SECONDS ); // Input var ok.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notice Enqunue Scripts
|
||||||
|
*
|
||||||
|
* @param string $page Current page.
|
||||||
|
*/
|
||||||
|
public function notice_enqueue_scripts( $page ) {
|
||||||
|
wp_enqueue_script( 'jquery' );
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
jQuery(function($) {
|
||||||
|
$( document ).on( 'click', '.cs-dashboard-notice .notice-dismiss', function () {
|
||||||
|
jQuery.post( 'ajax_url', {
|
||||||
|
action: 'csco_dashboard_dismissed_handler',
|
||||||
|
notice: $( this ).closest( '.cs-dashboard-notice' ).data( 'notice' ),
|
||||||
|
});
|
||||||
|
} );
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
$script = str_replace( 'ajax_url', admin_url( 'admin-ajax.php' ), ob_get_clean() );
|
||||||
|
|
||||||
|
wp_add_inline_script( 'jquery', str_replace( array( '<script>', '</script>' ), '', $script ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function will register scripts and styles for admin dashboard.
|
||||||
|
*
|
||||||
|
* @param string $page Current page.
|
||||||
|
*/
|
||||||
|
public function admin_enqueue_scripts( $page ) {
|
||||||
|
wp_enqueue_script( 'csco-theme-dashboard', get_theme_file_uri( '/core/theme-dashboard/assets/theme-dashboard.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/core/theme-dashboard/assets/theme-dashboard.js' ) ), true );
|
||||||
|
|
||||||
|
wp_localize_script( 'csco-theme-dashboard', 'cscoThemeDashboardConfig', array(
|
||||||
|
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||||
|
'nonce' => wp_create_nonce( 'nonce' ),
|
||||||
|
'failed_message' => esc_html__( 'Something went wrong, contact support.', 'revision' ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Styles.
|
||||||
|
wp_enqueue_style( 'csco-theme-dashboard', get_theme_file_uri( '/core/theme-dashboard/assets/theme-dashboard.css' ), array(), filemtime( get_theme_file_path( '/core/theme-dashboard/assets/theme-dashboard.css' ) ) );
|
||||||
|
|
||||||
|
// Add RTL support.
|
||||||
|
wp_style_add_data( 'revision', 'rtl', 'replace' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Theme_Dashboard();
|
||||||
|
}
|
||||||
601
core/theme-demos/assets/theme-demos-rtl.css
Normal file
@@ -0,0 +1,601 @@
|
|||||||
|
/* Demos Page */
|
||||||
|
.cs-demos-page .button {
|
||||||
|
transition: 0.25s;
|
||||||
|
box-shadow: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-button:not(:hover) {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0px 6px;
|
||||||
|
border-radius: 9px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge-success {
|
||||||
|
background: #DEF3ED;
|
||||||
|
color: #3FB28F;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge-info {
|
||||||
|
background: #007CBA;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge-warning {
|
||||||
|
background: #F8E4E4;
|
||||||
|
color: #F58787;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-switch {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
height: 1.75rem;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 36px;
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
border-radius: 9px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-switch .cs-switch-slider {
|
||||||
|
position: absolute;
|
||||||
|
top: 3px;
|
||||||
|
right: 4px;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
z-index: 1;
|
||||||
|
background: #000000;
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: right 0.25s ease;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 5px);
|
||||||
|
left: 0;
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 200px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
background: #1E1E1E;
|
||||||
|
color: #FFF;
|
||||||
|
border-radius: 2px;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-desc {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 5px);
|
||||||
|
right: 0;
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 200px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
background: #1E1E1E;
|
||||||
|
color: #FFF;
|
||||||
|
border-radius: 2px;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox {
|
||||||
|
position: absolute;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
border: none;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: 2;
|
||||||
|
appearance: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox[readony], .cs-demos-page .cs-switcher .cs-checkbox:disabled {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox[readony] ~ .cs-switch, .cs-demos-page .cs-switcher .cs-checkbox:disabled ~ .cs-switch {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox[readony]:hover ~ .cs-tooltip {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox:checked ~ .cs-switch {
|
||||||
|
border-color: #007dba;
|
||||||
|
background: #007dba;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox:checked ~ .cs-switch .cs-switch-slider {
|
||||||
|
background: #FFFFFF;
|
||||||
|
top: 3px;
|
||||||
|
right: calc(50% + 4px);
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-help {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
margin-left: auto;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-help:hover {
|
||||||
|
color: #2271b1;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-help:hover ~ .cs-tooltip-desc {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: #FFFFFF;
|
||||||
|
margin: 0 -20px 0 0;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-left: 1px solid #f0f0f0;
|
||||||
|
padding: 0 24px;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 60px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col:first-child {
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col-logo {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col-logo:only-child {
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-header .cs-header-col-logo {
|
||||||
|
border-left: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-logo a {
|
||||||
|
display: inline-block;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: 20px;
|
||||||
|
color: #000000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-logo a:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
|
||||||
|
grid-gap: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item {
|
||||||
|
display: none;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item:not([data-preview=false]) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item.cs-demo-item-active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-thumbnail {
|
||||||
|
background: #ededed;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-thumbnail:before {
|
||||||
|
display: table;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: 56%;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-thumbnail img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: top center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-preview {
|
||||||
|
background: rgba(255, 255, 255, 0.75);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-decoration: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-preview span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 15px 40px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
transition: background-color 0.5s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item:hover .cs-demo-preview {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-data {
|
||||||
|
border-top: 1px solid #ededed;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 10px 16px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-name {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-badge {
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-actions {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-actions .button {
|
||||||
|
padding: 2px 16px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item:hover .cs-demo-actions {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
visibility: hidden;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 99999999;
|
||||||
|
opacity: 0;
|
||||||
|
padding: 20px;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0.5s;
|
||||||
|
}
|
||||||
|
.cs-import-theme-active .cs-demos-page .cs-import-theme {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0s;
|
||||||
|
}
|
||||||
|
.cs-import-theme-active .cs-demos-page .cs-import-theme .cs-import-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-popup {
|
||||||
|
position: relative;
|
||||||
|
background: #FFFFFF;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 320px;
|
||||||
|
box-shadow: 0px 16px 32px -8px rgba(0, 0, 0, 0.05);
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-header {
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding: 12px 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-subheader {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-kits {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-kits form:first-child .cs-switcher {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-kits-header {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-msg-warning {
|
||||||
|
font-size: 11px;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: #dc3232;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-step {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-step-active {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-plugins {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-content {
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-content:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-load {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-load:after {
|
||||||
|
animation: spin 4s linear infinite;
|
||||||
|
font-family: "dashicons";
|
||||||
|
font-size: 2rem;
|
||||||
|
content: "\f113";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-msg-warning {
|
||||||
|
margin: 0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-actions .button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
margin-left: 0.4rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-output {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-desc {
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #697B96;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-label:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-bar {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 4px;
|
||||||
|
background: #F0F0F0;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-indicator {
|
||||||
|
--cs-indicator: 0%;
|
||||||
|
background: #007CBA;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: var(--cs-indicator);
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-sublabel {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #007CBA;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-info {
|
||||||
|
padding: 76px 24px 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-logo svg {
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
fill: #DEF3ED;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-title {
|
||||||
|
margin-top: 2rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-desc {
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-customize {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-customize .button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions .cs-link {
|
||||||
|
margin-left: 1rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions .cs-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions .button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme-active {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #f1f1f1;
|
||||||
|
visibility: hidden;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 99999998;
|
||||||
|
opacity: 0;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0.5s;
|
||||||
|
}
|
||||||
|
.cs-preview-active .cs-demos-page .cs-preview {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-preview-iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header {
|
||||||
|
margin: 0;
|
||||||
|
box-shadow: inset 0px -1px 0px #F0F0F0;
|
||||||
|
padding-right: 0px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-preview .cs-header {
|
||||||
|
padding-right: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .button {
|
||||||
|
padding: 5px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000000;
|
||||||
|
transition: 0.25s;
|
||||||
|
padding: 0 24px;
|
||||||
|
height: 100%;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow:hover {
|
||||||
|
background: #f8f9fa;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow:before {
|
||||||
|
font-family: "dashicons";
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow.cs-inactive {
|
||||||
|
color: #CCCCCC;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow.cs-prev-demo:before {
|
||||||
|
content: "\f341";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow.cs-next-demo:before {
|
||||||
|
content: "\f345";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-logo {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-info {
|
||||||
|
display: none;
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-info {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-arrow {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-demo-name {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-preview-cancel {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-preview-cancel .button:not(:hover) {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview-active {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=theme-demos.css.map */
|
||||||
601
core/theme-demos/assets/theme-demos.css
Normal file
@@ -0,0 +1,601 @@
|
|||||||
|
/* Demos Page */
|
||||||
|
.cs-demos-page .button {
|
||||||
|
transition: 0.25s;
|
||||||
|
box-shadow: none !important;
|
||||||
|
outline: none !important;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-button:not(:hover) {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0px 6px;
|
||||||
|
border-radius: 9px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge-success {
|
||||||
|
background: #DEF3ED;
|
||||||
|
color: #3FB28F;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge-info {
|
||||||
|
background: #007CBA;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-badge-warning {
|
||||||
|
background: #F8E4E4;
|
||||||
|
color: #F58787;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-switch {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
height: 1.75rem;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 36px;
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
border-radius: 9px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-switch .cs-switch-slider {
|
||||||
|
position: absolute;
|
||||||
|
top: 3px;
|
||||||
|
left: 4px;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
z-index: 1;
|
||||||
|
background: #000000;
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: left 0.25s ease;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 5px);
|
||||||
|
right: 0;
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 200px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
background: #1E1E1E;
|
||||||
|
color: #FFF;
|
||||||
|
border-radius: 2px;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-desc {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 5px);
|
||||||
|
left: 0;
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 200px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
background: #1E1E1E;
|
||||||
|
color: #FFF;
|
||||||
|
border-radius: 2px;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox {
|
||||||
|
position: absolute;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
border: none;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
z-index: 2;
|
||||||
|
appearance: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox[readony], .cs-demos-page .cs-switcher .cs-checkbox:disabled {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox[readony] ~ .cs-switch, .cs-demos-page .cs-switcher .cs-checkbox:disabled ~ .cs-switch {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox[readony]:hover ~ .cs-tooltip {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox:checked ~ .cs-switch {
|
||||||
|
border-color: #007dba;
|
||||||
|
background: #007dba;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-checkbox:checked ~ .cs-switch .cs-switch-slider {
|
||||||
|
background: #FFFFFF;
|
||||||
|
top: 3px;
|
||||||
|
left: calc(50% + 4px);
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-help {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
margin-right: auto;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-help:hover {
|
||||||
|
color: #2271b1;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-switcher .cs-tooltip-help:hover ~ .cs-tooltip-desc {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: #FFFFFF;
|
||||||
|
margin: 0 0 0 -20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-right: 1px solid #f0f0f0;
|
||||||
|
padding: 0 24px;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 60px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col:first-child {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col-logo {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-header-col-logo:only-child {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-header .cs-header-col-logo {
|
||||||
|
border-right: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-logo a {
|
||||||
|
display: inline-block;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
font-size: 20px;
|
||||||
|
color: #000000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-header .cs-logo a:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
|
||||||
|
grid-gap: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item {
|
||||||
|
display: none;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item:not([data-preview=false]) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item.cs-demo-item-active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-thumbnail {
|
||||||
|
background: #ededed;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-thumbnail:before {
|
||||||
|
display: table;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: 56%;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-thumbnail img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: top center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-preview {
|
||||||
|
background: rgba(255, 255, 255, 0.75);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-decoration: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-preview span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 15px 40px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
transition: background-color 0.5s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item:hover .cs-demo-preview {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-data {
|
||||||
|
border-top: 1px solid #ededed;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 10px 16px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-name {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-badge {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-actions {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-actions .button {
|
||||||
|
padding: 2px 16px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-demos .cs-demo-item:hover .cs-demo-actions {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
visibility: hidden;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 99999999;
|
||||||
|
opacity: 0;
|
||||||
|
padding: 20px;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0.5s;
|
||||||
|
}
|
||||||
|
.cs-import-theme-active .cs-demos-page .cs-import-theme {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0s;
|
||||||
|
}
|
||||||
|
.cs-import-theme-active .cs-demos-page .cs-import-theme .cs-import-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-popup {
|
||||||
|
position: relative;
|
||||||
|
background: #FFFFFF;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 320px;
|
||||||
|
box-shadow: 0px 16px 32px -8px rgba(0, 0, 0, 0.05);
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-header {
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
padding: 12px 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-subheader {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-kits {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-kits form:first-child .cs-switcher {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-kits-header {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #697B96;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-msg-warning {
|
||||||
|
font-size: 11px;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
color: #dc3232;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-step {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-step-active {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-plugins {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-content {
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-content:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-load {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-load:after {
|
||||||
|
animation: spin 4s linear infinite;
|
||||||
|
font-family: "dashicons";
|
||||||
|
font-size: 2rem;
|
||||||
|
content: "\f113";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-msg-warning {
|
||||||
|
margin: 0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-start .cs-import-actions .button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
margin-right: 0.4rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-output {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-desc {
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #697B96;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-label:empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-bar {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 4px;
|
||||||
|
background: #F0F0F0;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-indicator {
|
||||||
|
--cs-indicator: 0%;
|
||||||
|
background: #007CBA;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: var(--cs-indicator);
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-process .cs-import-progress-sublabel {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #007CBA;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-info {
|
||||||
|
padding: 76px 24px 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-logo svg {
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
fill: #DEF3ED;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-title {
|
||||||
|
margin-top: 2rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-desc {
|
||||||
|
margin-top: 1rem;
|
||||||
|
text-align: center;
|
||||||
|
color: #1E1E1E;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-customize {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-customize .button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions .cs-link {
|
||||||
|
margin-right: 1rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions .cs-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme .cs-import-finish .cs-import-actions .button {
|
||||||
|
padding: 6px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-import-theme-active {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #f1f1f1;
|
||||||
|
visibility: hidden;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 99999998;
|
||||||
|
opacity: 0;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0.5s;
|
||||||
|
}
|
||||||
|
.cs-preview-active .cs-demos-page .cs-preview {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.5s opacity 0s, 0s visibility 0s;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-preview-iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header {
|
||||||
|
margin: 0;
|
||||||
|
box-shadow: inset 0px -1px 0px #F0F0F0;
|
||||||
|
padding-left: 0px;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-preview .cs-header {
|
||||||
|
padding-left: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .button {
|
||||||
|
padding: 5px 22px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000000;
|
||||||
|
transition: 0.25s;
|
||||||
|
padding: 0 24px;
|
||||||
|
height: 100%;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow:hover {
|
||||||
|
background: #f8f9fa;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow:before {
|
||||||
|
font-family: "dashicons";
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow.cs-inactive {
|
||||||
|
color: #CCCCCC;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow.cs-prev-demo:before {
|
||||||
|
content: "\f341";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-arrow.cs-next-demo:before {
|
||||||
|
content: "\f345";
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-logo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-logo {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-info {
|
||||||
|
display: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
@media (min-width: 960px) {
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-info {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-header-arrow {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-demo-name {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-preview-cancel {
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview .cs-header .cs-preview-cancel .button:not(:hover) {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.cs-demos-page .cs-preview-active {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=theme-demos.css.map */
|
||||||
337
core/theme-demos/assets/theme-demos.js
Normal file
@@ -0,0 +1,337 @@
|
|||||||
|
|
||||||
|
( function( $ ) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------------
|
||||||
|
* Theme Demos */
|
||||||
|
|
||||||
|
var cscoThemeDemos = {};
|
||||||
|
|
||||||
|
( function() {
|
||||||
|
var $this;
|
||||||
|
|
||||||
|
cscoThemeDemos = {
|
||||||
|
|
||||||
|
/** Initialize */
|
||||||
|
init: function( e ) {
|
||||||
|
|
||||||
|
$this = cscoThemeDemos;
|
||||||
|
|
||||||
|
// Init events.
|
||||||
|
$this.events( e );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Events */
|
||||||
|
events: function( e ) {
|
||||||
|
$( document ).on( 'click', '.cs-demo-import-open', function( e ) {
|
||||||
|
$this.openImportDemo( e, this );
|
||||||
|
});
|
||||||
|
$( document ).on( 'click', '.cs-demo-import-close, .cs-import-overlay', function( e ) {
|
||||||
|
$this.closeImportDemo( e, this );
|
||||||
|
});
|
||||||
|
$( document ).on( 'click', '.cs-demo-import-start', function( e ) {
|
||||||
|
$this.startImportDemo( e, this );
|
||||||
|
});
|
||||||
|
$( document ).on( 'click', '.cs-demo-item', function( e ) {
|
||||||
|
$this.openPreviewDemo( e, this );
|
||||||
|
});
|
||||||
|
$( document ).on( 'click', '.cs-prev-demo', function( e ) {
|
||||||
|
$this.openPreviewPrevDemo( e, this );
|
||||||
|
});
|
||||||
|
$( document ).on( 'click', '.cs-next-demo', function( e ) {
|
||||||
|
$this.openPreviewNextDemo( e, this );
|
||||||
|
});
|
||||||
|
$( document ).on( 'click', '.cs-preview-cancel a', function( e ) {
|
||||||
|
$this.closePreviewDemo( e, this );
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Open import demo */
|
||||||
|
openImportDemo: function( e, object ) {
|
||||||
|
|
||||||
|
// Get demo id.
|
||||||
|
var $demo_id = $( object ).data( 'id' );
|
||||||
|
|
||||||
|
// Body import.
|
||||||
|
$( 'body' ).addClass( 'cs-import-theme-active' );
|
||||||
|
|
||||||
|
// Variables.
|
||||||
|
var data = {
|
||||||
|
'action': 'csco_html_import_data',
|
||||||
|
'nonce': cscoThemeDemosConfig.nonce,
|
||||||
|
'demo_id': $demo_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Reset current step.
|
||||||
|
$( '.cs-import-step' ).removeClass( 'cs-import-step-active' );
|
||||||
|
$( '.cs-import-step' ).first().addClass( 'cs-import-step-active' );
|
||||||
|
|
||||||
|
// Remove warning.
|
||||||
|
$( '.cs-import-theme .cs-msg-warning' ).remove();
|
||||||
|
|
||||||
|
// Reset variables.
|
||||||
|
$( '.cs-import-start .cs-import-output' ).html( '' );
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).addClass( 'cs-import-load' );
|
||||||
|
|
||||||
|
$( '.cs-import-process .cs-import-progress-label' ).html( '' );
|
||||||
|
|
||||||
|
$( '.cs-import-process .cs-import-progress-indicator' ).attr( 'style', '--cs-indicator: 0%;' );
|
||||||
|
|
||||||
|
$( '.cs-import-process .cs-import-progress-sublabel' ).html( '0%' );
|
||||||
|
|
||||||
|
// Send Request.
|
||||||
|
$.post( cscoThemeDemosConfig.ajax_url, data, function( response ) {
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).removeClass( 'cs-import-load' );
|
||||||
|
|
||||||
|
if ( response.success ) {
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).html( response.data );
|
||||||
|
|
||||||
|
} else if ( response.data ) {
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).html( `<div class="cs-msg-warning">${response.data}</div>` );
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).html( `<div class="cs-msg-warning">${cscoThemeDemosConfig.failed_message}</div>` );
|
||||||
|
}
|
||||||
|
|
||||||
|
} ).fail( function( xhr, textStatus, e ) {
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).removeClass( 'cs-import-load' );
|
||||||
|
|
||||||
|
$( '.cs-import-start .cs-import-output' ).html( `<div class="cs-msg-warning">${cscoThemeDemosConfig.failed_message}</div>` );
|
||||||
|
} );
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Close import demo */
|
||||||
|
closeImportDemo: function( e, object ) {
|
||||||
|
|
||||||
|
// Remove import from body.
|
||||||
|
$( 'body' ).removeClass( 'cs-import-theme-active' );
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Start import demo */
|
||||||
|
startImportDemo: function( e, object ) {
|
||||||
|
// Change process.
|
||||||
|
$( '.cs-import-step' ).removeClass( 'cs-import-step-active' );
|
||||||
|
$( '.cs-import-process' ).addClass( 'cs-import-step-active' );
|
||||||
|
|
||||||
|
// Run Import.
|
||||||
|
setTimeout( function() {
|
||||||
|
$this.importContent( e, object );
|
||||||
|
}, 10 );
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Open preview demo */
|
||||||
|
openPreviewDemo: function( e, object ) {
|
||||||
|
if ( ! $( e.target ).is( '.cs-demo-import-open, .cs-demo-import-url' ) ) {
|
||||||
|
$this.openPreview( e, object );
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Open preview prev demo */
|
||||||
|
openPreviewPrevDemo: function( e, object ) {
|
||||||
|
|
||||||
|
var prev = $( '.cs-demo-item-open' ).prev( '.cs-demo-item-active' );
|
||||||
|
|
||||||
|
if ( prev.length > 0 ) {
|
||||||
|
$this.openPreview( e, prev );
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Open preview next demo */
|
||||||
|
openPreviewNextDemo: function( e, object ) {
|
||||||
|
var next = $( '.cs-demo-item-open' ).next( '.cs-demo-item-active' );
|
||||||
|
|
||||||
|
if ( next.length > 0 ) {
|
||||||
|
$this.openPreview( e, next );
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Close preview */
|
||||||
|
closePreviewDemo: function( e, object ) {
|
||||||
|
// Remove current class from items.
|
||||||
|
$( '.cs-demo-item' ).removeClass( 'cs-demo-item-open' );
|
||||||
|
|
||||||
|
// Remove preview from body.
|
||||||
|
$( 'body' ).removeClass( 'cs-preview-active' );
|
||||||
|
|
||||||
|
// Remove url from iframe.
|
||||||
|
$( '.cs-preview .cs-preview-iframe' ).removeAttr( 'src' );
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Import indicator */
|
||||||
|
importIndicator: function( e, object, $data ) {
|
||||||
|
// Set indicator.
|
||||||
|
var indicator = Math.round( 100 / $data.steps * $data.index );
|
||||||
|
|
||||||
|
// Change indicator.
|
||||||
|
$( '.cs-import-process .cs-import-progress-indicator' ).attr( 'style', `--cs-indicator: ${indicator}%;` );
|
||||||
|
$( '.cs-import-process .cs-import-progress-sublabel' ).html( `${indicator}%` );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Import step */
|
||||||
|
importStep: function( e, object, $data ) {
|
||||||
|
|
||||||
|
if ( ! $( 'body' ).hasClass( 'cs-import-theme-active' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done.
|
||||||
|
if ( $data.index >= $data.steps ) {
|
||||||
|
// Change step.
|
||||||
|
setTimeout(function(){
|
||||||
|
$( '.cs-import-step' ).removeClass( 'cs-import-step-active' );
|
||||||
|
$( '.cs-import-finish' ).addClass( 'cs-import-step-active' );
|
||||||
|
|
||||||
|
$( document ).trigger( 'DOMImportFinish' );
|
||||||
|
}, 200 );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentAction = $( $data.forms ).eq( $data.index ).find( 'input[name="action"]').val();
|
||||||
|
|
||||||
|
// Set progress label.
|
||||||
|
$( '.cs-import-progress-label' ).html( $( $data.forms ).eq( $data.index ).find( 'input[name="step_name"]').val() );
|
||||||
|
|
||||||
|
// Send Request.
|
||||||
|
$.post( {
|
||||||
|
url: cscoThemeDemosConfig.ajax_url,
|
||||||
|
type: 'POST',
|
||||||
|
data: $( $data.forms ).eq( $data.index ).serialize(),
|
||||||
|
timeout: 0,
|
||||||
|
} ).done( function( response ) {
|
||||||
|
|
||||||
|
if ( response.success || 'elementor_recreate_kit' === currentAction ) {
|
||||||
|
|
||||||
|
if ( 'undefined' !== typeof response.status && 'newAJAX' === response.status ) {
|
||||||
|
|
||||||
|
$this.importStep( e, object, $data );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$data.index = $data.index + 1;
|
||||||
|
|
||||||
|
$this.importIndicator( e, object, $data );
|
||||||
|
$this.importStep( e, object, $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ( response.data ) {
|
||||||
|
|
||||||
|
$( '.cs-import-progress' ).after( `<div class="cs-msg-warning">${response.data}</div>` );
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$( '.cs-import-progress' ).after( `<div class="cs-msg-warning">${cscoThemeDemosConfig.failed_message}</div>` );
|
||||||
|
}
|
||||||
|
|
||||||
|
} ).fail( function( xhr, textStatus, e ) {
|
||||||
|
|
||||||
|
// Pre import.
|
||||||
|
if ( 'elementor_recreate_kit' === currentAction ) {
|
||||||
|
$data.index = $data.index + 1;
|
||||||
|
|
||||||
|
$this.importIndicator( e, object, $data );
|
||||||
|
$this.importStep( e, object, $data );
|
||||||
|
} else {
|
||||||
|
$( '.cs-import-progress' ).after( `<div class="cs-msg-warning">${cscoThemeDemosConfig.failed_message}</div>` );
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Import content */
|
||||||
|
importContent: function( e, object ) {
|
||||||
|
var forms = $( '.cs-import-start form' ).filter(function( index, element ){
|
||||||
|
if ( $( element ).find( '.cs-checkbox' ).prop( 'checked' ) ) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var steps = forms.length;
|
||||||
|
|
||||||
|
if ( steps <= 0 ) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$this.importStep( e, object, {
|
||||||
|
'forms': forms,
|
||||||
|
'steps': steps,
|
||||||
|
'index': 0
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
/** Open preview */
|
||||||
|
openPreview: function( e, object ) {
|
||||||
|
let demo_id = $( object ).data( 'id' );
|
||||||
|
let preview = $( object ).data( 'preview' );
|
||||||
|
let name = $( object ).data( 'name' );
|
||||||
|
let type = $( object ).data( 'type' );
|
||||||
|
|
||||||
|
if ( 'false' === preview ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove current class from siblings items.
|
||||||
|
$( object ).siblings().removeClass( 'cs-demo-item-open' );
|
||||||
|
|
||||||
|
// Current item.
|
||||||
|
$( object ).addClass( 'cs-demo-item-open' );
|
||||||
|
|
||||||
|
// Set demo id.
|
||||||
|
$( '.cs-preview .cs-demo-import-open' ).attr( 'data-id', demo_id );
|
||||||
|
|
||||||
|
// Prev Next Buttons.
|
||||||
|
$( '.cs-preview' ).find( '.cs-prev-demo, .cs-next-demo' ).removeClass( 'cs-inactive' );
|
||||||
|
|
||||||
|
let prev = $( object ).prev( '.cs-demo-item-active' );
|
||||||
|
if ( prev.length <= 0 ) {
|
||||||
|
$( '.cs-preview .cs-prev-demo' ).addClass( 'cs-inactive' );
|
||||||
|
}
|
||||||
|
|
||||||
|
let next = $( object ).next( '.cs-demo-item-active' );
|
||||||
|
if ( next.length <= 0 ) {
|
||||||
|
$( '.cs-preview .cs-next-demo' ).addClass( 'cs-inactive' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset header info.
|
||||||
|
$( '.cs-preview .cs-header-info' ).html( '' );
|
||||||
|
|
||||||
|
// Add name to info.
|
||||||
|
if ( name ) {
|
||||||
|
$( '.cs-preview .cs-header-info' ).prepend( `<div class="cs-demo-name">${name}</div>` );
|
||||||
|
}
|
||||||
|
|
||||||
|
$( '.cs-preview .cs-preview-actions' ).html( $( object ).find( '.cs-demo-actions' ).html() );
|
||||||
|
|
||||||
|
// Set url in iframe.
|
||||||
|
$( '.cs-preview .cs-preview-iframe' ).attr( 'src', preview );
|
||||||
|
|
||||||
|
// Body preview.
|
||||||
|
$( 'body' ).addClass( 'cs-preview-active' );
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
} )();
|
||||||
|
|
||||||
|
// Initialize.
|
||||||
|
cscoThemeDemos.init();
|
||||||
|
|
||||||
|
} )( jQuery );
|
||||||
527
core/theme-demos/class-theme-demos.php
Normal file
@@ -0,0 +1,527 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Theme Demos
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Theme_Demos' ) ) {
|
||||||
|
/**
|
||||||
|
* Theme Demos class.
|
||||||
|
*/
|
||||||
|
class CSCO_Theme_Demos {
|
||||||
|
/**
|
||||||
|
* The slug name to refer to this menu by.
|
||||||
|
*
|
||||||
|
* @var string $menu_slug The menu slug.
|
||||||
|
*/
|
||||||
|
public $menu_slug = 'theme-demos';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The dashboard menu slug.
|
||||||
|
*
|
||||||
|
* @var string $dashboard_menu_slug The dashboard menu slug.
|
||||||
|
*/
|
||||||
|
public $dashboard_menu_slug = 'theme-dashboard';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The demos of page.
|
||||||
|
*
|
||||||
|
* @var array $demos The demos.
|
||||||
|
*/
|
||||||
|
public $demos = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$self = $this;
|
||||||
|
|
||||||
|
if ( ! function_exists( 'get_plugin_data' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/class-widget-importer.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/class-customizer-importer.php' );
|
||||||
|
|
||||||
|
// Include import.
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/class-manager-import.php' );
|
||||||
|
|
||||||
|
// Actions.
|
||||||
|
add_action( 'init', array( $this, 'set_demos' ) );
|
||||||
|
|
||||||
|
add_action( 'init', function () use ( $self ) {
|
||||||
|
add_action( 'admin_menu', array( $self, 'add_menu_page' ) );
|
||||||
|
} );
|
||||||
|
|
||||||
|
add_action( 'wp_ajax_csco_html_import_data', array( $this, 'html_import_data' ) );
|
||||||
|
add_action( 'wp_ajax_nopriv_csco_html_import_data', array( $this, 'html_import_data' ) );
|
||||||
|
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 5 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add menu page
|
||||||
|
*/
|
||||||
|
public function add_menu_page() {
|
||||||
|
add_submenu_page( 'themes.php', esc_html__( 'Theme Demos', 'revision' ), esc_html__( 'Theme Demos', 'revision' ), 'manage_options', $this->menu_slug, array( $this, 'html_carcase' ), 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get plugin status.
|
||||||
|
*
|
||||||
|
* @param string $plugin_path Plugin path.
|
||||||
|
*/
|
||||||
|
public function get_plugin_status( $plugin_path ) {
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin_path ) ) {
|
||||||
|
return 'not_installed';
|
||||||
|
} elseif ( in_array( $plugin_path, (array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin_path ) ) {
|
||||||
|
return 'active';
|
||||||
|
} else {
|
||||||
|
return 'inactive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demos
|
||||||
|
*
|
||||||
|
* @param array $demos The demos.
|
||||||
|
*/
|
||||||
|
public function set_demos( $demos ) {
|
||||||
|
/**
|
||||||
|
* The csco_register_demos_list hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$this->demos = apply_filters( 'csco_register_demos_list', $this->demos );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Html Import Data
|
||||||
|
*/
|
||||||
|
public function html_import_data() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
check_ajax_referer( 'nonce', 'nonce' );
|
||||||
|
|
||||||
|
$demo_id = isset( $_POST['demo_id'] ) ? sanitize_text_field( $_POST['demo_id'] ) : false;
|
||||||
|
|
||||||
|
if ( $demo_id ) {
|
||||||
|
|
||||||
|
if ( ! isset( $this->demos[ $demo_id ] ) ) {
|
||||||
|
wp_send_json_error( esc_html__( 'Invalid demo content id.', 'revision' ) );
|
||||||
|
wp_die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset import data.
|
||||||
|
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( 'csco_importer_data_' ) . '%' ) ); // db call ok; no-cache ok.
|
||||||
|
|
||||||
|
$demo_data = $this->demos[ $demo_id ];
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
|
$demo_plugins = isset( $demo_data['plugins'] ) ? $demo_data['plugins'] : array();
|
||||||
|
|
||||||
|
if ( $demo_plugins ) {
|
||||||
|
foreach ( $demo_plugins as $key => $plugin ) {
|
||||||
|
if ( ! isset( $plugin['name'] ) ) {
|
||||||
|
unset( $demo_plugins[ $key ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( ! isset( $plugin['slug'] ) ) {
|
||||||
|
unset( $demo_plugins[ $key ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( ! isset( $plugin['path'] ) ) {
|
||||||
|
unset( $demo_plugins[ $key ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( 'active' === $this->get_plugin_status( $plugin['path'] ) ) {
|
||||||
|
unset( $demo_plugins[ $key ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="cs-import-data">
|
||||||
|
<?php if ( $demo_plugins ) { ?>
|
||||||
|
<div class="cs-import-plugins">
|
||||||
|
<div class="cs-import-subheader">
|
||||||
|
<?php esc_html_e( 'Install Plugins', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach ( $demo_plugins as $plugin ) {
|
||||||
|
$required = isset( $plugin['required'] ) ? $plugin['required'] : false;
|
||||||
|
?>
|
||||||
|
<form>
|
||||||
|
<div class="cs-switcher">
|
||||||
|
<?php echo esc_html( $plugin['name'] ); ?> <input class="cs-checkbox" type="checkbox" name="<?php echo esc_attr( $plugin['slug'] ); ?>" value="1" <?php echo wp_kses( $required ? 'readony onclick="return false;"' : null, 'content' ); ?> checked>
|
||||||
|
|
||||||
|
<?php if ( isset( $plugin['desc'] ) && $plugin['desc'] ) { ?>
|
||||||
|
<div class="cs-tooltip-help"><i class="dashicons dashicons-editor-help"></i></div>
|
||||||
|
|
||||||
|
<div class="cs-tooltip-desc"><?php echo esc_html( $plugin['desc'] ); ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="cs-switch"><span class="cs-switch-slider"></span></div>
|
||||||
|
|
||||||
|
<div class="cs-tooltip"><?php esc_html_e( 'Required plugin will be installed', 'revision' ); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="plugin_slug" value="<?php echo esc_attr( $plugin['slug'] ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="plugin_path" value="<?php echo esc_attr( $plugin['path'] ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Installing and activating', 'revision' ); ?> <?php echo esc_attr( $plugin['name'] ); ?>...">
|
||||||
|
|
||||||
|
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'nonce' ) ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="csco_import_plugin">
|
||||||
|
</form>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="cs-import-content">
|
||||||
|
<form class="hidden">
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Pre import...', 'revision' ); ?>">
|
||||||
|
<input type="hidden" name="_nonce" value="<?php echo esc_attr( wp_create_nonce( 'elementor_recreate_kit' ) ); ?>">
|
||||||
|
<input type="hidden" name="action" value="elementor_recreate_kit">
|
||||||
|
<input class="cs-checkbox" type="checkbox" name="pre_import" value="1" checked>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="cs-import-subheader">
|
||||||
|
<?php esc_html_e( 'Import Content', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( isset( $demo_data['import']['content'] ) && is_array( $demo_data['import']['content'] ) && $demo_data['import']['content'] ) {
|
||||||
|
$kits = $demo_data['import']['content'];
|
||||||
|
?>
|
||||||
|
<div class="cs-import-kits">
|
||||||
|
<?php foreach ( $kits as $kit ) { ?>
|
||||||
|
<form>
|
||||||
|
<div class="cs-switcher">
|
||||||
|
<?php echo esc_html( $kit['label'] ); ?> <input class="cs-checkbox" type="checkbox" name="url" value="<?php echo esc_attr( $kit['url'] ); ?>" checked>
|
||||||
|
|
||||||
|
<?php if ( isset( $kit['desc'] ) && $kit['desc'] ) { ?>
|
||||||
|
<div class="cs-tooltip-help"><i class="dashicons dashicons-editor-help"></i></div>
|
||||||
|
|
||||||
|
<div class="cs-tooltip-desc"><?php echo esc_html( $kit['desc'] ); ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div class="cs-switch"><span class="cs-switch-slider"></span></div>
|
||||||
|
|
||||||
|
<input type="hidden" name="type" value="<?php echo esc_attr( isset( $kit['type'] ) ? $kit['type'] : 'default' ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Importing', 'revision' ); ?> <?php echo esc_attr( $kit['label'] ); ?> ...">
|
||||||
|
|
||||||
|
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'nonce' ) ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="csco_import_contents">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( isset( $demo_data['import']['customizer'] ) && $demo_data['import']['customizer'] ) { ?>
|
||||||
|
<form>
|
||||||
|
<div class="cs-switcher">
|
||||||
|
<?php esc_html_e( 'Customizer', 'revision' ); ?> <input class="cs-checkbox" type="checkbox" name="url" value="<?php echo esc_attr( $demo_data['import']['customizer'] ); ?>" checked>
|
||||||
|
|
||||||
|
<div class="cs-switch"><span class="cs-switch-slider"></span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Importing customizer options...', 'revision' ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'nonce' ) ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="csco_import_customizer">
|
||||||
|
</form>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( isset( $demo_data['import']['options'] ) && $demo_data['import']['options'] ) { ?>
|
||||||
|
<form>
|
||||||
|
<div class="cs-switcher">
|
||||||
|
<?php esc_html_e( 'Options', 'revision' ); ?> <input class="cs-checkbox" type="checkbox" name="url" value="<?php echo esc_attr( $demo_data['import']['options'] ); ?>" checked>
|
||||||
|
|
||||||
|
<div class="cs-switch"><span class="cs-switch-slider"></span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Importing options...', 'revision' ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'nonce' ) ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="csco_import_options">
|
||||||
|
</form>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( isset( $demo_data['import']['widgets'] ) && $demo_data['import']['widgets'] ) { ?>
|
||||||
|
<form>
|
||||||
|
<div class="cs-switcher">
|
||||||
|
<?php esc_html_e( 'Widgets', 'revision' ); ?> <input class="cs-checkbox" type="checkbox" name="url" value="<?php echo esc_attr( $demo_data['import']['widgets'] ); ?>" checked>
|
||||||
|
|
||||||
|
<div class="cs-switch"><span class="cs-switch-slider"></span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Importing widgets...', 'revision' ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'nonce' ) ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="csco_import_widgets">
|
||||||
|
</form>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<form class="hidden">
|
||||||
|
<div class="cs-switcher">
|
||||||
|
<?php esc_html_e( 'Finish', 'revision' ); ?> <input class="cs-checkbox" type="checkbox" name="finish" value="1" checked>
|
||||||
|
|
||||||
|
<div class="cs-switch"><span class="cs-switch-slider"></span></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="step_name" value="<?php esc_attr_e( 'Finishing setup...', 'revision' ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'nonce' ) ); ?>">
|
||||||
|
|
||||||
|
<input type="hidden" name="action" value="csco_import_finish">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-actions">
|
||||||
|
<div class="cs-import-theme-cancel">
|
||||||
|
<a href="#" class="cs-button cs-demo-import-close button">
|
||||||
|
<?php esc_html_e( 'Cancel', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-theme-start">
|
||||||
|
<a href="#" class="cs-demo-import-start button button-primary">
|
||||||
|
<?php esc_html_e( 'Import', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
wp_send_json_success( ob_get_clean() );
|
||||||
|
} else {
|
||||||
|
wp_send_json_error( esc_html__( 'Demo content id not set.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Html Carcase
|
||||||
|
*/
|
||||||
|
public function html_carcase() {
|
||||||
|
?>
|
||||||
|
<div class="cs-wrap cs-demos-page">
|
||||||
|
<div class="cs-header">
|
||||||
|
<div class="cs-header-left">
|
||||||
|
<div class="cs-header-col cs-header-col-logo">
|
||||||
|
<div class="cs-logo">
|
||||||
|
<a target="_blank" href="<?php echo esc_url( 'https://codesupply.co/' ); ?>">
|
||||||
|
Code Supply Co.
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="wrap">
|
||||||
|
<h1 class="hidden"><?php esc_html_e( 'Theme Demos', 'revision' ); ?></h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( $this->demos ) {
|
||||||
|
?>
|
||||||
|
<div class="cs-demos">
|
||||||
|
<?php
|
||||||
|
foreach ( $this->demos as $demo_id => $demo ) {
|
||||||
|
// Demo Variables.
|
||||||
|
$name = isset( $demo['name'] ) && $demo['name'] ? $demo['name'] : null;
|
||||||
|
$preview = isset( $demo['preview'] ) && $demo['preview'] ? $demo['preview'] : 'false';
|
||||||
|
?>
|
||||||
|
<div class="cs-demo-item cs-demo-item-active"
|
||||||
|
data-id="<?php echo esc_attr( $demo_id ); ?>"
|
||||||
|
data-name="<?php echo esc_attr( $name ); ?>"
|
||||||
|
data-preview="<?php echo esc_url( $preview ); ?>">
|
||||||
|
|
||||||
|
<div class="cs-demo-outer">
|
||||||
|
<div class="cs-demo-thumbnail">
|
||||||
|
<?php if ( isset( $demo['thumbnail'] ) && $demo['thumbnail'] ) { ?>
|
||||||
|
<img src="<?php echo esc_url( $demo['thumbnail'] ); ?>">
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ( isset( $demo['preview'] ) && $demo['preview'] ) { ?>
|
||||||
|
<div class="cs-demo-preview">
|
||||||
|
<span>
|
||||||
|
<?php esc_html_e( 'Preview Demo', 'revision' ); ?>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<div class="cs-demo-data">
|
||||||
|
<div class="cs-demo-info">
|
||||||
|
<?php if ( isset( $demo['name'] ) && $demo['name'] ) { ?>
|
||||||
|
<div class="cs-demo-name"><?php echo esc_html( $demo['name'] ); ?></div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-demo-actions">
|
||||||
|
<div class="cs-demo-import">
|
||||||
|
<a href="#" target="_blank" data-id="<?php echo esc_attr( $demo_id ); ?>" class="cs-demo-import-open button button-primary">
|
||||||
|
<?php esc_html_e( 'Import', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-theme">
|
||||||
|
<div class="cs-import-overlay"></div>
|
||||||
|
|
||||||
|
<div class="cs-import-popup">
|
||||||
|
<div class="cs-import-container">
|
||||||
|
<div class="cs-import-step cs-import-step-active cs-import-start">
|
||||||
|
<div class="cs-import-header">
|
||||||
|
<?php esc_html_e( 'Import Theme', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-output"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-step cs-import-process">
|
||||||
|
<div class="cs-import-header">
|
||||||
|
<?php esc_html_e( 'Installing', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-output">
|
||||||
|
<div class="cs-import-desc">
|
||||||
|
<?php esc_html_e( 'Please be patient and don\'t refresh this page, the import process may take a while, this also depends on your server.', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-progress">
|
||||||
|
<div class="cs-import-progress-label"></div>
|
||||||
|
|
||||||
|
<div class="cs-import-progress-bar">
|
||||||
|
<div class="cs-import-progress-indicator"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-progress-sublabel">0%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-step cs-import-finish">
|
||||||
|
<div class="cs-import-info">
|
||||||
|
<div class="cs-import-logo">
|
||||||
|
<svg class="progress-icon" width="96" height="96" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g class="tick-icon" stroke-width="1" stroke="#3FB28F" transform="translate(1, 1.2)">
|
||||||
|
<path id="tick-outline-path" d="M14 28c7.732 0 14-6.268 14-14S21.732 0 14 0 0 6.268 0 14s6.268 14 14 14z"/>
|
||||||
|
<path id="tick-path" d="M6.173 16.252l5.722 4.228 9.22-12.69"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-title">
|
||||||
|
<?php esc_html_e( 'Imported Succefully', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-desc">
|
||||||
|
<?php esc_html_e( 'Go ahead, customize the text, images and design to make it yours!', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-customize">
|
||||||
|
<a href="<?php echo esc_url( admin_url( '/customize.php' ) ); ?>" class="button button-primary" target="_blank">
|
||||||
|
<?php esc_html_e( 'Customize', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-import-actions">
|
||||||
|
<a href="<?php echo esc_url( add_query_arg( 'page', $this->dashboard_menu_slug, admin_url( 'themes.php' ) ) ); ?>" class="cs-link">
|
||||||
|
<?php esc_html_e( 'Return to Dashboard', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="<?php echo esc_url( home_url() ); ?>" class="cs-button button" target="_blank">
|
||||||
|
<?php esc_html_e( 'View Site', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-preview">
|
||||||
|
<div class="cs-header">
|
||||||
|
<div class="cs-header-left">
|
||||||
|
<div class="cs-header-col cs-header-logo">
|
||||||
|
<div class="cs-logo">
|
||||||
|
<a target="_blank" href="<?php echo esc_url( 'https://codesupply.co/' ); ?>">
|
||||||
|
Code Supply Co.
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-header-col cs-header-arrow">
|
||||||
|
<a href="#" class="cs-arrow cs-prev-demo"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-header-col cs-header-arrow">
|
||||||
|
<a href="#" class="cs-arrow cs-next-demo"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-header-col cs-header-info"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-header-right">
|
||||||
|
<div class="cs-preview-cancel">
|
||||||
|
<a href="#" class="button">
|
||||||
|
<?php esc_html_e( 'Cancel', 'revision' ); ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cs-preview-actions"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<i<?php echo esc_attr( 'frame' ); ?> id="cs-preview-i<?php echo esc_attr( 'frame' ); ?>" class="cs-preview-i<?php echo esc_attr( 'frame' ); ?>"></i<?php echo esc_attr( 'frame' ); ?>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function will register scripts and styles for admin dashboard.
|
||||||
|
*
|
||||||
|
* @param string $page Current page.
|
||||||
|
*/
|
||||||
|
public function admin_enqueue_scripts( $page ) {
|
||||||
|
wp_enqueue_script( 'cs-theme-demos', get_theme_file_uri( '/core/theme-demos/assets/theme-demos.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/core/theme-demos/assets/theme-demos.js' ) ), true );
|
||||||
|
|
||||||
|
wp_localize_script( 'cs-theme-demos', 'cscoThemeDemosConfig', array(
|
||||||
|
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||||
|
'nonce' => wp_create_nonce( 'nonce' ),
|
||||||
|
'failed_message' => esc_html__( 'Something went wrong, contact support.', 'revision' ),
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Styles.
|
||||||
|
wp_enqueue_style( 'cs-theme-demos', get_theme_file_uri( '/core/theme-demos/assets/theme-demos.css' ), array(), filemtime( get_theme_file_path( '/core/theme-demos/assets/theme-demos.css' ) ) );
|
||||||
|
|
||||||
|
// Add RTL support.
|
||||||
|
wp_style_add_data( 'revision', 'rtl', 'replace' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Theme_Demos();
|
||||||
|
}
|
||||||
185
core/theme-demos/import/class-customizer-importer.php
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Class for the customizer importer.
|
||||||
|
*
|
||||||
|
* Code is mostly from the Customizer Export/Import plugin.
|
||||||
|
*
|
||||||
|
* @see https://wordpress.org/plugins/customizer-export-import/
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customizer Importer
|
||||||
|
*/
|
||||||
|
class CSCO_Customizer_Importer {
|
||||||
|
/**
|
||||||
|
* Import customizer.
|
||||||
|
*
|
||||||
|
* @param array $data The data.
|
||||||
|
*/
|
||||||
|
public static function import( $data ) {
|
||||||
|
// Try to import the customizer settings.
|
||||||
|
return self::import_customizer_options( $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports uploaded mods and calls WordPress core customize_save actions so
|
||||||
|
* themes that hook into them can act before mods are saved to the database.
|
||||||
|
*
|
||||||
|
* Update: WP core customize_save actions were removed, because of some errors.
|
||||||
|
*
|
||||||
|
* @param array $data The data.
|
||||||
|
* @return void|WP_Error
|
||||||
|
*/
|
||||||
|
public static function import_customizer_options( $data ) {
|
||||||
|
// Setup global vars.
|
||||||
|
global $wp_customize;
|
||||||
|
|
||||||
|
// Data check.
|
||||||
|
if ( ! is_array( $data ) || ! isset( $data['mods'] ) ) {
|
||||||
|
return new WP_Error(
|
||||||
|
'customizer_import_data_error',
|
||||||
|
esc_html__( 'Error: The customizer import file is not in a correct format. Please make sure to use the correct customizer import file.', 'revision' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import images.
|
||||||
|
*
|
||||||
|
* The csco_customizer_import_images hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
if ( apply_filters( 'csco_customizer_import_images', true ) ) {
|
||||||
|
$data['mods'] = self::import_customizer_images( $data['mods'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import custom options.
|
||||||
|
if ( isset( $data['options'] ) ) {
|
||||||
|
// Require modified customizer options class.
|
||||||
|
if ( ! class_exists( 'WP_Customize_Setting' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-includes/class-wp-customize-setting.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'CSCO_Customizer_Option' ) ) {
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/class-customizer-option.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $data['options'] as $option_key => $option_value ) {
|
||||||
|
$option = new CSCO_Customizer_Option( $wp_customize, $option_key, array(
|
||||||
|
'default' => '',
|
||||||
|
'type' => 'option',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
) );
|
||||||
|
|
||||||
|
$option->import( $option_value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_enable_wp_customize_save_hooks hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$use_wp_customize_save_hooks = apply_filters( 'csco_enable_wp_customize_save_hooks', false );
|
||||||
|
|
||||||
|
if ( $use_wp_customize_save_hooks ) {
|
||||||
|
/**
|
||||||
|
* The customize_save hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'customize_save', $wp_customize );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import mods.
|
||||||
|
if ( isset( $data['mods'] ) && $data['mods'] ) {
|
||||||
|
foreach ( $data['mods'] as $key => & $value ) {
|
||||||
|
if ( $use_wp_customize_save_hooks ) {
|
||||||
|
/**
|
||||||
|
* The customize_save_{$key} hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'customize_save_' . $key, $wp_customize );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the mod.
|
||||||
|
set_theme_mod( $key, $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import mods Adobe Fonts.
|
||||||
|
if ( isset( $data['mods_adobe'] ) && $data['mods_adobe'] ) {
|
||||||
|
foreach ( $data['mods_adobe'] as $key => & $value ) {
|
||||||
|
if ( $use_wp_customize_save_hooks ) {
|
||||||
|
/**
|
||||||
|
* The customize_save_{$key} hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'customize_save_' . $key, $wp_customize );
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = get_option( 'powerkit_typekit_fonts_token' );
|
||||||
|
$kit = get_option( 'powerkit_typekit_fonts_kit' );
|
||||||
|
|
||||||
|
$kit_fonts = get_option( 'pk_typekit_' . $kit . '_s' );
|
||||||
|
$families = ( $kit_fonts ) ? $kit_fonts['kit']['families'] : false;
|
||||||
|
$font_found = false;
|
||||||
|
|
||||||
|
// Search for the font slug from a theme_mod in the active Adobe font kit.
|
||||||
|
if ( isset( $value['font-family'] ) && $families ) {
|
||||||
|
foreach ( $families as $k => $v ) {
|
||||||
|
if ( isset( $v['slug'] ) && $value['font-family'] === $v['slug'] ) {
|
||||||
|
$font_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( isset( $v['css_names'][0] ) && $value['font-family'] === $v['css_names'][0] ) {
|
||||||
|
$font_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default font family.
|
||||||
|
if ( is_array( $value ) && ( ! $token || ! $kit || ! $font_found ) ) {
|
||||||
|
$value['font-family'] = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the mod.
|
||||||
|
set_theme_mod( $key, $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $use_wp_customize_save_hooks ) {
|
||||||
|
/**
|
||||||
|
* The customize_save_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'customize_save_after', $wp_customize );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function: Customizer import - imports images for settings saved as mods.
|
||||||
|
*
|
||||||
|
* @param array $mods An array of customizer mods.
|
||||||
|
* @return array The mods array with any new import data.
|
||||||
|
*/
|
||||||
|
private static function import_customizer_images( $mods ) {
|
||||||
|
foreach ( $mods as $key => $val ) {
|
||||||
|
if ( CSCO_Manager_Import::is_image_url( $val ) ) {
|
||||||
|
|
||||||
|
$data = CSCO_Manager_Import::import_custom_image( $val );
|
||||||
|
|
||||||
|
if ( ! is_wp_error( $data ) ) {
|
||||||
|
$mods[ $key ] = $data->url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $mods;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
core/theme-demos/import/class-customizer-option.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* A class that extends WP_Customize_Setting so we can access
|
||||||
|
* the protected updated method when importing options.
|
||||||
|
*
|
||||||
|
* Used in the Customizer importer.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class CSCO_Customizer_Option extends WP_Customize_Setting {
|
||||||
|
/**
|
||||||
|
* Import an option value for this setting.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @param mixed $value The option value.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function import( $value ) {
|
||||||
|
$this->update( $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
901
core/theme-demos/import/class-manager-import.php
Normal file
@@ -0,0 +1,901 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Manager Import.
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manager Import Class
|
||||||
|
*/
|
||||||
|
class CSCO_Manager_Import {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton instance
|
||||||
|
*
|
||||||
|
* @var CSCO_Manager_Import
|
||||||
|
*/
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sites Server API URL
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $api_url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get singleton instance.
|
||||||
|
*
|
||||||
|
* @return CSCO_Manager_Import
|
||||||
|
*/
|
||||||
|
public static function instance() {
|
||||||
|
if ( is_null( self::$instance ) ) {
|
||||||
|
self::$instance = new self();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time in milliseconds, marking the beginning of the import.
|
||||||
|
*
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
|
private $microtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
add_action( 'after_setup_theme', array( $this, 'init' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize plugin.
|
||||||
|
*/
|
||||||
|
public function init() {
|
||||||
|
add_action( 'upload_mimes', array( $this, 'add_custom_mimes' ) );
|
||||||
|
add_filter( 'wp_check_filetype_and_ext', array( $this, 'real_mime_type_for_xml' ), 10, 4 );
|
||||||
|
add_filter( 'admin_init', array( $this, 'ajax_runtime_hide_errors' ), 0 );
|
||||||
|
add_filter( 'query', array( $this, 'ajax_wpdb_hide_errors' ), 0 );
|
||||||
|
add_action( 'wp_ajax_csco_import_plugin', array( $this, 'ajax_import_plugin' ) );
|
||||||
|
add_action( 'wp_ajax_csco_import_contents', array( $this, 'ajax_import_contents' ) );
|
||||||
|
add_action( 'wp_ajax_csco_import_customizer', array( $this, 'ajax_import_customizer' ) );
|
||||||
|
add_action( 'wp_ajax_csco_import_widgets', array( $this, 'ajax_import_widgets' ) );
|
||||||
|
add_action( 'wp_ajax_csco_import_options', array( $this, 'ajax_import_options' ) );
|
||||||
|
add_action( 'wp_ajax_csco_import_finish', array( $this, 'ajax_import_finish' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre Plugin Setup
|
||||||
|
*/
|
||||||
|
public function pre_plugin_setup() {
|
||||||
|
/* Woocommerce */
|
||||||
|
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_false' );
|
||||||
|
add_filter( 'woocommerce_enable_setup_wizard', '__return_false' );
|
||||||
|
|
||||||
|
/* Elementor */
|
||||||
|
set_transient( 'elementor_activation_redirect', false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function: Import image.
|
||||||
|
*
|
||||||
|
* @param string $url Image url.
|
||||||
|
* @param bool $retina Support retina.
|
||||||
|
* @return array The import data.
|
||||||
|
*/
|
||||||
|
public static function import_custom_image( $url, $retina = true ) {
|
||||||
|
|
||||||
|
$data = self::sideload_image( $url );
|
||||||
|
|
||||||
|
if ( $retina ) {
|
||||||
|
// Upload @2x image.
|
||||||
|
self::sideload_image(
|
||||||
|
str_replace( array( '.jpg', '.jpeg', '.png', '.gif', '.webp' ),
|
||||||
|
array( '@2x.jpg', '@2x.jpeg', '@2x.png', '@2x.gif', '@2x.webp' ),
|
||||||
|
$url
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! is_wp_error( $data ) ) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Taken from the core media_sideload_image function and
|
||||||
|
* modified to return an array of data instead of html.
|
||||||
|
*
|
||||||
|
* @param string $file The image file path.
|
||||||
|
* @return array An array of image data.
|
||||||
|
*/
|
||||||
|
public static function sideload_image( $file ) {
|
||||||
|
$data = new stdClass();
|
||||||
|
|
||||||
|
if ( ! function_exists( 'media_handle_sideload' ) ) {
|
||||||
|
call_user_func( 'require_once', ABSPATH . 'wp-admin/includes/media.php' );
|
||||||
|
call_user_func( 'require_once', ABSPATH . 'wp-admin/includes/file.php' );
|
||||||
|
call_user_func( 'require_once', ABSPATH . 'wp-admin/includes/image.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $file ) ) {
|
||||||
|
// Set variables for storage, fix file filename for query strings.
|
||||||
|
preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png|webp)\b/i', $file, $matches );
|
||||||
|
|
||||||
|
$file_array = array();
|
||||||
|
|
||||||
|
$file_array['name'] = basename( $matches[0] );
|
||||||
|
|
||||||
|
// Download file to temp location.
|
||||||
|
$file_array['tmp_name'] = download_url( $file );
|
||||||
|
|
||||||
|
// If error storing temporarily, return the error.
|
||||||
|
if ( is_wp_error( $file_array['tmp_name'] ) ) {
|
||||||
|
return $file_array['tmp_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do the validation and storage stuff.
|
||||||
|
$id = media_handle_sideload( $file_array, 0 );
|
||||||
|
|
||||||
|
// If error storing permanently, unlink.
|
||||||
|
if ( is_wp_error( $id ) ) {
|
||||||
|
unlink( $file_array['tmp_name'] );
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the object to return.
|
||||||
|
$meta = wp_get_attachment_metadata( $id );
|
||||||
|
$data->attachment_id = $id;
|
||||||
|
$data->url = wp_get_attachment_url( $id );
|
||||||
|
$data->thumbnail_url = wp_get_attachment_thumb_url( $id );
|
||||||
|
$data->height = $meta['height'];
|
||||||
|
$data->width = $meta['width'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to see whether a string is an image url or not.
|
||||||
|
*
|
||||||
|
* @param string $string The string to check.
|
||||||
|
* @return bool Whether the string is an image url or not.
|
||||||
|
*/
|
||||||
|
public static function is_image_url( $string = '' ) {
|
||||||
|
if ( is_string( $string ) ) {
|
||||||
|
if ( preg_match( '/\.(jpg|jpeg|png|gif|webp)/i', $string ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add custom mimes for the uploader.
|
||||||
|
*
|
||||||
|
* @param array $mimes The mimes.
|
||||||
|
*/
|
||||||
|
public function add_custom_mimes( $mimes ) {
|
||||||
|
// Allow XML files.
|
||||||
|
$mimes['xml'] = 'text/xml';
|
||||||
|
|
||||||
|
// Allow JSON files.
|
||||||
|
$mimes['json'] = 'application/json';
|
||||||
|
|
||||||
|
return $mimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the "real" file type of the given file.
|
||||||
|
*
|
||||||
|
* @param array $wp_check_filetype_and_ext The wp_check_filetype_and_ext.
|
||||||
|
* @param string $file The file.
|
||||||
|
* @param string $filename The filename.
|
||||||
|
* @param array $mimes The mimes.
|
||||||
|
*/
|
||||||
|
public function real_mime_type_for_xml( $wp_check_filetype_and_ext, $file, $filename, $mimes ) {
|
||||||
|
if ( '.xml' === substr( $filename, -4 ) ) {
|
||||||
|
$wp_check_filetype_and_ext['ext'] = 'xml';
|
||||||
|
$wp_check_filetype_and_ext['type'] = 'text/xml';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $wp_check_filetype_and_ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get plugin status.
|
||||||
|
*
|
||||||
|
* @param string $plugin_path Plugin path.
|
||||||
|
*/
|
||||||
|
public function get_plugin_status( $plugin_path ) {
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! file_exists( WP_PLUGIN_DIR . '/' . $plugin_path ) ) {
|
||||||
|
return 'not_installed';
|
||||||
|
} elseif ( in_array( $plugin_path, (array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin_path ) ) {
|
||||||
|
return 'active';
|
||||||
|
} else {
|
||||||
|
return 'inactive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install a plugin.
|
||||||
|
*
|
||||||
|
* @param string $plugin_slug Plugin slug.
|
||||||
|
*/
|
||||||
|
public function install_plugin( $plugin_slug ) {
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! function_exists( 'plugins_api' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||||
|
}
|
||||||
|
if ( ! class_exists( 'WP_Upgrader' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( false === filter_var( $plugin_slug, FILTER_VALIDATE_URL ) ) {
|
||||||
|
$api = plugins_api(
|
||||||
|
'plugin_information',
|
||||||
|
array(
|
||||||
|
'slug' => $plugin_slug,
|
||||||
|
'fields' => array(
|
||||||
|
'short_description' => false,
|
||||||
|
'sections' => false,
|
||||||
|
'requires' => false,
|
||||||
|
'rating' => false,
|
||||||
|
'ratings' => false,
|
||||||
|
'downloaded' => false,
|
||||||
|
'last_updated' => false,
|
||||||
|
'added' => false,
|
||||||
|
'tags' => false,
|
||||||
|
'compatibility' => false,
|
||||||
|
'homepage' => false,
|
||||||
|
'donate_link' => false,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$download_link = $api->download_link;
|
||||||
|
} else {
|
||||||
|
$download_link = $plugin_slug;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use AJAX upgrader skin instead of plugin installer skin.
|
||||||
|
// ref: function wp_ajax_install_plugin().
|
||||||
|
$upgrader = new Plugin_Upgrader( new WP_Ajax_Upgrader_Skin() );
|
||||||
|
|
||||||
|
$this->pre_plugin_setup();
|
||||||
|
|
||||||
|
$install = $upgrader->install( $download_link );
|
||||||
|
|
||||||
|
if ( false === $install ) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate a plugin.
|
||||||
|
*
|
||||||
|
* @param string $plugin_path Plugin path.
|
||||||
|
*/
|
||||||
|
public function activate_plugin( $plugin_path ) {
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->pre_plugin_setup();
|
||||||
|
|
||||||
|
$activate = activate_plugin( $plugin_path, '', false, true );
|
||||||
|
|
||||||
|
if ( is_wp_error( $activate ) ) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect ajax import.
|
||||||
|
*/
|
||||||
|
public function is_ajax_import() {
|
||||||
|
if ( __return_false() ) {
|
||||||
|
check_ajax_referer();
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_action = __return_empty_string();
|
||||||
|
|
||||||
|
if ( isset( $_REQUEST['action'] ) ) {
|
||||||
|
$current_action = sanitize_text_field( $_REQUEST['action'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( preg_match( '/csco_import/', $current_action ) ) {
|
||||||
|
return $current_action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide errors for wpdb
|
||||||
|
*
|
||||||
|
* @param object $query The query.
|
||||||
|
*/
|
||||||
|
public function ajax_wpdb_hide_errors( $query ) {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
if ( $this->is_ajax_import() ) {
|
||||||
|
$wpdb->hide_errors();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide errors for runtime
|
||||||
|
*/
|
||||||
|
public function ajax_runtime_hide_errors() {
|
||||||
|
call_user_func( 'ini_set', 'display_errors', 'Off' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajax import start
|
||||||
|
*/
|
||||||
|
public function ajax_import_start() {
|
||||||
|
ob_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajax import end
|
||||||
|
*/
|
||||||
|
public function ajax_import_end() {
|
||||||
|
ob_end_flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a JSON response back to an Ajax request, indicating failure.
|
||||||
|
*
|
||||||
|
* @param mixed $data Data to encode as JSON, then print and die.
|
||||||
|
*/
|
||||||
|
public function send_json_error( $data = null ) {
|
||||||
|
$log = trim( ob_get_clean() );
|
||||||
|
|
||||||
|
if ( $log ) {
|
||||||
|
$data .= sprintf( '%s', PHP_EOL . $log );
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_send_json_error( $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a JSON response back to an Ajax request, indicating success.
|
||||||
|
*
|
||||||
|
* @param mixed $data Data to encode as JSON, then print and die.
|
||||||
|
*/
|
||||||
|
public function send_json_success( $data = null ) {
|
||||||
|
$log = trim( ob_get_clean() );
|
||||||
|
|
||||||
|
if ( $log ) {
|
||||||
|
$data .= sprintf( '%s', PHP_EOL . $log );
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_send_json_success( $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX callback to install and activate a plugin.
|
||||||
|
*/
|
||||||
|
public function ajax_import_plugin() {
|
||||||
|
|
||||||
|
set_time_limit( 0 );
|
||||||
|
|
||||||
|
$this->ajax_import_start();
|
||||||
|
|
||||||
|
check_ajax_referer( 'nonce', 'nonce' );
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['plugin_slug'] ) || ! sanitize_text_field( $_POST['plugin_slug'] ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'Unknown slug in a plugin.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['plugin_path'] ) || ! sanitize_text_field( $_POST['plugin_path'] ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'Unknown path in a plugin.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugin_slug = sanitize_text_field( $_POST['plugin_slug'] );
|
||||||
|
$plugin_path = sanitize_text_field( $_POST['plugin_path'] );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'Insufficient permissions to install the plugin.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'not_installed' === $this->get_plugin_status( $plugin_path ) ) {
|
||||||
|
|
||||||
|
$this->install_plugin( $plugin_slug );
|
||||||
|
|
||||||
|
$this->activate_plugin( $plugin_path );
|
||||||
|
|
||||||
|
} elseif ( 'inactive' === $this->get_plugin_status( $plugin_path ) ) {
|
||||||
|
|
||||||
|
$this->activate_plugin( $plugin_path );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'active' === $this->get_plugin_status( $plugin_path ) ) {
|
||||||
|
$this->send_json_success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_import_plugin hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_import_plugin', $plugin_slug, $plugin_path );
|
||||||
|
|
||||||
|
$this->send_json_error( esc_html__( 'Failed to initialize or activate importer plugin.', 'revision' ) );
|
||||||
|
|
||||||
|
$this->ajax_import_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX callback to import contents and media files from contents.xml.
|
||||||
|
*/
|
||||||
|
public function ajax_import_contents() {
|
||||||
|
|
||||||
|
$this->ajax_import_start();
|
||||||
|
|
||||||
|
check_ajax_referer( 'nonce', 'nonce' );
|
||||||
|
|
||||||
|
$import_type = 'default';
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['url'] ) || ! sanitize_text_field( $_POST['url'] ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'The url address of the demo content is not specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $_POST['type'] ) && sanitize_text_field( $_POST['type'] ) ) {
|
||||||
|
$import_type = sanitize_text_field( $_POST['type'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_url = sanitize_text_field( $_POST['url'] );
|
||||||
|
|
||||||
|
$xml_file_hash_id = 'csco_importer_data_' . md5( $file_url );
|
||||||
|
|
||||||
|
$xml_file_path = get_transient( $xml_file_hash_id );
|
||||||
|
|
||||||
|
if ( ! $xml_file_path ) {
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'You are not permitted to import contents.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $file_url ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'No XML file specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download contents.xml
|
||||||
|
*/
|
||||||
|
if ( ! function_exists( 'download_url' ) ) {
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = wp_unslash( $file_url );
|
||||||
|
$timeout_seconds = 5;
|
||||||
|
|
||||||
|
add_filter( 'https_ssl_verify', '__return_false' );
|
||||||
|
|
||||||
|
// Download file to temp dir.
|
||||||
|
$temp_file = download_url( $url, $timeout_seconds );
|
||||||
|
|
||||||
|
add_filter( 'https_local_ssl_verify', '__return_false' );
|
||||||
|
|
||||||
|
if ( is_wp_error( $temp_file ) ) {
|
||||||
|
$this->send_json_error( $temp_file->get_error_message() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array based on $_FILE as seen in PHP file uploads.
|
||||||
|
$file_args = array(
|
||||||
|
'name' => basename( $url ),
|
||||||
|
'tmp_name' => $temp_file,
|
||||||
|
'error' => 0,
|
||||||
|
'size' => filesize( $temp_file ),
|
||||||
|
);
|
||||||
|
|
||||||
|
$overrides = array(
|
||||||
|
// This tells WordPress to not look for the POST form
|
||||||
|
// fields that would normally be present. Default is true.
|
||||||
|
// Since the file is being downloaded from a remote server,
|
||||||
|
// there will be no form fields.
|
||||||
|
'test_form' => false,
|
||||||
|
|
||||||
|
// Setting this to false lets WordPress allow empty files – not recommended.
|
||||||
|
'test_size' => true,
|
||||||
|
|
||||||
|
// A properly uploaded file will pass this test.
|
||||||
|
// There should be no reason to override this one.
|
||||||
|
'test_upload' => true,
|
||||||
|
|
||||||
|
'mimes' => array(
|
||||||
|
'xml' => 'text/xml',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Move the temporary file into the uploads directory.
|
||||||
|
$download_response = wp_handle_sideload( $file_args, $overrides );
|
||||||
|
|
||||||
|
// Error when downloading XML file.
|
||||||
|
if ( isset( $download_response['error'] ) ) {
|
||||||
|
$this->send_json_error( $download_response['error'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the downloaded contents.xml file path.
|
||||||
|
$xml_file_path = $download_response['file'];
|
||||||
|
|
||||||
|
set_transient( $xml_file_hash_id, $xml_file_path, HOUR_IN_SECONDS );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import content and media files using WXR Importer.
|
||||||
|
*/
|
||||||
|
if ( ! class_exists( 'WP_Importer' ) ) {
|
||||||
|
if ( ! defined( 'WP_LOAD_IMPORTERS' ) ) {
|
||||||
|
define( 'WP_LOAD_IMPORTERS', true );
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/class-wp-importer.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Core.
|
||||||
|
*/
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/wp-content-importer-v2/WPImporterLogger.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/wp-content-importer-v2/WPImporterLoggerCLI.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/wp-content-importer-v2/WXRImportInfo.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/wp-content-importer-v2/WXRImporter.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/import/wp-content-importer-v2/Logger.php' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare the importer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Time to run the import!
|
||||||
|
set_time_limit( 0 );
|
||||||
|
|
||||||
|
$this->microtime = microtime( true );
|
||||||
|
|
||||||
|
// Are we allowed to create users?
|
||||||
|
add_filter( 'wxr_importer.pre_process.user', '__return_null' );
|
||||||
|
|
||||||
|
// Check, if we need to send another AJAX request and set the importing author to the current user.
|
||||||
|
add_filter( 'wxr_importer.pre_process.post', array( $this, 'ajax_request_maybe' ) );
|
||||||
|
|
||||||
|
// Set the WordPress Importer v2 as the importer used in this plugin.
|
||||||
|
// More: https://github.com/humanmade/WordPress-Importer.
|
||||||
|
$importer = new CSCO_WXRImporter( array(
|
||||||
|
'fetch_attachments' => true,
|
||||||
|
'default_author' => get_current_user_id(),
|
||||||
|
) );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger options for the logger used in the importer.
|
||||||
|
*
|
||||||
|
* The csco_logger_options hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$logger_options = apply_filters( 'csco_logger_options', array(
|
||||||
|
'logger_min_level' => 'warning',
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Configure logger instance and set it to the importer.
|
||||||
|
$logger = new CSCO_Logger();
|
||||||
|
$logger->min_level = $logger_options['logger_min_level'];
|
||||||
|
|
||||||
|
// Set logger.
|
||||||
|
$importer->set_logger( $logger );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process import.
|
||||||
|
*/
|
||||||
|
$importer->import( $xml_file_path );
|
||||||
|
|
||||||
|
// Is error ?.
|
||||||
|
if ( is_wp_error( $importer ) ) {
|
||||||
|
$this->send_json_error( $importer->get_error_message() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $logger->error_output ) {
|
||||||
|
$this->send_json_error( $logger->error_output );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_import_contents hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_import_contents' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return successful AJAX.
|
||||||
|
*/
|
||||||
|
$this->send_json_success();
|
||||||
|
|
||||||
|
$this->ajax_import_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if we need to create a new AJAX request, so that server does not timeout.
|
||||||
|
*
|
||||||
|
* @param array $data current post data.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function ajax_request_maybe( $data ) {
|
||||||
|
|
||||||
|
$time = microtime( true ) - $this->microtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We should make a new ajax call, if the time is right.
|
||||||
|
*
|
||||||
|
* The csco_time_for_one_ajax_call hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
if ( $time > apply_filters( 'csco_time_for_one_ajax_call', 22 ) ) {
|
||||||
|
$response = array(
|
||||||
|
'success' => true,
|
||||||
|
'status' => 'newAJAX',
|
||||||
|
'message' => 'Time for new AJAX request!: ' . $time,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Send the request for a new AJAX call.
|
||||||
|
wp_send_json( $response );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set importing author to the current user.
|
||||||
|
// Fixes the [WARNING] Could not find the author for ... log warning messages.
|
||||||
|
$current_user_obj = wp_get_current_user();
|
||||||
|
|
||||||
|
$data['post_author'] = $current_user_obj->user_login;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX callback to import customizer settings from customizer.json.
|
||||||
|
*/
|
||||||
|
public function ajax_import_customizer() {
|
||||||
|
|
||||||
|
set_time_limit( 0 );
|
||||||
|
|
||||||
|
$this->ajax_import_start();
|
||||||
|
|
||||||
|
check_ajax_referer( 'nonce', 'nonce' );
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['url'] ) || ! sanitize_text_field( $_POST['url'] ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'The url address of the demo content is not specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_url = sanitize_text_field( $_POST['url'] );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'You are not permitted to import customizer.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $file_url ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'No customizer JSON file specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process customizer.json.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Get JSON data from customizer.json.
|
||||||
|
$raw = wp_remote_get( wp_unslash( $file_url ), array(
|
||||||
|
'sslverify' => false,
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Abort if customizer.json response code is not successful.
|
||||||
|
if ( 200 !== wp_remote_retrieve_response_code( $raw ) ) {
|
||||||
|
$this->send_json_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode raw JSON string to associative array.
|
||||||
|
$data = json_decode( wp_remote_retrieve_body( $raw ), true );
|
||||||
|
|
||||||
|
$customizer = new CSCO_Customizer_Importer();
|
||||||
|
|
||||||
|
// Import.
|
||||||
|
$results = $customizer->import( $data );
|
||||||
|
|
||||||
|
if ( is_wp_error( $results ) ) {
|
||||||
|
$error_message = $results->get_error_message();
|
||||||
|
|
||||||
|
$this->send_json_error( $error_message );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_import_customizer hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_import_customizer', $data );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return successful AJAX.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->send_json_success();
|
||||||
|
|
||||||
|
$this->ajax_import_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX callback to import widgets on all sidebars from widgets.json.
|
||||||
|
*/
|
||||||
|
public function ajax_import_widgets() {
|
||||||
|
|
||||||
|
set_time_limit( 0 );
|
||||||
|
|
||||||
|
$this->ajax_import_start();
|
||||||
|
|
||||||
|
check_ajax_referer( 'nonce', 'nonce' );
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['url'] ) || ! sanitize_text_field( $_POST['url'] ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'The url address of the demo content is not specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_url = sanitize_text_field( $_POST['url'] );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'You are not permitted to import widgets.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $file_url ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'No widgets WIE file specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process widgets.json.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Get JSON data from widgets.json.
|
||||||
|
$raw = wp_remote_get( wp_unslash( $file_url ), array(
|
||||||
|
'sslverify' => false,
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Abort if customizer.json response code is not successful.
|
||||||
|
if ( 200 !== (int) wp_remote_retrieve_response_code( $raw ) ) {
|
||||||
|
$this->send_json_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode raw JSON string to associative array.
|
||||||
|
$data = json_decode( wp_remote_retrieve_body( $raw ) );
|
||||||
|
|
||||||
|
$widgets = new CSCO_Widget_Importer();
|
||||||
|
|
||||||
|
// Import.
|
||||||
|
$results = $widgets->import( $data );
|
||||||
|
|
||||||
|
if ( is_wp_error( $results ) ) {
|
||||||
|
$error_message = $results->get_error_message();
|
||||||
|
|
||||||
|
$this->send_json_error( $error_message );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_import_widgets hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_import_widgets' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return successful AJAX.
|
||||||
|
*/
|
||||||
|
$this->send_json_success();
|
||||||
|
|
||||||
|
$this->ajax_import_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX callback to import other options from options.json.
|
||||||
|
*/
|
||||||
|
public function ajax_import_options() {
|
||||||
|
|
||||||
|
set_time_limit( 0 );
|
||||||
|
|
||||||
|
$this->ajax_import_start();
|
||||||
|
|
||||||
|
check_ajax_referer( 'nonce', 'nonce' );
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['url'] ) || ! sanitize_text_field( $_POST['url'] ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'The url address of the demo content is not specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_url = sanitize_text_field( $_POST['url'] );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'You are not permitted to import options.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $file_url ) ) {
|
||||||
|
$this->send_json_error( esc_html__( 'No options JSON file specified.', 'revision' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process options.json.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Get JSON data from options.json.
|
||||||
|
$raw = wp_remote_get( wp_unslash( $file_url ), array(
|
||||||
|
'sslverify' => false,
|
||||||
|
) );
|
||||||
|
|
||||||
|
// Abort if customizer.json response code is not successful.
|
||||||
|
if ( 200 !== (int) wp_remote_retrieve_response_code( $raw ) ) {
|
||||||
|
$this->send_json_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode raw JSON string to associative array.
|
||||||
|
$array = json_decode( wp_remote_retrieve_body( $raw ), true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import options to DB.
|
||||||
|
*/
|
||||||
|
foreach ( $array as $key => $value ) {
|
||||||
|
// Skip option key with "__" prefix, because it will be treated specifically via the action hook.
|
||||||
|
if ( '__' === substr( $key, 0, 2 ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert to options table.
|
||||||
|
update_option( $key, $value );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_import_options hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_import_options', $array );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return successful AJAX.
|
||||||
|
*/
|
||||||
|
$this->send_json_success();
|
||||||
|
|
||||||
|
$this->ajax_import_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AJAX callback to finish import.
|
||||||
|
*/
|
||||||
|
public function ajax_import_finish() {
|
||||||
|
|
||||||
|
set_time_limit( 0 );
|
||||||
|
|
||||||
|
$this->ajax_import_start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_finish_import hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_finish_import' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return successful AJAX.
|
||||||
|
*/
|
||||||
|
$this->send_json_success();
|
||||||
|
|
||||||
|
$this->ajax_import_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new CSCO_Manager_Import();
|
||||||
317
core/theme-demos/import/class-widget-importer.php
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Class for the widget importer.
|
||||||
|
*
|
||||||
|
* Code is mostly from the Widget Importer & Exporter plugin.
|
||||||
|
*
|
||||||
|
* @see https://wordpress.org/plugins/widget-importer-exporter/
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Widget Importer
|
||||||
|
*/
|
||||||
|
class CSCO_Widget_Importer {
|
||||||
|
/**
|
||||||
|
* Import widgets from WIE or JSON file.
|
||||||
|
*
|
||||||
|
* @param array $data The data.
|
||||||
|
*/
|
||||||
|
public static function import( $data ) {
|
||||||
|
// Import widgets and return result.
|
||||||
|
return self::import_data( $data );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import widget JSON data
|
||||||
|
*
|
||||||
|
* @global array $wp_registered_sidebars
|
||||||
|
* @param object $data JSON widget data.
|
||||||
|
* @return array $results
|
||||||
|
*/
|
||||||
|
private static function import_data( $data ) {
|
||||||
|
global $wp_registered_sidebars;
|
||||||
|
|
||||||
|
// Have valid data? If no data or could not decode.
|
||||||
|
if ( empty( $data ) || ! is_object( $data ) ) {
|
||||||
|
return new WP_Error(
|
||||||
|
'corrupted_widget_import_data',
|
||||||
|
__( 'Error: Widget import data could not be read. Please try a different file.', 'revision' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook before import.
|
||||||
|
*
|
||||||
|
* The csco_widget_importer_before_widgets_import hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_widget_importer_before_widgets_import' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_before_widgets_import_data hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$data = apply_filters( 'csco_before_widgets_import_data', $data );
|
||||||
|
|
||||||
|
// Get all available widgets site supports.
|
||||||
|
$available_widgets = self::available_widgets();
|
||||||
|
|
||||||
|
// Get all existing widget instances.
|
||||||
|
$widget_instances = array();
|
||||||
|
|
||||||
|
foreach ( $available_widgets as $widget_data ) {
|
||||||
|
$widget_instances[ $widget_data['id_base'] ] = get_option( 'widget_' . $widget_data['id_base'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Begin results.
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
// Loop import data's sidebars.
|
||||||
|
foreach ( $data as $sidebar_id => $widgets ) {
|
||||||
|
// Skip inactive widgets (should not be in export file).
|
||||||
|
if ( 'wp_inactive_widgets' === $sidebar_id ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if sidebar is available on this site. Otherwise add widgets to inactive, and say so.
|
||||||
|
if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
|
||||||
|
$sidebar_available = true;
|
||||||
|
$use_sidebar_id = $sidebar_id;
|
||||||
|
$sidebar_message_type = 'success';
|
||||||
|
$sidebar_message = '';
|
||||||
|
} else {
|
||||||
|
$sidebar_available = false;
|
||||||
|
$use_sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
|
||||||
|
$sidebar_message_type = 'error';
|
||||||
|
$sidebar_message = __( 'Sidebar does not exist in theme (moving widget to Inactive)', 'revision' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Result for sidebar.
|
||||||
|
$results[ $sidebar_id ]['name'] = ! empty( $wp_registered_sidebars[ $sidebar_id ]['name'] ) ? $wp_registered_sidebars[ $sidebar_id ]['name'] : $sidebar_id; // Sidebar name if theme supports it; otherwise ID.
|
||||||
|
$results[ $sidebar_id ]['message_type'] = $sidebar_message_type;
|
||||||
|
$results[ $sidebar_id ]['message'] = $sidebar_message;
|
||||||
|
$results[ $sidebar_id ]['widgets'] = array();
|
||||||
|
|
||||||
|
// Loop widgets.
|
||||||
|
foreach ( $widgets as $widget_instance_id => $widget ) {
|
||||||
|
$fail = false;
|
||||||
|
|
||||||
|
// Get id_base (remove -# from end) and instance ID number.
|
||||||
|
$id_base = preg_replace( '/-[0-9]+$/', '', $widget_instance_id );
|
||||||
|
$instance_id_number = str_replace( $id_base . '-', '', $widget_instance_id );
|
||||||
|
|
||||||
|
// Does site support this widget?
|
||||||
|
if ( ! $fail && ! isset( $available_widgets[ $id_base ] ) ) {
|
||||||
|
$fail = true;
|
||||||
|
$widget_message_type = 'error';
|
||||||
|
$widget_message = __( 'Site does not support widget', 'revision' ); // Explain why widget not imported.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter to modify settings object before conversion to array and import.
|
||||||
|
// Leave this filter here for backwards compatibility with manipulating objects (before conversion to array below).
|
||||||
|
// Ideally the newer wie_widget_settings_array below will be used instead of this.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter to modify settings object before conversion to array and import.
|
||||||
|
* Leave this filter here for backwards compatibility with manipulating objects (before conversion to array below).
|
||||||
|
* Ideally the newer wie_widget_settings_array below will be used instead of this.
|
||||||
|
*
|
||||||
|
* The csco_widget_settings hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$widget = apply_filters( 'csco_widget_settings', $widget ); // Object.
|
||||||
|
|
||||||
|
// Convert multidimensional objects to multidimensional arrays.
|
||||||
|
// Some plugins like Jetpack Widget Visibility store settings as multidimensional arrays.
|
||||||
|
// Without this, they are imported as objects and cause fatal error on Widgets page.
|
||||||
|
// If this creates problems for plugins that do actually intend settings in objects then may need to consider other approach: https://wordpress.org/support/topic/problem-with-array-of-arrays.
|
||||||
|
// It is probably much more likely that arrays are used than objects, however.
|
||||||
|
$widget = json_decode( json_encode( $widget ), true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter to modify settings array.
|
||||||
|
* This is preferred over the older wie_widget_settings filter above.
|
||||||
|
* Do before identical check because changes may make it identical to end result (such as URL replacements).
|
||||||
|
*
|
||||||
|
* The csco_widget_settings_array hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
$widget = apply_filters( 'csco_widget_settings_array', $widget );
|
||||||
|
|
||||||
|
// Does widget with identical settings already exist in same sidebar?
|
||||||
|
if ( ! $fail && isset( $widget_instances[ $id_base ] ) ) {
|
||||||
|
// Get existing widgets in this sidebar.
|
||||||
|
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
||||||
|
$sidebar_widgets = isset( $sidebars_widgets[ $use_sidebar_id ] ) ? $sidebars_widgets[ $use_sidebar_id ] : array(); // Check Inactive if that's where will go.
|
||||||
|
|
||||||
|
// Loop widgets with ID base.
|
||||||
|
$single_widget_instances = ! empty( $widget_instances[ $id_base ] ) ? $widget_instances[ $id_base ] : array();
|
||||||
|
foreach ( $single_widget_instances as $check_id => $check_widget ) {
|
||||||
|
// Is widget in same sidebar and has identical settings?
|
||||||
|
if ( in_array( "$id_base-$check_id", $sidebar_widgets ) && (array) $widget == $check_widget ) {
|
||||||
|
$fail = true;
|
||||||
|
$widget_message_type = 'warning';
|
||||||
|
$widget_message = __( 'Widget already exists', 'revision' ); // Explain why widget not imported.
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No failure.
|
||||||
|
if ( ! $fail ) {
|
||||||
|
// Add widget instance.
|
||||||
|
$single_widget_instances = get_option( 'widget_' . $id_base ); // All instances for that widget ID base, get fresh every time.
|
||||||
|
$single_widget_instances = ! empty( $single_widget_instances ) ? $single_widget_instances : array( '_multiwidget' => 1 ); // Start fresh if have to.
|
||||||
|
$single_widget_instances[] = $widget; // Add it.
|
||||||
|
|
||||||
|
// Get the key it was given.
|
||||||
|
end( $single_widget_instances );
|
||||||
|
$new_instance_id_number = key( $single_widget_instances );
|
||||||
|
|
||||||
|
// If key is 0, make it 1.
|
||||||
|
// When 0, an issue can occur where adding a widget causes data from other widget to load, and the widget doesn't stick (reload wipes it).
|
||||||
|
if ( '0' === strval( $new_instance_id_number ) ) {
|
||||||
|
$new_instance_id_number = 1;
|
||||||
|
$single_widget_instances[ $new_instance_id_number ] = $single_widget_instances[0];
|
||||||
|
unset( $single_widget_instances[0] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move _multiwidget to end of array for uniformity.
|
||||||
|
if ( isset( $single_widget_instances['_multiwidget'] ) ) {
|
||||||
|
$multiwidget = $single_widget_instances['_multiwidget'];
|
||||||
|
unset( $single_widget_instances['_multiwidget'] );
|
||||||
|
$single_widget_instances['_multiwidget'] = $multiwidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update option with new widget.
|
||||||
|
update_option( 'widget_' . $id_base, $single_widget_instances );
|
||||||
|
|
||||||
|
// Assign widget instance to sidebar.
|
||||||
|
$sidebars_widgets = get_option( 'sidebars_widgets' ); // Which sidebars have which widgets, get fresh every time.
|
||||||
|
|
||||||
|
// Avoid rarely fatal error when the option is an empty string
|
||||||
|
// https://github.com/churchthemes/widget-importer-exporter/pull/11.
|
||||||
|
if ( ! $sidebars_widgets ) {
|
||||||
|
$sidebars_widgets = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_instance_id = $id_base . '-' . $new_instance_id_number; // Use ID number from new widget instance.
|
||||||
|
|
||||||
|
$sidebars_widgets[ $use_sidebar_id ][] = $new_instance_id; // Add new instance to sidebar.
|
||||||
|
update_option( 'sidebars_widgets', $sidebars_widgets ); // Save the amended data.
|
||||||
|
|
||||||
|
// After widget import action.
|
||||||
|
$after_widget_import = array(
|
||||||
|
'sidebar' => $use_sidebar_id,
|
||||||
|
'sidebar_old' => $sidebar_id,
|
||||||
|
'widget' => $widget,
|
||||||
|
'widget_type' => $id_base,
|
||||||
|
'widget_id' => $new_instance_id,
|
||||||
|
'widget_id_old' => $widget_instance_id,
|
||||||
|
'widget_id_num' => $new_instance_id_number,
|
||||||
|
'widget_id_num_old' => $instance_id_number,
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_widget_importer_after_single_widget_import hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_widget_importer_after_single_widget_import', $after_widget_import );
|
||||||
|
|
||||||
|
// Success message.
|
||||||
|
if ( $sidebar_available ) {
|
||||||
|
$widget_message_type = 'success';
|
||||||
|
$widget_message = __( 'Imported', 'revision' );
|
||||||
|
} else {
|
||||||
|
$widget_message_type = 'warning';
|
||||||
|
$widget_message = __( 'Imported to Inactive', 'revision' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Result for widget instance.
|
||||||
|
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base; // Widget name or ID if name not available (not supported by site).
|
||||||
|
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : __( 'No Title', 'revision' ); // Show "No Title" if widget instance is untitled.
|
||||||
|
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message_type'] = $widget_message_type;
|
||||||
|
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message'] = $widget_message;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook after import.
|
||||||
|
*
|
||||||
|
* The csco_widget_importer_after_widgets_import hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_widget_importer_after_widgets_import' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return results.
|
||||||
|
*
|
||||||
|
* The csco_widget_import_results hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
return apply_filters( 'csco_widget_import_results', $results );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Available widgets.
|
||||||
|
*
|
||||||
|
* Gather site's widgets into array with ID base, name, etc.
|
||||||
|
*
|
||||||
|
* @global array $wp_registered_widget_controls
|
||||||
|
* @return array $available_widgets, Widget information
|
||||||
|
*/
|
||||||
|
private static function available_widgets() {
|
||||||
|
global $wp_registered_widget_controls;
|
||||||
|
|
||||||
|
$widget_controls = $wp_registered_widget_controls;
|
||||||
|
$available_widgets = array();
|
||||||
|
|
||||||
|
foreach ( $widget_controls as $widget ) {
|
||||||
|
if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] ) ) {
|
||||||
|
$available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
|
||||||
|
$available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The csco_available_widgets hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
return apply_filters( 'csco_available_widgets', $available_widgets );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format results for log file
|
||||||
|
*
|
||||||
|
* @param array $results widget import results.
|
||||||
|
*/
|
||||||
|
private static function format_results_for_log( $results ) {
|
||||||
|
if ( empty( $results ) ) {
|
||||||
|
esc_html_e( 'No results for widget import!', 'revision' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop sidebars.
|
||||||
|
foreach ( $results as $sidebar ) {
|
||||||
|
echo esc_html( $sidebar['name'] ) . ' : ' . esc_html( $sidebar['message'] ) . PHP_EOL . PHP_EOL;
|
||||||
|
// Loop widgets.
|
||||||
|
foreach ( $sidebar['widgets'] as $widget ) {
|
||||||
|
echo esc_html( $widget['name'] ) . ' - ' . esc_html( $widget['title'] ) . ' - ' . esc_html( $widget['message'] ) . PHP_EOL;
|
||||||
|
}
|
||||||
|
echo PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
core/theme-demos/import/wp-content-importer-v2/Logger.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Logger Class
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger Class
|
||||||
|
*/
|
||||||
|
class CSCO_Logger extends CSCO_WPImporterLoggerCLI {
|
||||||
|
/**
|
||||||
|
* Variable for front-end error display.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $error_output = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwritten log function from CSCO_WP_Importer_Logger_CLI.
|
||||||
|
*
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level level of reporting.
|
||||||
|
* @param string $message log message.
|
||||||
|
* @param array $context context to the log message.
|
||||||
|
*/
|
||||||
|
public function log( $level, $message, array $context = array() ) {
|
||||||
|
// Save error messages for front-end display.
|
||||||
|
$this->error_output( $level, $message, $context = array() );
|
||||||
|
|
||||||
|
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( $this->min_level ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save messages for error output.
|
||||||
|
* Only the messages greater then Error.
|
||||||
|
*
|
||||||
|
* @param mixed $level level of reporting.
|
||||||
|
* @param string $message log message.
|
||||||
|
* @param array $context context to the log message.
|
||||||
|
*/
|
||||||
|
public function error_output( $level, $message, array $context = array() ) {
|
||||||
|
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( 'error' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->error_output .= sprintf( '[%s] %s<br>', strtoupper( $level ), $message );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Describes a logger instance
|
||||||
|
*
|
||||||
|
* Based on PSR-3: http://www.php-fig.org/psr/psr-3/
|
||||||
|
*
|
||||||
|
* The message MUST be a string or object implementing __toString().
|
||||||
|
*
|
||||||
|
* The message MAY contain placeholders in the form: {foo} where foo
|
||||||
|
* will be replaced by the context data in key "foo".
|
||||||
|
*
|
||||||
|
* The context array can contain arbitrary data, the only assumption that
|
||||||
|
* can be made by implementors is that if an Exception instance is given
|
||||||
|
* to produce a stack trace, it MUST be in a key named "exception".
|
||||||
|
*
|
||||||
|
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
||||||
|
* for the full interface specification.
|
||||||
|
*/
|
||||||
|
class CSCO_WPImporterLogger {
|
||||||
|
/**
|
||||||
|
* System is unusable.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function emergency( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'emergency', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action must be taken immediately.
|
||||||
|
*
|
||||||
|
* Example: Entire website down, database unavailable, etc. This should
|
||||||
|
* trigger the SMS alerts and wake you up.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function alert( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'alert', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Critical conditions.
|
||||||
|
*
|
||||||
|
* Example: Application component unavailable, unexpected exception.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function critical( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'critical', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime errors that do not require immediate action but should typically
|
||||||
|
* be logged and monitored.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function error( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'error', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional occurrences that are not errors.
|
||||||
|
*
|
||||||
|
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||||
|
* that are not necessarily wrong.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function warning( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'warning', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normal but significant events.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function notice( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'notice', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interesting events.
|
||||||
|
*
|
||||||
|
* Example: User logs in, SQL logs.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function info( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'info', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detailed debug information.
|
||||||
|
*
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function debug( $message, array $context = array() ) {
|
||||||
|
return $this->log( 'debug', $message, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level The level.
|
||||||
|
* @param string $message The message.
|
||||||
|
* @param array $context The context.
|
||||||
|
*/
|
||||||
|
public function log( $level, $message, array $context = array() ) {
|
||||||
|
$this->messages[] = array(
|
||||||
|
'timestamp' => time(),
|
||||||
|
'level' => $level,
|
||||||
|
'message' => $message,
|
||||||
|
'context' => $context,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WP Importer Logger CLI Class
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WP Importer Logger CLI Class
|
||||||
|
*/
|
||||||
|
class CSCO_WPImporterLoggerCLI extends CSCO_WPImporterLogger {
|
||||||
|
public $min_level = 'notice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level
|
||||||
|
* @param string $message
|
||||||
|
* @param array $context
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function log( $level, $message, array $context = array() ) {
|
||||||
|
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( $this->min_level ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
call_user_func( 'printf', '[%s] %s' . PHP_EOL, strtoupper( $level ), $message );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function level_to_numeric( $level ) {
|
||||||
|
$levels = array(
|
||||||
|
'emergency' => 8,
|
||||||
|
'alert' => 7,
|
||||||
|
'critical' => 6,
|
||||||
|
'error' => 5,
|
||||||
|
'warning' => 4,
|
||||||
|
'notice' => 3,
|
||||||
|
'info' => 2,
|
||||||
|
'debug' => 1,
|
||||||
|
);
|
||||||
|
if ( ! isset( $levels[ $level ] ) ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $levels[ $level ];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WP Importer Info Class
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WP Importer Info Class
|
||||||
|
*/
|
||||||
|
class CSCO_WXRImportInfo {
|
||||||
|
public $home;
|
||||||
|
public $siteurl;
|
||||||
|
public $title;
|
||||||
|
public $users = array();
|
||||||
|
public $post_count = 0;
|
||||||
|
public $media_count = 0;
|
||||||
|
public $comment_count = 0;
|
||||||
|
public $term_count = 0;
|
||||||
|
public $generator = '';
|
||||||
|
public $version;
|
||||||
|
}
|
||||||
2571
core/theme-demos/import/wp-content-importer-v2/WXRImporter.php
Normal file
101
footer.php
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The template for displaying the footer
|
||||||
|
*
|
||||||
|
* Contains the closing of the "cs-site" div and all content after
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_content_end hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_content_end' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_content_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_content_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_content_end hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_content_end' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_content_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_content_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_footer_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_footer_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php get_template_part( 'template-parts/footer' ); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_footer_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_footer_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_end hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_end' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php wp_footer(); ?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
163
functions.php
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Revision functions and definitions
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/themes/basics/theme-functions/
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'Revision' ) ) {
|
||||||
|
/**
|
||||||
|
* Main Core Class
|
||||||
|
*/
|
||||||
|
class Revision {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __construct
|
||||||
|
*
|
||||||
|
* This function will initialize the initialize
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->init();
|
||||||
|
$this->theme_files();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init
|
||||||
|
*/
|
||||||
|
public function init() {
|
||||||
|
add_action( 'after_setup_theme', array( $this, 'theme_setup' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Theme support
|
||||||
|
*/
|
||||||
|
public function theme_support() {
|
||||||
|
add_theme_support( 'wp-block-styles' );
|
||||||
|
add_theme_support( 'custom-logo' );
|
||||||
|
add_theme_support( 'custom-header' );
|
||||||
|
add_theme_support( 'custom-background' );
|
||||||
|
register_block_pattern();
|
||||||
|
add_editor_style();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up theme defaults and registers support for various WordPress features.
|
||||||
|
*
|
||||||
|
* Note that this function is hooked into the after_setup_theme hook, which
|
||||||
|
* runs before the init hook. The init hook is too late for some features, such
|
||||||
|
* as indicating support for post thumbnails.
|
||||||
|
*/
|
||||||
|
public function theme_setup() {
|
||||||
|
/*
|
||||||
|
* Make theme available for translation.
|
||||||
|
* Translations can be filed in the /languages/ directory.
|
||||||
|
* If you're building a theme based on Revision, use a find and replace
|
||||||
|
* to change 'revision' to the name of your theme in all the template files.
|
||||||
|
*/
|
||||||
|
load_theme_textdomain( 'revision', get_template_directory() . '/languages' );
|
||||||
|
|
||||||
|
// Add default posts and comments RSS feed links to head.
|
||||||
|
add_theme_support( 'automatic-feed-links' );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Let WordPress manage the document title.
|
||||||
|
* By adding theme support, we declare that this theme does not use a
|
||||||
|
* hard-coded <title> tag in the document head, and expect WordPress to
|
||||||
|
* provide it for us.
|
||||||
|
*/
|
||||||
|
add_theme_support( 'title-tag' );
|
||||||
|
|
||||||
|
// This theme uses wp_nav_menu() in one location.
|
||||||
|
register_nav_menus(
|
||||||
|
array(
|
||||||
|
'primary' => esc_html__( 'Primary', 'revision' ),
|
||||||
|
'mobile' => esc_html__( 'Mobile', 'revision' ),
|
||||||
|
'footer' => esc_html__( 'Footer', 'revision' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Switch default core markup for search form, comment form, comments, etc.
|
||||||
|
* to output valid HTML5.
|
||||||
|
*/
|
||||||
|
add_theme_support(
|
||||||
|
'html5',
|
||||||
|
array(
|
||||||
|
'search-form',
|
||||||
|
'comment-form',
|
||||||
|
'comment-list',
|
||||||
|
'gallery',
|
||||||
|
'caption',
|
||||||
|
'script',
|
||||||
|
'style',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add support for responsive embeds.
|
||||||
|
add_theme_support( 'responsive-embeds' );
|
||||||
|
|
||||||
|
// Supported Formats.
|
||||||
|
add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio' ) );
|
||||||
|
|
||||||
|
// Add theme support for selective refresh for widgets.
|
||||||
|
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||||
|
|
||||||
|
// Add support for full and wide align images.
|
||||||
|
add_theme_support( 'align-wide' );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable support for Post Thumbnails on posts and pages.
|
||||||
|
*
|
||||||
|
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
|
||||||
|
*/
|
||||||
|
add_theme_support( 'post-thumbnails' );
|
||||||
|
|
||||||
|
// Register custom thumbnail sizes.
|
||||||
|
add_image_size( 'csco-thumbnail', 400, 225, true );
|
||||||
|
add_image_size( 'csco-thumbnail-2x', 800, 450, true );
|
||||||
|
add_image_size( 'csco-thumbnail-uncropped', 400, 0, false );
|
||||||
|
add_image_size( 'csco-thumbnail-uncropped-2x', 800, 0, false );
|
||||||
|
|
||||||
|
add_image_size( 'csco-medium', 832, 468, true );
|
||||||
|
add_image_size( 'csco-medium-2x', 1664, 936, true );
|
||||||
|
add_image_size( 'csco-medium-uncropped', 832, 0, false );
|
||||||
|
add_image_size( 'csco-medium-uncropped-2x', 1664, 0, false );
|
||||||
|
|
||||||
|
add_image_size( 'csco-large', 1248, 702, true );
|
||||||
|
add_image_size( 'csco-large-2x', 2496, 1404, true );
|
||||||
|
add_image_size( 'csco-large-uncropped', 1248, 0, true );
|
||||||
|
add_image_size( 'csco-large-uncropped-2x', 2496, 0, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include theme files
|
||||||
|
*/
|
||||||
|
public function theme_files() {
|
||||||
|
require_once get_theme_file_path( '/inc/deprecated.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/theme-setup.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-dashboard/class-theme-dashboard.php' );
|
||||||
|
require_once get_theme_file_path( '/core/theme-demos/class-theme-demos.php' );
|
||||||
|
require_once get_theme_file_path( '/core/customizer/class-customizer.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/assets.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/widgets-init.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/theme-functions.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/theme-demos.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/theme-mods.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/filters.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/gutenberg.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/actions.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/partials.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/theme-tags.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/post-meta.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/load-more.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/custom-content.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/categories.php' );
|
||||||
|
require_once get_theme_file_path( '/inc/load-nextpost.php' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize.
|
||||||
|
new Revision();
|
||||||
|
}
|
||||||
113
header.php
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The template for displaying the header
|
||||||
|
*
|
||||||
|
* Displays all of the head element and everything up until the "cs-site" div.
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!doctype html>
|
||||||
|
<html <?php language_attributes(); ?>>
|
||||||
|
<head>
|
||||||
|
<meta charset="<?php bloginfo( 'charset' ); ?>" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link rel="profile" href="https://gmpg.org/xfn/11" />
|
||||||
|
|
||||||
|
<?php wp_head(); ?>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body <?php body_class(); ?> <?php csco_site_scheme(); ?>>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( function_exists( 'wp_body_open' ) ) {
|
||||||
|
wp_body_open();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="page" class="cs-site">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_start hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_start' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="cs-site-inner">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_header_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_header_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php get_template_part( 'template-parts/header' ); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_header_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_header_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main id="main" class="cs-site-primary">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_content_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_content_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div <?php csco_site_content_class(); ?>>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_site_content_start hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_site_content_start' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="cs-container">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_content_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_content_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="content" class="cs-main-content">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_content_start hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_content_start' );
|
||||||
|
?>
|
||||||
BIN
import/classic-grid-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 171 KiB |
BIN
import/classic-list-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
import/classic-overlay-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
import/featured-posts-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 154 KiB |
BIN
import/full-grid-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 184 KiB |
BIN
import/full-list-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 121 KiB |
BIN
import/full-overlay-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
import/hero-slider-thumbnail.jpg
Normal file
|
After Width: | Height: | Size: 154 KiB |
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
1181
inc/theme-mods/colors-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
@@ -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
1261
inc/theme-mods/miscellaneous-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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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' );
|
||||||
|
}
|
||||||
118
index.php
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The main template file
|
||||||
|
*
|
||||||
|
* This is the most generic template file in a WordPress theme
|
||||||
|
* and one of the two required files for a theme (the other being style.css).
|
||||||
|
* It is used to display a page when nothing more specific matches a query.
|
||||||
|
* E.g., it puts together the home page when no home.php file exists.
|
||||||
|
*
|
||||||
|
* @link http://codex.wordpress.org/Template_Hierarchy
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
get_header(); ?>
|
||||||
|
|
||||||
|
<div id="primary" class="cs-content-area">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ( have_posts() ) {
|
||||||
|
// Set options.
|
||||||
|
$options = csco_get_archive_options();
|
||||||
|
|
||||||
|
$grid_columns_desktop = $options['columns'];
|
||||||
|
|
||||||
|
$columns_desktop = 'cs-desktop-column-' . $grid_columns_desktop;
|
||||||
|
|
||||||
|
// Location.
|
||||||
|
$main_classes = ' cs-posts-area__' . $options['location'];
|
||||||
|
|
||||||
|
// Layout.
|
||||||
|
$main_classes .= ' cs-posts-area__' . $options['layout'];
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="cs-posts-area cs-posts-area-posts">
|
||||||
|
<div class="cs-posts-area__outer">
|
||||||
|
|
||||||
|
<div class="cs-posts-area__main cs-archive-<?php echo esc_attr( $options['layout'] ); ?> <?php echo esc_attr( $main_classes ); ?> <?php echo ( 'list' === $options['layout'] || 'grid' === $options['layout'] ) ? esc_attr( $columns_desktop ) : ''; ?>">
|
||||||
|
<?php
|
||||||
|
// Start the Loop.
|
||||||
|
while ( have_posts() ) {
|
||||||
|
the_post();
|
||||||
|
|
||||||
|
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' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/* Posts Pagination */
|
||||||
|
if ( 'standard' === get_theme_mod( csco_get_archive_option( 'pagination_type' ), 'standard' ) ) {
|
||||||
|
?>
|
||||||
|
<div class="cs-posts-area__pagination">
|
||||||
|
<?php
|
||||||
|
the_posts_pagination(
|
||||||
|
array(
|
||||||
|
'prev_text' => __( 'Previous', 'revision' ),
|
||||||
|
'next_text' => __( 'Next', 'revision' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
} elseif ( ! get_query_var( 'csco_have_search' ) ) {
|
||||||
|
?>
|
||||||
|
<div class="entry-content cs-content-not-found">
|
||||||
|
|
||||||
|
<?php if ( is_search() ) { ?>
|
||||||
|
<div class="cs-content-not-found-content">
|
||||||
|
<?php esc_html_e( 'It seems we cannot find what you are looking for. Please check the spelling or rephrase.', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
<?php } elseif ( is_404() ) { ?>
|
||||||
|
<div class="cs-content-not-found-content">
|
||||||
|
<?php esc_html_e( 'Unfortunately the page you are looking for is not available.', 'revision' ); ?>
|
||||||
|
</div>
|
||||||
|
<a class="cs-button" href="<?php echo esc_url( home_url() ); ?>"><?php esc_html_e( 'Back to Home', 'revision' ); ?></a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_after' );
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
<?php get_footer(); ?>
|
||||||
2546
languages/revision.pot
Normal file
60
page.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The template for displaying all single pages.
|
||||||
|
*
|
||||||
|
* @package Revision
|
||||||
|
*/
|
||||||
|
|
||||||
|
get_header(); ?>
|
||||||
|
|
||||||
|
<div id="primary" class="cs-content-area">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
while ( have_posts() ) :
|
||||||
|
the_post();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_page_before hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_page_before' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php get_template_part( 'template-parts/content-singular' ); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_page_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_page_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php endwhile; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* The csco_main_after hook.
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
do_action( 'csco_main_after' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php get_sidebar(); ?>
|
||||||
|
<?php get_footer(); ?>
|
||||||
16
readme.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
Theme Name: Revision
|
||||||
|
Theme URI: https://revision.codesupply.co
|
||||||
|
Description: High-Performance WordPress Personal Blog Theme
|
||||||
|
Documentation URI: https://support.codesupply.co/documentation/revision/
|
||||||
|
Author: Code Supply Co.
|
||||||
|
Author URI: https://codesupply.co
|
||||||
|
Version: 1.0.5
|
||||||
|
Tested up to: 6.8
|
||||||
|
Requires at least: 6.0
|
||||||
|
Requires PHP: 7.0
|
||||||
|
Tags: custom-colors, editor-style, theme-options, custom-menu, sticky-post, right-sidebar, translation-ready
|
||||||
|
License: GNU General Public License version 3.0
|
||||||
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
Text Domain: revision
|
||||||
|
*/
|
||||||
BIN
screenshot.jpg
Normal file
|
After Width: | Height: | Size: 66 KiB |