b91cfab6 by Jeff Balicki

more

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 49aeb782
Showing 33 changed files with 1234 additions and 64 deletions
<?php
/**
* Plugin Name: Accordion Blocks
* Plugin URI: https://github.com/philbuchanan/Accordion-Blocks
* Description: Gutenberg blocks for creating responsive accordion drop-downs.
* Version: 1.5.0
* Requires at least: 5.9
* Tested up to: 5.9
* Requires PHP: 7.3
* Author: Phil Buchanan
* Author URI: https://philbuchanan.com
* License: GPLv2 or later
*/
// Make sure to not redeclare the class
if (!class_exists('PB_Accordion_Blocks')) :
class PB_Accordion_Blocks {
/**
* Current plugin version number
* Set from parent plugin file
*/
public $plugin_version;
/**
* Class constructor
* Sets up the plugin, including registering scripts.
*/
function __construct() {
$basename = plugin_basename(__FILE__);
$this->plugin_version = $this->get_plugin_version();
// Register block
add_action('init', array($this, 'register_block'));
// Enqueue frontend assets
add_action('wp_enqueue_scripts', array($this, 'enqueue_frontend_assets'));
// Tell WordPress which JavaScript files contain translations
add_action('init', array($this, 'set_script_translations'));
if (is_admin()) {
// Add link to documentation on plugin page
add_filter("plugin_action_links_$basename", array($this, 'add_documentation_link'));
}
// Register defaults site setting
add_action('rest_api_init', array($this, 'register_settings'));
add_action('admin_init', array($this, 'register_settings'));
// Add API endpoint to get and set settings
add_action('rest_api_init', array($this, 'register_rest_routes'));
// Add settings page
add_action('admin_menu', array($this, 'add_settings_menu'));
add_action('admin_init', array($this, 'settings_api_init'));
}
/**
* Current plugin version number
*/
private function get_plugin_version() {
$plugin_data = get_file_data(__FILE__, array('Version' => 'Version'), false);
return (defined('WP_DEBUG') && WP_DEBUG) ? time() : $plugin_data['Version'];
}
/**
* Register the block's assets for the editor
*/
public function register_block() {
register_block_type(__DIR__);
}
/**
* Enqueue the block's assets for the frontend
*/
public function enqueue_frontend_assets() {
$load_scripts_globally = $this->should_load_scripts_globally();
if ($load_scripts_globally || has_block('pb/accordion-item', get_the_ID())) {
$min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
wp_enqueue_script(
'pb-accordion-blocks-frontend-script',
plugins_url("js/accordion-blocks$min.js", __FILE__),
array('jquery'),
$this->plugin_version,
true
);
wp_enqueue_style(
'pb-accordion-blocks-style',
plugins_url('build/index.css', __FILE__),
array(),
$this->plugin_version
);
}
}
/**
* Tell WordPress which JavaScript files contain translations
*/
function set_script_translations() {
wp_set_script_translations('pb-accordion-blocks-editor-script', 'accordion-blocks');
}
/**
* Register accordion defaults site setting
*/
public function register_settings() {
register_setting(
'general',
'accordion_blocks_defaults',
array(
'type' => 'object',
'show_in_rest' => array(
'schema' => array(
'type' => 'object',
'properties' => array(
'initiallyOpen' => array(
'type' => 'boolean',
),
'clickToClose' => array(
'type' => 'boolean',
),
'autoClose' => array(
'type' => 'boolean',
),
'scroll' => array(
'type' => 'boolean',
),
'scrollOffset' => array(
'type' => 'integer',
),
),
),
),
'default' => array(
'initiallyOpen' => false,
'clickToClose' => true,
'autoClose' => true,
'scroll' => false,
'scrollOffset' => 0,
),
)
);
register_setting(
'accordion_blocks_settings',
'accordion_blocks_load_scripts_globally',
array(
'type' => 'boolean',
'default' => 'on',
)
);
}
/**
* Register rest endpoint to get and set plugin defaults
*/
public function register_rest_routes() {
register_rest_route('accordion-blocks/v1', '/defaults', array(
'methods' => WP_REST_Server::READABLE,
'callback' => array($this, 'api_get_defaults'),
'permission_callback' => function() {
return current_user_can('edit_posts');
}
));
register_rest_route('accordion-blocks/v1', '/defaults', array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array($this, 'api_set_defaults'),
'permission_callback' => function() {
return current_user_can('publish_pages');
}
));
}
/**
* Get accordion block default settings
*
* @return object Default accordion block settings object
*/
public function api_get_defaults(WP_REST_Request $request) {
$response = new WP_REST_Response(get_option('accordion_blocks_defaults'));
$response->set_status(200);
return $response;
}
/**
* Set accordion block default settings
*
* @param data object The date passed from the API
* @return object Default accordion block settings object
*/
public function api_set_defaults($request) {
$old_defaults = get_option('accordion_blocks_defaults');
$new_defaults = json_decode($request->get_body());
$new_defaults = (object) array(
'initiallyOpen' => isset($new_defaults->initiallyOpen) ? $new_defaults->initiallyOpen : $old_defaults->initiallyOpen,
'clickToClose' => isset($new_defaults->clickToClose) ? $new_defaults->clickToClose : $old_defaults->clickToClose,
'autoClose' => isset($new_defaults->autoClose) ? $new_defaults->autoClose : $old_defaults->autoClose,
'scroll' => isset($new_defaults->scroll) ? $new_defaults->scroll : $old_defaults->scroll,
'scrollOffset' => isset($new_defaults->scrollOffset) ? $new_defaults->scrollOffset : $old_defaults->scrollOffset,
);
$updated = update_option('accordion_blocks_defaults', $new_defaults);
$response = new WP_REST_Response($new_defaults);
$response->set_status($updated ? 201 : 500);
return $response;
}
/**
* Add documentation link on plugin page
*/
public function add_documentation_link($links) {
array_push($links, sprintf('<a href="%s">%s</a>',
'http://wordpress.org/plugins/accordion-blocks/',
_x('Documentation', 'link to documentation on wordpress.org site', 'accordion-blocks')
));
array_push($links, sprintf('<a href="%s">%s</a>',
'https://philbuchanan.com/donate/',
__('Donate', 'accordion-blocks')
));
return $links;
}
/**
* Get the load_scripts_globally option and return true or false.
*/
private function should_load_scripts_globally() {
/**
* This removes the old option (the option name had a typo), but ensures
* the new option gets updated with the same setting.
*/
if (get_option('accordion_blocks_load_scripts_globablly') == 'on') {
update_option('accordion_blocks_load_scripts_globally', 'on');
}
delete_option('accordion_blocks_load_scripts_globablly');
$load_scripts_globally = get_option('accordion_blocks_load_scripts_globally', 'on');
return !!$load_scripts_globally;
}
/**
* Add the admin menu settings page
*/
public function add_settings_menu() {
add_options_page(
__('Accordion Blocks Settings', 'accordion-blocks'),
__('Accordion Blocks', 'accordion-blocks'),
'manage_options',
'accordion_blocks_settings',
array($this, 'render_settings_page')
);
}
/**
* Render the settings page
*/
public function render_settings_page() {
if (!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to access this page.', 'accordion-blocks'));
} ?>
<div class="wrap">
<h2><?php _e('Accordion Blocks Settings', 'accordion-blocks'); ?></h2>
<form method="POST" action="options.php">
<?php
settings_fields('accordion_blocks_settings');
do_settings_sections('accordion_blocks_settings');
submit_button();
?>
</form>
</div>
<?php }
/**
* Register setting sections and individual settings
*/
public function settings_api_init() {
add_settings_section(
'accordion_blocks_global_settings_section',
__('Global Settings', 'accordion-blocks'),
array($this, 'accordion_blocks_global_settings_section_callback'),
'accordion_blocks_settings'
);
add_settings_field(
'accordion_blocks_load_scripts_globally',
__('Scripts and Styles', 'accordion-blocks'),
array($this, 'load_scripts_globally_setting_callback'),
'accordion_blocks_settings',
'accordion_blocks_global_settings_section',
array(
'label_for' => 'accordion_blocks_load_scripts_globally',
)
);
}
/**
* Callback function for Accordion Blocks global settings section
* Add section intro copy here (if necessary)
*/
public function accordion_blocks_global_settings_section_callback() {}
/**
* Callback function for load scripts globally setting
*/
public function load_scripts_globally_setting_callback() {
$load_scripts_globally = $this->should_load_scripts_globally(); ?>
<fieldset>
<legend class="screen-reader-text">
<span><?php _e('Scripts and Styles', 'accordion-blocks'); ?></span>
</legend>
<label for="accordion_blocks_load_scripts_globally">
<input
type="checkbox"
id="accordion_blocks_load_scripts_globally"
name="accordion_blocks_load_scripts_globally"
aria-describedby="load-scripts-globally"
<?php checked($load_scripts_globally); ?>
>
<?php _e('Load scripts and styles globally', 'accordion-blocks'); ?>
</label>
<div id="load-scripts-globally">
<p class="description">
<?php _e('Turning this off may cause accordions to stop working in some instances.', 'accordion-blocks'); ?>
</p>
<p class="description">
<?php _e('Turn this on if you use accordions outside of the main content editor, or are adding accordions programatically.', 'accordion-blocks'); ?>
</p>
</div>
</fieldset>
<?php }
}
$PB_Accordion_Blocks = new PB_Accordion_Blocks;
endif;
{
"apiVersion": "2",
"name": "pb/accordion-item",
"title": "Accordion Item",
"category": "text",
"textdomain": "accordion-blocks",
"attributes": {
"title": {
"type": "string",
"source": "html",
"selector": ".c-accordion__title"
},
"initiallyOpen": {
"type": "boolean",
"default": false
},
"clickToClose": {
"type": "boolean",
"default": true
},
"autoClose": {
"type": "boolean",
"default": true
},
"titleTag": {
"type": "string",
"default": "h2"
},
"scroll": {
"type": "boolean",
"default": false
},
"scrollOffset": {
"type": "number",
"default": 0
},
"uuid": {
"type": "number"
}
},
"supports": {
"anchor": true
},
"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css"
}
<?php return array('dependencies' => array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '348416c729ba3f21f077b8a632fd9ba7');
\ No newline at end of file
.c-accordion__item.no-js .c-accordion__content{display:block!important}.c-accordion__item.no-js .c-accordion__title{cursor:default;padding-right:none}.c-accordion__item.no-js .c-accordion__title:after{display:none}.c-accordion__title--button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;border-radius:0;box-shadow:none;direction:ltr;display:inline-block;font:inherit;height:auto;margin:0;overflow:auto;padding:0;text-align:left;text-decoration:none;transition:0;vertical-align:middle;width:100%}.c-accordion__title--button,.c-accordion__title--button:focus,.c-accordion__title--button:hover{background-color:transparent;color:inherit}.c-accordion__title{cursor:pointer;padding-right:2rem;position:relative}.c-accordion__title:after{color:#777;content:"+";font-weight:300;position:absolute;right:0;top:50%;transform:translateY(-50%)}.is-open>.c-accordion__title:after{content:"−"}[data-initially-open=false] .c-accordion__content{display:none}@media print{.c-accordion__content{display:block!important}}
.editor-styles-wrapper .c-accordion__item.is-selected{border-bottom:1px solid var(--wp-admin-theme-color)!important}
(function($) {
'use strict';
// Remove the 'no-js' class since JavaScript is enabled
$('.js-accordion-item').removeClass('no-js');
/**
* Accordion Blocks plugin function
*
* @param object options Plugin settings to override the defaults
*/
$.fn.accordionBlockItem = function(options) {
var settings = $.extend({
// Set default settings
initiallyOpen: false,
autoClose: true,
clickToClose: true,
scroll: false,
scrollOffset: false,
}, options);
var duration = 250;
var hashID = window.location.hash.replace('#', '');
var item = {};
item.self = $(this);
item.id = $(this).attr('id');
item.controller = $(this).children('.js-accordion-controller');
item.uuid = getAccordionItemUUID(item.self);
item.content = $('#ac-' + item.uuid);
item.accordionGroupItems = [item.uuid];
item.accordionAncestorItems = [];
/**
* Initial setup
* Set the scroll offset, and figure out which items should be open by
* default.
*/
(function initialSetup() {
/**
* Set up some defaults for this controller
* These cannot be set in the blocks `save` function because
* WordPress strips `tabindex` and `aria-controls` attributes from
* saved post content. See `_wp_add_global_attributes` function in
* wp-includes/kses.php for list of allowed attributes.
*/
item.controller.attr({
'tabindex': 0,
'aria-controls': 'ac-' + item.uuid,
});
settings.scrollOffset = Math.floor(parseInt(settings.scrollOffset, 10)) || 0;
/**
* Add any sibling accordion items to the accordionGroupItems array.
*/
$.each(item.self.siblings('.js-accordion-item'), function(index, ele) {
var uuid = getAccordionItemUUID(ele);
item.accordionGroupItems.push(uuid);
});
/**
* Add any parent accordion items to the accordionAncestorItems array.
*/
$.each(item.self.parents('.js-accordion-item'), function(index, ele) {
var uuid = getAccordionItemUUID(ele);
item.accordionAncestorItems.push(uuid);
});
// If this item has `initially-open prop` set to true, open it
if (settings.initiallyOpen) {
/**
* We aren't opening the item here (only setting open attributes)
* because the openItem() function fires the `openAccordionItem`
* event which, if `autoClose` is set, would override the users
* defined initiallyOpen settings.
*
* Only setting open attributes is fine since the item's content
* display (`display: none|block`) is already set by the plugin.
*/
setOpenItemAttributes();
}
// If the hash matches this item, open it
else if (item.id === hashID) {
/**
* Unlike the `initiallyOpen` case above, if a hash is detected
* that matches one of the accordion items, we probably _want_
* the other items to close so the user can focus on this item.
*/
openItem();
// Open ancestors if necessary
$.each(item.accordionAncestorItems, function(index, uuid) {
$(document).trigger('openAncestorAccordionItem', uuid);
});
}
// Otherwise, close the item
else {
/**
* Don't use closeItem() function call since it animates the
* closing. Instead, we only need to set the closed attributes.
*/
setCloseItemAttributes();
}
})();
/**
* Default click function
* Called when an accordion controller is clicked.
*/
function clickHandler() {
// Only open the item if item isn't already open
if (!item.self.hasClass('is-open')) {
// Open clicked item
openItem();
}
// If item is open, and click to close is set, close it
else if (settings.clickToClose) {
closeItem();
}
return false;
}
/**
* Get the accordion item UUID for a given accordion item DOM element.
*/
function getAccordionItemUUID(ele) {
return $(ele).children('.js-accordion-controller').attr('id').replace('at-', '');
}
/**
* Opens an accordion item
* Also handles accessibility attribute settings.
*/
function openItem() {
setOpenItemAttributes();
// Clear/stop any previous animations before revealing content
item.content.clearQueue().stop().slideDown(duration, function() {
// Scroll page to the title
if (settings.scroll) {
// Pause scrolling until other items have closed
setTimeout(function() {
$('html, body').animate({
scrollTop: item.self.offset().top - settings.scrollOffset
}, duration);
}, duration);
}
});
$(document).trigger('openAccordionItem', item);
}
/**
* Set open item attributes
* Mark accordion item as open and read and set aria attributes.
*/
function setOpenItemAttributes() {
item.self.addClass('is-open is-read');
item.controller.attr('aria-expanded', true);
item.content.prop('hidden', false);
}
/**
* Closes an accordion item
* Also handles accessibility attribute settings.
*/
function closeItem() {
// Close the item
item.content.slideUp(duration, function() {
setCloseItemAttributes();
});
}
/**
* Set closed item attributes
* Mark accordion item as closed and set aria attributes.
*/
function setCloseItemAttributes() {
item.self.removeClass('is-open');
item.controller.attr('aria-expanded', false);
item.content.attr('hidden', true);
}
/**
* Close all items if auto close is enabled
*/
function maybeCloseItem() {
if (settings.autoClose && item.self.hasClass('is-open')) {
closeItem();
}
}
/**
* Add event listeners
*/
item.controller.on('click', clickHandler);
/**
* Listen for other accordion items opening
*
* The `openAccordionItem` event is fired whenever an accordion item is
* opened after initial plugin setup.
*/
$(document).on('openAccordionItem', function(event, ele) {
/**
* Only trigger potential close these conditions are met:
*
* 1. This isn't the item the user just clicked to open.
* 2. This accordion is in the same group of accordions as the one
* that was just clicked to open.
* 3. This accordion is not an ancestor of the item that was just
* clicked to open.
*
* This serves two purposes:
*
* 1. It allows nesting of accordions to work.
* 2. It allows users to group accordions to control independently
* of other groups of accordions.
* 3. It allows child accordions to be opened via hash change
* without automatically closing the parent accordion, therefore
* hiding the accordion the user just indicated they wanted open.
*/
if (
ele !== item &&
ele.accordionGroupItems.indexOf(item.uuid) > 0 &&
ele.accordionAncestorItems.indexOf(item.uuid) === -1
) {
maybeCloseItem();
}
});
/**
* Listen for ancestor opening requests
*
* The `openAncestorAccordionItem` event is fired whenever a nested
* accordion item is opened, but the ancestors may also need to be
* opened.
*/
$(document).on('openAncestorAccordionItem', function(event, uuid) {
if (uuid === item.uuid) {
openItem();
}
});
item.controller.on('keydown', function(event) {
var code = event.which;
if (item.controller.prop('tagName') !== 'BUTTON') {
// 13 = Return, 32 = Space
if ((code === 13) || (code === 32)) {
// Simulate click on the controller
$(this).click();
}
}
// 27 = Esc
if (code === 27) {
maybeCloseItem();
}
});
// Listen for hash changes (in page jump links for accordions)
$(window).on('hashchange', function() {
hashID = window.location.hash.replace('#', '');
// Only open this item if the has matches the ID
if (hashID === item.id) {
var ele = $('#' + hashID);
// If there is a hash and the hash is on an accordion item
if (ele.length && ele.hasClass('js-accordion-item')) {
// Open clicked item
openItem();
// Open ancestors if necessary
$.each(item.accordionAncestorItems, function(index, uuid) {
$(document).trigger('openAncestorAccordionItem', uuid);
});
}
}
});
return this;
};
// Loop through accordion settings objects
// Wait for the entire page to load before loading the accordion
$(window).on('load', function() {
$('.js-accordion-item').each(function() {
$(this).accordionBlockItem({
// Set default settings
initiallyOpen: $(this).data('initially-open'),
autoClose: $(this).data('auto-close'),
clickToClose: $(this).data('click-to-close'),
scroll: $(this).data('scroll'),
scrollOffset: $(this).data('scroll-offset'),
});
});
});
}(jQuery));
!function(u){"use strict";u(".js-accordion-item").removeClass("no-js"),u.fn.accordionBlockItem=function(o){var n=u.extend({initiallyOpen:!1,autoClose:!0,clickToClose:!0,scroll:!1,scrollOffset:!1},o),t=250,c=window.location.hash.replace("#",""),e={};function i(o){return u(o).children(".js-accordion-controller").attr("id").replace("at-","")}function s(){r(),e.content.clearQueue().stop().slideDown(t,function(){n.scroll&&setTimeout(function(){u("html, body").animate({scrollTop:e.self.offset().top-n.scrollOffset},t)},t)}),u(document).trigger("openAccordionItem",e)}function r(){e.self.addClass("is-open is-read"),e.controller.attr("aria-expanded",!0),e.content.prop("hidden",!1)}function l(){e.content.slideUp(t,function(){a()})}function a(){e.self.removeClass("is-open"),e.controller.attr("aria-expanded",!1),e.content.attr("hidden",!0)}function d(){n.autoClose&&e.self.hasClass("is-open")&&l()}return e.self=u(this),e.id=u(this).attr("id"),e.controller=u(this).children(".js-accordion-controller"),e.uuid=i(e.self),e.content=u("#ac-"+e.uuid),e.accordionGroupItems=[e.uuid],e.accordionAncestorItems=[],e.controller.attr({tabindex:0,"aria-controls":"ac-"+e.uuid}),n.scrollOffset=Math.floor(parseInt(n.scrollOffset,10))||0,u.each(e.self.siblings(".js-accordion-item"),function(o,n){var t=i(n);e.accordionGroupItems.push(t)}),u.each(e.self.parents(".js-accordion-item"),function(o,n){var t=i(n);e.accordionAncestorItems.push(t)}),n.initiallyOpen?r():e.id===c?(s(),u.each(e.accordionAncestorItems,function(o,n){u(document).trigger("openAncestorAccordionItem",n)})):a(),e.controller.on("click",function(){return e.self.hasClass("is-open")?n.clickToClose&&l():s(),!1}),u(document).on("openAccordionItem",function(o,n){n!==e&&0<n.accordionGroupItems.indexOf(e.uuid)&&-1===n.accordionAncestorItems.indexOf(e.uuid)&&d()}),u(document).on("openAncestorAccordionItem",function(o,n){n===e.uuid&&s()}),e.controller.on("keydown",function(o){var n=o.which;"BUTTON"!==e.controller.prop("tagName")&&(13!==n&&32!==n||u(this).click()),27===n&&d()}),u(window).on("hashchange",function(){var o;(c=window.location.hash.replace("#",""))!==e.id||(o=u("#"+c)).length&&o.hasClass("js-accordion-item")&&(s(),u.each(e.accordionAncestorItems,function(o,n){u(document).trigger("openAncestorAccordionItem",n)}))}),this},u(window).on("load",function(){u(".js-accordion-item").each(function(){u(this).accordionBlockItem({initiallyOpen:u(this).data("initially-open"),autoClose:u(this).data("auto-close"),clickToClose:u(this).data("click-to-close"),scroll:u(this).data("scroll"),scrollOffset:u(this).data("scroll-offset")})})})}(jQuery);
......@@ -8,10 +8,8 @@
align-items: center;
justify-content: center;
color:#fff;
margin:40px -50%;
margin:40px -50% 0px -50%;
padding:0px 50%;
}
......
......@@ -98,9 +98,10 @@ error_log($carousel_style );
<?php endwhile; ?>
</div>
<div class="swiper-pagination"></div>
</div>
<div class="swiper-button-prev" data-id="<?= $id ?>"></div>
<div class="swiper-button-next" data-id="<?= $id ?>"></div>
</div>
<?php else: ?>
<p>Please add some slides.</p>
<?php endif; ?>
......
......@@ -15604,11 +15604,10 @@ h1, .h1 {
}
h2, .h2 {
text-align: center;
color: #0484B8;
font-size: 40px;
line-height: 49px;
margin-bottom: 40px;
margin-bottom: 20px;
}
h3, .h3 {
......@@ -15618,6 +15617,14 @@ h3, .h3 {
margin-top: 20px;
}
a {
color: #2C2C2C;
}
div#full-width-page-wrapper {
padding-bottom: 0px;
}
input[type=text], input[type=email] {
border-radius: 0px !important;
border: 0px solid #fff !important;
......@@ -15659,16 +15666,21 @@ input[type=checkbox] {
border-bottom: 20px solid #0484B8;
}
#wpcf7-f115-p18-o1 {
.wpcf7 {
max-width: 100% !important;
}
.wpcf7 .contact-form {
padding-top: 40px;
max-width: 80% !important;
margin: auto;
}
#wpcf7-f115-p18-o1 input[type=text], #wpcf7-f115-p18-o1 input[type=email], #wpcf7-f115-p18-o1 textarea {
.wpcf7 .contact-form input[type=text], .wpcf7 .contact-form input[type=email], .wpcf7 .contact-form textarea {
background-color: #E5F2F8;
}
#wpcf7-f115-p18-o1 .wpcf7-list-item {
.wpcf7 .contact-form .wpcf7-list-item {
margin: 0px;
}
#wpcf7-f115-p18-o1 input[type=submit] {
.wpcf7 .contact-form input[type=submit] {
text-align: center;
margin: auto;
margin-top: 20px;
......@@ -15677,6 +15689,22 @@ input[type=checkbox] {
color: #fff;
text-transform: uppercase;
display: block;
font-size: 18px;
}
.no-bullets {
list-style: none;
-webkit-margin-before: 0em;
margin-block-start: 0em;
-webkit-padding-start: 0px;
padding-inline-start: 0px;
}
.no-bullets li {
margin-bottom: 10px;
}
.wp-block-image.is-style-rounded img {
border-radius: 25px;
}
.pre-header {
......@@ -15828,11 +15856,11 @@ input[type=checkbox] {
background-position: center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='23.024' height='23.545' viewBox='0 0 23.024 23.545'%3E%3Cg id='Group_1373' data-name='Group 1373' transform='translate(0 1.5)'%3E%3Cline id='Line_15' data-name='Line 15' y1='15.007' transform='translate(11.512 7.038)' fill='none' stroke='%23fff' stroke-width='3'/%3E%3Cpath id='Path_1388' data-name='Path 1388' d='M3331.593 12517.547h23.024' transform='translate(-3331.593 -12517.547)' fill='none' stroke='%23fff' stroke-width='3'/%3E%3Cpath id='Path_1389' data-name='Path 1389' d='M3279.832 12508.2l8.216-8.217 8.216 8.217' transform='translate(-3276.535 -12494.895)' fill='none' stroke='%23fff' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
z-index: 999;
}
#btn-back-to-top:hover {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='23.024' height='23.545' viewBox='0 0 23.024 23.545'%3E%3Cg id='Group_1373' data-name='Group 1373' transform='translate(0 1.5)'%3E%3Cline id='Line_15' data-name='Line 15' y1='15.007' transform='translate(11.512 7.038)' fill='none' stroke='%232C2C2C' stroke-width='3'/%3E%3Cpath id='Path_1388' data-name='Path 1388' d='M3331.593 12517.547h23.024' transform='translate(-3331.593 -12517.547)' fill='none' stroke='%232C2C2C' stroke-width='3'/%3E%3Cpath id='Path_1389' data-name='Path 1389' d='M3279.832 12508.2l8.216-8.217 8.216 8.217' transform='translate(-3276.535 -12494.895)' fill='none' stroke='%2C2C2C' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
background-color: #fff;
background-color: #000;
}
#wrapper-footer-full {
......@@ -15866,7 +15894,7 @@ input[type=checkbox] {
.newsletter {
background-color: #6ED5FF;
min-height: 236px;
padding-top: 52px;
padding: 52px 0px 32px 0px;
}
.newsletter h2, .newsletter .h2 {
font-size: 18px;
......@@ -15923,12 +15951,6 @@ input[type=checkbox] {
left: 0 !important;
min-height: 340px !important;
}
.carousel .carousel-items {
margin-left: 1.75rem;
}
.carousel .swiper-wrapper {
gap: 1rem;
}
.carousel .swiper-button-next {
right: 8px !important;
}
......@@ -15938,6 +15960,12 @@ input[type=checkbox] {
.carousel .swiper-pagination {
bottom: -20px !important;
}
.carousel .carousel-items {
margin-left: 1.75rem;
}
.carousel .swiper-wrapper {
gap: 1rem;
}
.testimonials-carousel .swiper-slide {
width: 890px !important;
......@@ -15945,7 +15973,7 @@ input[type=checkbox] {
.testimonials-carousel .swiper-slide .testimonials {
width: 890px;
background: #E5F2F8;
border-radius: 8px 8px 0px 0px;
border-radius: 25px 25px 0px 0px;
margin-right: 20px;
}
.testimonials-carousel .swiper-slide .testimonials .row {
......@@ -15971,12 +15999,118 @@ input[type=checkbox] {
.testimonials-carousel .swiper-slide:nth-of-type(2) .testimonials .row {
border-bottom: 20px solid #3F9C35;
}
.testimonials-carousel .swiper-slide:nth-of-type(2) .promo-img img {
border-bottom: 20px solid #3F9C35;
}
.testimonials-carousel .swiper-slide:nth-of-type(3) .testimonials .row {
border-bottom: 20px solid #0484B8;
}
.testimonials-carousel .swiper-slide:nth-of-type(3) .promo-img img {
border-bottom: 20px solid #0484B8;
}
.testimonials-carousel .swiper-slide:nth-of-type(4) .testimonials .row {
border-bottom: 20px solid #E04E39;
}
.testimonials-carousel .swiper-slide:nth-of-type(4) .promo-img img {
border-bottom: 20px solid #E04E39;
}
.promo-carousel {
width: 100% !important;
margin-left: 0px !important;
position: relative;
}
@media only screen and (min-width: 1400px) {
.promo-carousel {
max-width: 100% !important;
}
}
.promo-carousel .swiper-slide {
margin-left: 0px !important;
max-width: 100% !important;
}
@media only screen and (min-width: 1400px) {
.promo-carousel .swiper-slide {
width: 100% !important;
}
}
.promo-carousel .swiper-slide .promo-img {
max-height: 264px;
max-width: 372px;
overflow: hidden;
border-bottom: 20px solid #FFA300;
}
.promo-carousel .swiper-slide .promo-img img {
max-width: 372px;
border-radius: 25px 25px 0px 0px;
}
.promo-carousel .swiper-slide .promo.row {
width: 100%;
border-top: 1px solid #FFA300;
border-bottom: 1px solid #FFA300;
margin: 75px auto;
padding: 56px 0px;
}
@media only screen and (min-width: 1400px) {
.promo-carousel .swiper-slide .promo.row {
max-width: 1344px;
}
}
@media only screen and (max-width: 600px) {
.promo-carousel .swiper-slide .promo.row {
width: 80%;
}
}
.promo-carousel .swiper-button-next {
right: 30px !important;
}
.promo-carousel .swiper-button-prev {
left: 7px !important;
}
.promo-carousel .swiper-pagination {
bottom: 95px !important;
}
.promo-carousel .swiper-slide:nth-of-type(2) .promo-img {
border-bottom: 20px solid #3F9C35;
}
.promo-carousel .swiper-slide:nth-of-type(3) .promo-img {
border-bottom: 20px solid #0484B8;
}
.promo-carousel .swiper-slide:nth-of-type(4) .promo-img {
border-bottom: 20px solid #E04E39;
}
.c-accordion__title:after {
content: "\f343";
font-family: "Font Awesome";
right: unset;
left: 0px;
}
.is-open > .c-accordion__title:after {
content: "\f077";
font-family: "Font Awesome";
}
.c-accordion__title {
padding-left: 30px;
}
.c-accordion__content {
padding-left: 30px;
}
.js-accordion-item {
background: var(--unnamed-color-ffffff) 0% 0% no-repeat padding-box;
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 6px #00000029;
border-radius: 10px;
padding: 15px 10px 8px 10px;
margin-bottom: 20px;
}
.js-accordion-item h3, .js-accordion-item .h3 {
margin-top: 0px !important;
}
.has-blue-color,
.has-blue-color:visited {
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -9,6 +9,8 @@
defined( 'ABSPATH' ) || exit;
include 'inc/menu-widgets.php';
include 'inc/blocks.php';
include 'inc/custom-post-type.php';
include 'inc/shortcodes.php';
/**
......
<?php
function create_posttype() {
register_post_type( 'promo',
array(
'labels' => array(
'name' => __( 'Promos' ),
'singular_name' => __( 'Promo' )
),
'menu_icon' => 'dashicons-info',
'public' => true,
'has_archive' => false,
'rewrite' => array('slug' => 'promo', 'with_front'=>false),
'show_in_rest' => true,
'taxonomies' => array( 'category' ),
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields' ),
)
);
$labels = array(
'name' => _x( 'Promo Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Promo Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Promo Cats' ),
'all_items' => __( 'All Promo Cats' ),
'parent_item' => __( 'Parent Subject' ),
'parent_item_colon' => __( 'Parent Subject:' ),
'edit_item' => __( 'Edit Subject' ),
'update_item' => __( 'Update Subject' ),
'add_new_item' => __( 'Add New Subject' ),
'new_item_name' => __( 'New Subject Name' ),
'menu_name' => __( 'Promo Category' ),
);
// Now register the taxonomy
register_taxonomy('promo_category',array('promo'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_in_rest' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'promo-category' ),
));
}
add_action( 'init', 'create_posttype' );
\ No newline at end of file
<?php
function promos()
{
$custom_args = array(
'post_type' => 'promo',
'posts_per_page' => 3,
'paged' => 1,
);
$custom_query = new \WP_Query($custom_args);
ob_start();
$uniqid = uniqid();
if ($custom_query->have_posts()):?>
<div class="carousel">
<div id="<?php echo $uniqid; ?>" class="promo-carousel carousel-items">
<div class='swiper-wrapper'>
<?php while ($custom_query->have_posts()): $custom_query->the_post();
$id = get_the_ID();
$post = get_post($id);
$link = get_permalink($id);
if ($custom_link = get_post_meta($id, 'link', true)) {
$link = $custom_link;
}
$link_text = "Read More...";
if ($custom_link_text = get_post_meta($id, 'link_text', true)) {
$link_text = $custom_link_text;
}
$text = strip_shortcodes($post->post_content);
$text = apply_filters( 'the_content', $text );
$text = str_replace(']]>', ']]&gt;', $text);
$excerpt_length = apply_filters( 'excerpt_length', 40 );
$text = wp_trim_words( $text, $excerpt_length, ' ...' );
?>
<div class="swiper-slide container">
<div class="promo row align-items-center">
<div class="col-lg-4 col-md-12">
<div class="promo-img">
<?php echo get_the_post_thumbnail($id, 'full' ); ?>
<div class="promo-img-over"> </div>
</div>
</div>
<div class="promo_content col-lg-8 col-md-12">
<?php echo '<h3>'.$post->post_title.'</h3><p>'. $text.'</p>'; ?>
<a class="promo-link" target="_blank" href="<?php echo $link; ?>" title="<?php the_title_attribute(); ?>"><?php echo $link_text;?></a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev" data-id="<?= $uniqid; ?>"></div>
<div class="swiper-button-next" data-id="<?= $uniqid; ?>"></div>
</div>
</div>
<?php endif; ?>
<?php wp_reset_query(); ?>
<?php $output = ob_get_clean();
return $output;
}
add_shortcode( 'promos', 'promos' );
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
module.exports = {
"proxy": "localhost/",
"proxy": "http://st-joes.test/",
"notify": false,
"files": ["./css/*.min.css", "./js/*.min.js", "./**/*.php"]
};
\ No newline at end of file
......
import Swiper, { Navigation, Pagination } from 'swiper';
import Swiper, { Navigation, Pagination, A11y, Keyboard } from 'swiper';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
import 'swiper/css/keyboard';
import 'swiper/css/a11y';
jQuery(document).ready(function($) {
var offset = ((window.innerWidth - $('.entry-content').width() ) / 2) - 28;
jQuery('.carousel-items').each(function() {
var offset = ((window.innerWidth - $('.entry-content').width() ) / 2) - 28;
var offsetAfter = 0;
var PerView = 'auto';
var space = 20;
var _id = jQuery(this).parent().attr('id');
var swiper_params = {
modules: [Navigation, Pagination],
if(jQuery(this).hasClass('promo-carousel')) {
offset = 0;
PerView = 1;
space = 0;
offsetAfter = 0;
_id = jQuery(this).attr('id');
}
slidesPerView:"auto",
slidesOffsetBefore:offset,
spaceBetween:25,
var swiper_params = {
modules: [Navigation, Pagination, A11y, Keyboard],
slidesPerView:PerView,
slidesOffsetAfter:offsetAfter,
slidesOffsetBefore:offset,
spaceBetween:space,
slidesPerGroup:1,
pagination: {
el: ".swiper-pagination",
type: 'bullets',
clickable:"true",
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next[data-id="'+_id+'"]',
prevEl: '.swiper-button-prev[data-id="'+_id+'"]',
},
a11y: {
prevSlideMessage: 'Previous slide',
nextSlideMessage: 'Next slide',
},
keyboard: {
enabled: true,
onlyInViewport: false,
},
};
new Swiper(this, swiper_params);
console.log(swiper_params);
});
......
......@@ -11,7 +11,8 @@
@import "theme/child_theme"; // <------- Add your styles into this file
@import "theme/header";
@import "theme/footer";
@import "theme/carousel";
@import "theme/carousel";
@import "theme/accordion";
@import "assets/understrap/theme/colors"; // <-------- This creates the necessary bootstrap color classes.
@import "assets/understrap/theme/blocks"; // <-------- This adds Bootstrap styles to blocks.
......
.c-accordion__title:after{
content: "\f343";
font-family: "Font Awesome";
right: unset;
left:0px;
}
.is-open>.c-accordion__title:after {
content: "\f077";
font-family: "Font Awesome";
}
.c-accordion__title{
padding-left: 30px;
}
.c-accordion__content{
padding-left: 30px;
}
.js-accordion-item{
background: var(--unnamed-color-ffffff) 0% 0% no-repeat padding-box;
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 6px #00000029;
border-radius: 10px;
padding: 15px 10px 8px 10px;
margin-bottom: 20px;
h3{
margin-top: 0px !important;
}
}
\ No newline at end of file
......@@ -30,14 +30,6 @@
.carousel {
.carousel-items {
margin-left:1.75rem;
}
.swiper-wrapper {
gap: 1rem;
}
width:100vw;
margin-left:calc((100% - 100vw) / 2);
left:0 !important;
......@@ -51,6 +43,12 @@
.swiper-pagination{
bottom: -20px !important;
}
.carousel-items {
margin-left:1.75rem;
}
.swiper-wrapper {
gap: 1rem;
}
}
// testimonials carousel css
......@@ -61,7 +59,7 @@
.testimonials{
width:890px;
background:#E5F2F8;
border-radius: 8px 8px 0px 0px;
border-radius: 25px 25px 0px 0px;
margin-right: 20px;
.row{
margin-right: 0rem !important;
......@@ -94,7 +92,10 @@
.testimonials{
.row{
border-bottom:20px solid #3F9C35;
}
}
.promo-img img{
border-bottom:20px solid #3F9C35;
}
}
.swiper-slide:nth-of-type(3){
......@@ -103,6 +104,9 @@
border-bottom:20px solid #0484B8;
}
}
.promo-img img{
border-bottom:20px solid #0484B8;
}
}
.swiper-slide:nth-of-type(4){
.testimonials{
......@@ -110,9 +114,80 @@
border-bottom:20px solid #E04E39;
}
}
.promo-img img{
border-bottom:20px solid #E04E39;
}
}
}
.promo-carousel{
width:100% !important;
margin-left:0px !important;
position: relative;
@media only screen and (min-width:1400px) {
max-width: 100% !important;
}
.swiper-slide{
margin-left:0px !important;
max-width: 100% !important;
@media only screen and (min-width:1400px) {
width:100% !important;
}
.promo-img{
max-height: 264px;
max-width: 372px;
overflow: hidden;
border-bottom:20px solid #FFA300;
}
.promo-img img{
max-width: 372px;
border-radius: 25px 25px 0px 0px;
}
.promo.row{
width:100%;
border-top:1px solid #FFA300;
border-bottom:1px solid #FFA300;
@media only screen and (min-width:1400px) {
max-width: 1344px;
}
@media only screen and (max-width: 600px) {
width:80%;
}
margin: 75px auto;
padding: 56px 0px;
}
}
.swiper-button-next {
right:30px !important;
}
.swiper-button-prev {
left:7px !important;
}
.swiper-pagination{
bottom: 95px !important;
}
.swiper-slide:nth-of-type(2){
.promo-img {
border-bottom:20px solid #3F9C35;
}
}
.swiper-slide:nth-of-type(3){
.promo-img {
border-bottom:20px solid #0484B8;
}
}
.swiper-slide:nth-of-type(4){
.promo-img {
border-bottom:20px solid #E04E39;
}
}
}
\ No newline at end of file
......
......@@ -4,11 +4,11 @@ h1{
}
h2{
text-align: center;
color: #0484B8;
font-size: 40px;
line-height: 49px;
margin-bottom: 40px;
margin-bottom: 20px;
}
h3{
......@@ -17,6 +17,14 @@ h3{
line-height: 32px;
margin-top: 20px;
}
a{
color:#2C2C2C;
}
div#full-width-page-wrapper {
padding-bottom: 0px;
}
input[type=text],input[type=email]{
border-radius: 0px !important;
......@@ -65,24 +73,42 @@ input[type=checkbox]
}
}
}
.wpcf7{
max-width: 100% !important;
.contact-form{
padding-top: 40px;
max-width: 80% !important;
margin: auto;
input[type=text],input[type=email],textarea{
background-color: #E5F2F8;
}
.wpcf7-list-item{
margin:0px;
}
input[type=submit]{
text-align: center;
margin: auto;
margin-top: 20px;
width: 112px;
background-color: #0484B8;
color: #fff;
text-transform: uppercase;
display: block;
font-size: 18px;
#wpcf7-f115-p18-o1{
max-width: 80% !important;
input[type=text],input[type=email],textarea{
background-color: #E5F2F8;
}
.wpcf7-list-item{
margin:0px;
}
}
input[type=submit]{
text-align: center;
margin: auto;
margin-top: 20px;
width: 112px;
background-color: #0484B8;
color: #fff;
text-transform: uppercase;
display: block;
}
.no-bullets{
list-style: none;
margin-block-start: 0em;
padding-inline-start: 0px;
li{
margin-bottom: 10px;
}
}
.wp-block-image.is-style-rounded img{
border-radius: 25px;
}
\ No newline at end of file
......
......@@ -41,7 +41,7 @@
.newsletter{
background-color: #6ED5FF;
min-height: 236px;
padding-top: 52px;
padding: 52px 0px 32px 0px;
h2{
font-size: 18px;
line-height: 24px;
......
......@@ -151,11 +151,11 @@
background-position: center;
background-repeat: no-repeat;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='23.024' height='23.545' viewBox='0 0 23.024 23.545'%3E%3Cg id='Group_1373' data-name='Group 1373' transform='translate(0 1.5)'%3E%3Cline id='Line_15' data-name='Line 15' y1='15.007' transform='translate(11.512 7.038)' fill='none' stroke='%23fff' stroke-width='3'/%3E%3Cpath id='Path_1388' data-name='Path 1388' d='M3331.593 12517.547h23.024' transform='translate(-3331.593 -12517.547)' fill='none' stroke='%23fff' stroke-width='3'/%3E%3Cpath id='Path_1389' data-name='Path 1389' d='M3279.832 12508.2l8.216-8.217 8.216 8.217' transform='translate(-3276.535 -12494.895)' fill='none' stroke='%23fff' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
z-index: 999;
}
#btn-back-to-top:hover{
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='23.024' height='23.545' viewBox='0 0 23.024 23.545'%3E%3Cg id='Group_1373' data-name='Group 1373' transform='translate(0 1.5)'%3E%3Cline id='Line_15' data-name='Line 15' y1='15.007' transform='translate(11.512 7.038)' fill='none' stroke='%232C2C2C' stroke-width='3'/%3E%3Cpath id='Path_1388' data-name='Path 1388' d='M3331.593 12517.547h23.024' transform='translate(-3331.593 -12517.547)' fill='none' stroke='%232C2C2C' stroke-width='3'/%3E%3Cpath id='Path_1389' data-name='Path 1389' d='M3279.832 12508.2l8.216-8.217 8.216 8.217' transform='translate(-3276.535 -12494.895)' fill='none' stroke='%2C2C2C' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E");
background-color:#fff;
background-color:#000;
}
\ No newline at end of file
......