Initial commit: Atomaste website
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying 404 pages (not found)
|
||||
*
|
||||
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
get_header(); ?>
|
||||
<header class="page-header">
|
||||
<h1 class="page-title"><?php esc_html_e( 'Page not found.', 'rara-business' ); ?></h1>
|
||||
</header>
|
||||
<div class="error-holder">
|
||||
<div class="img-holder"><img src="<?php echo esc_url( trailingslashit( get_template_directory_uri() ) . 'images/error-img.jpg' ); ?>" alt="<?php esc_attr_e( '404 page not found', 'rara-business' ); ?>"></div>
|
||||
<div class="text-holder">
|
||||
<h2><?php esc_html_e( 'The page you are looking for might have been removed, has its name changed, or is temporarily unavailable.', 'rara-business' ); ?></h2>
|
||||
<span><?php esc_html_e( 'Please try using our search box below.', 'rara-business' ); ?></span>
|
||||
<?php get_search_form(); ?>
|
||||
<a href="<?php echo esc_url( home_url('/') ); ?>" class="btn-home"><?php esc_html_e( 'Back to homepage', 'rara-business' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Recent Posts
|
||||
*
|
||||
* @hooked rara_business_recent_posts
|
||||
*/
|
||||
do_action( 'rara_business_recent_post' );
|
||||
|
||||
get_footer();
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying archive pages
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<div id="primary" class="content-area">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Search Header
|
||||
*
|
||||
* @hooked rara_business_breadcrumb - 15
|
||||
* @hooked rara_business_page_header - 20
|
||||
*/
|
||||
do_action( 'rara_business_before_posts_content' );
|
||||
?>
|
||||
|
||||
<main id="main" class="site-main">
|
||||
|
||||
<?php
|
||||
if ( have_posts() ) :
|
||||
|
||||
/* Start the Loop */
|
||||
while ( have_posts() ) : the_post();
|
||||
|
||||
/*
|
||||
* Include the Post-Format-specific template for the content.
|
||||
* If you want to override this in a child theme, then include a file
|
||||
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
|
||||
*/
|
||||
get_template_part( 'template-parts/content', get_post_format() );
|
||||
|
||||
endwhile;
|
||||
|
||||
else :
|
||||
|
||||
get_template_part( 'template-parts/content', 'none' );
|
||||
|
||||
endif; ?>
|
||||
|
||||
</main><!-- #main -->
|
||||
|
||||
<?php
|
||||
/**
|
||||
* @hooked rara_business_pagination
|
||||
*/
|
||||
do_action( 'rara_business_after_posts_content' );
|
||||
?>
|
||||
|
||||
</div><!-- #primary -->
|
||||
|
||||
<?php
|
||||
get_sidebar();
|
||||
get_footer();
|
||||
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'c6f56a387ca7b8c8e33b');
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying comments
|
||||
*
|
||||
* This is the template that displays the area of the page that contains both the current comments
|
||||
* and the comment form.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the current post is protected by a password and
|
||||
* the visitor has not yet entered the password we will
|
||||
* return early without loading the comments.
|
||||
*/
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="comments" class="comments-area">
|
||||
|
||||
<?php
|
||||
// You can start editing here -- including this comment!
|
||||
if ( have_comments() ) : ?>
|
||||
<h2 class="comments-title">
|
||||
<?php
|
||||
$comment_count = get_comments_number();
|
||||
printf( // WPCS: XSS OK.
|
||||
/* translators: 1: number of comments in a post */
|
||||
esc_html( _nx( '%1$s Comment', '%1$s Comments', $comment_count, 'comments title', 'rara-business' ) ),
|
||||
number_format_i18n( $comment_count )
|
||||
);
|
||||
?>
|
||||
</h2><!-- .comments-title -->
|
||||
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments( array(
|
||||
'style' => 'ol',
|
||||
'short_ping' => true,
|
||||
'callback' => 'rara_business_theme_comment',
|
||||
'avatar_size' => 70,
|
||||
) );
|
||||
?>
|
||||
</ol><!-- .comment-list -->
|
||||
|
||||
<?php the_comments_navigation();
|
||||
|
||||
// If comments are closed and there are comments, let's leave a little note, shall we?
|
||||
if ( ! comments_open() ) : ?>
|
||||
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'rara-business' ); ?></p>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
endif; // Check for have_comments().
|
||||
?>
|
||||
|
||||
<div class="comments-area">
|
||||
<?php comment_form(); ?>
|
||||
</div>
|
||||
|
||||
</div><!-- #comments -->
|
||||
11
Atomaste Reference/public_html/wp-content/themes/rara-business/css/animate.min.css
vendored
Normal file
3494
Atomaste Reference/public_html/wp-content/themes/rara-business/css/build/animate.css
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Container style
|
||||
*/
|
||||
.ps {
|
||||
overflow: hidden !important;
|
||||
overflow-anchor: none;
|
||||
-ms-overflow-style: none;
|
||||
touch-action: auto;
|
||||
-ms-touch-action: auto;
|
||||
}
|
||||
|
||||
/*
|
||||
* Scrollbar rail styles
|
||||
*/
|
||||
.ps__rail-x {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
transition: background-color .2s linear, opacity .2s linear;
|
||||
-webkit-transition: background-color .2s linear, opacity .2s linear;
|
||||
height: 15px;
|
||||
/* there must be 'bottom' or 'top' for ps__rail-x */
|
||||
bottom: 0px;
|
||||
/* please don't change 'position' */
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ps__rail-y {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
transition: background-color .2s linear, opacity .2s linear;
|
||||
-webkit-transition: background-color .2s linear, opacity .2s linear;
|
||||
width: 15px;
|
||||
/* there must be 'right' or 'left' for ps__rail-y */
|
||||
right: 0;
|
||||
/* please don't change 'position' */
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ps--active-x > .ps__rail-x,
|
||||
.ps--active-y > .ps__rail-y {
|
||||
display: block;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.ps:hover > .ps__rail-x,
|
||||
.ps:hover > .ps__rail-y,
|
||||
.ps--focus > .ps__rail-x,
|
||||
.ps--focus > .ps__rail-y,
|
||||
.ps--scrolling-x > .ps__rail-x,
|
||||
.ps--scrolling-y > .ps__rail-y {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.ps .ps__rail-x:hover,
|
||||
.ps .ps__rail-y:hover,
|
||||
.ps .ps__rail-x:focus,
|
||||
.ps .ps__rail-y:focus,
|
||||
.ps .ps__rail-x.ps--clicking,
|
||||
.ps .ps__rail-y.ps--clicking {
|
||||
background-color: #eee;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/*
|
||||
* Scrollbar thumb styles
|
||||
*/
|
||||
.ps__thumb-x {
|
||||
background-color: #aaa;
|
||||
border-radius: 6px;
|
||||
transition: background-color .2s linear, height .2s ease-in-out;
|
||||
-webkit-transition: background-color .2s linear, height .2s ease-in-out;
|
||||
height: 6px;
|
||||
/* there must be 'bottom' for ps__thumb-x */
|
||||
bottom: 2px;
|
||||
/* please don't change 'position' */
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ps__thumb-y {
|
||||
background-color: #aaa;
|
||||
border-radius: 6px;
|
||||
transition: background-color .2s linear, width .2s ease-in-out;
|
||||
-webkit-transition: background-color .2s linear, width .2s ease-in-out;
|
||||
width: 6px;
|
||||
/* there must be 'right' for ps__thumb-y */
|
||||
right: 2px;
|
||||
/* please don't change 'position' */
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ps__rail-x:hover > .ps__thumb-x,
|
||||
.ps__rail-x:focus > .ps__thumb-x,
|
||||
.ps__rail-x.ps--clicking .ps__thumb-x {
|
||||
background-color: #999;
|
||||
height: 11px;
|
||||
}
|
||||
|
||||
.ps__rail-y:hover > .ps__thumb-y,
|
||||
.ps__rail-y:focus > .ps__thumb-y,
|
||||
.ps__rail-y.ps--clicking .ps__thumb-y {
|
||||
background-color: #999;
|
||||
width: 11px;
|
||||
}
|
||||
|
||||
/* MS supports */
|
||||
@supports (-ms-overflow-style: none) {
|
||||
.ps {
|
||||
overflow: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
||||
.ps {
|
||||
overflow: auto !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
/*=======================
|
||||
WOOCOMMERCE DESIGN
|
||||
=======================*/
|
||||
.woocommerce .woocommerce-result-count,
|
||||
.woocommerce-page .woocommerce-result-count {
|
||||
background: #f5f5f5;
|
||||
padding: 21px 20px;
|
||||
min-width: 50%;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
margin-bottom: 40px;
|
||||
font-size: 18px;
|
||||
}
|
||||
.woocommerce .woocommerce-ordering,
|
||||
.woocommerce-page .woocommerce-ordering {
|
||||
min-width: 50%;
|
||||
text-align: right;
|
||||
background: #f5f5f5;
|
||||
padding: 10px 20px;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.woocommerce .woocommerce-ordering select {
|
||||
height: 50px;
|
||||
padding: 0 10px;
|
||||
font-size: 18px;
|
||||
background: none;
|
||||
}
|
||||
.woocommerce .products ul li,
|
||||
.woocommerce ul.products li {
|
||||
text-align: center;
|
||||
}
|
||||
.woocommerce span.onsale {
|
||||
background: rgba(10, 163, 243, 0.75);
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.6em;
|
||||
padding: 0.6em;
|
||||
}
|
||||
.woocommerce ul.products li.product .woocommerce-loop-category__title,
|
||||
.woocommerce ul.products li.product .woocommerce-loop-product__title,
|
||||
.woocommerce ul.products li.product h3 {
|
||||
font-size: 0.8em;
|
||||
color: #4a4a4a;
|
||||
padding-top: 0;
|
||||
}
|
||||
.woocommerce ul.products li.product .price {
|
||||
font-size: 0.75em;
|
||||
color: #0aa3f3;
|
||||
}
|
||||
.woocommerce #respond input#submit,
|
||||
.woocommerce a.button,
|
||||
.woocommerce button.button,
|
||||
.woocommerce input.button {
|
||||
background: #0aa3f3;
|
||||
border: 1px solid #0aa3f3;
|
||||
font-size: 0.6em;
|
||||
text-transform: uppercase;
|
||||
color: #fff;
|
||||
font-family: 'Montserrat';
|
||||
font-weight: 600;
|
||||
padding: 1.2em 1.9em;
|
||||
}
|
||||
.woocommerce #respond input#submit:hover,
|
||||
.woocommerce a.button:hover,
|
||||
.woocommerce button.button:hover,
|
||||
.woocommerce input.button:hover {
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
color: #0aa3f3;
|
||||
}
|
||||
.woocommerce ul.products li.product .star-rating {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
color: coral;
|
||||
}
|
||||
.woocommerce nav.woocommerce-pagination {
|
||||
text-align: left;
|
||||
}
|
||||
.woocommerce nav.woocommerce-pagination ul {
|
||||
border: none;
|
||||
margin: 0;
|
||||
}
|
||||
.woocommerce nav.woocommerce-pagination ul li {
|
||||
border-right: none;
|
||||
padding-right: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
.woocommerce nav.woocommerce-pagination ul li a,
|
||||
.woocommerce nav.woocommerce-pagination ul li span {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
line-height: 38px;
|
||||
border-radius: 100%;
|
||||
border: 1px solid #ddd;
|
||||
font-size: 0.9em;
|
||||
color: #4a4a4a;
|
||||
}
|
||||
.woocommerce nav.woocommerce-pagination ul li a.prev,
|
||||
.woocommerce nav.woocommerce-pagination ul li a.next {
|
||||
line-height: 35px;
|
||||
}
|
||||
.woocommerce nav.woocommerce-pagination ul li a:focus,
|
||||
.woocommerce nav.woocommerce-pagination ul li a:hover,
|
||||
.woocommerce nav.woocommerce-pagination ul li span.current {
|
||||
border-color: #0aa3f3;
|
||||
background: #0aa3f3;
|
||||
color: #fff;
|
||||
}
|
||||
.woocommerce #respond input#submit.loading::after,
|
||||
.woocommerce a.button.loading::after,
|
||||
.woocommerce button.button.loading::after,
|
||||
.woocommerce input.button.loading::after {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 30%;
|
||||
color: #000;
|
||||
font-size: 20px;
|
||||
}
|
||||
.woocommerce a.added_to_cart {
|
||||
font-weight: 600;
|
||||
font-size: 0.8em;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.woocommerce a.added_to_cart:hover {
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
.single-product .entry-summary {
|
||||
margin-top: 0;
|
||||
}
|
||||
.single-product.woocommerce div.product .product_title {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
.woocommerce div.product .entry-summary p.price,
|
||||
.woocommerce div.product .entry-summary span.price {
|
||||
color: #0aa3f3;
|
||||
font-weight: 600;
|
||||
font-size: 1em;
|
||||
font-family: 'Montserrat';
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.single-product.woocommerce div.product form.cart {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
.woocommerce .quantity .qty {
|
||||
padding: 7px 15px;
|
||||
text-align: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.woocommerce #respond input#submit.alt,
|
||||
.woocommerce a.button.alt,
|
||||
.woocommerce button.button.alt,
|
||||
.woocommerce input.button.alt {
|
||||
background-color: #0aa3f3;
|
||||
}
|
||||
.woocommerce #respond input#submit.alt:hover,
|
||||
.woocommerce a.button.alt:hover,
|
||||
.woocommerce button.button.alt:hover,
|
||||
.woocommerce input.button.alt:hover {
|
||||
background-color: transparent;
|
||||
color: #0aa3f3;
|
||||
}
|
||||
.single-product .product_meta > span {
|
||||
font-weight: 600;
|
||||
font-size: 0.8em;
|
||||
text-transform: uppercase;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.single-product .product_meta > span span,
|
||||
.single-product .product_meta > span a {
|
||||
font-weight: 400;
|
||||
text-transform: none;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.single-product .product_meta > span a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.single-product .entry-summary + .woocommerce-tabs {
|
||||
padding-top: 30px;
|
||||
}
|
||||
.woocommerce #content div.product .woocommerce-tabs ul.tabs li,
|
||||
.woocommerce div.product .woocommerce-tabs ul.tabs li,
|
||||
.woocommerce-page #content div.product .woocommerce-tabs ul.tabs li,
|
||||
.woocommerce-page div.product .woocommerce-tabs ul.tabs li {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.woocommerce-Tabs-panel h2,
|
||||
.single-product .related h2 {
|
||||
font-size: 1.1em;
|
||||
font-family: 'Montserrat';
|
||||
}
|
||||
.single-product .related {
|
||||
border-top: 1px solid #d8d8d8;
|
||||
padding-top: 40px;
|
||||
}
|
||||
.single-product .related h2 {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.woocommerce div.product form.cart .variations td,
|
||||
.woocommerce div.product form.cart .variations th {
|
||||
margin-bottom: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
.woocommerce div.product form.cart .variations td.label {
|
||||
min-width: 30%;
|
||||
}
|
||||
.woocommerce div.product form.cart .variations label {
|
||||
font-size: 0.8em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.woocommerce div.product form.cart .variations select {
|
||||
height: 40px;
|
||||
font-size: 0.8em;
|
||||
font-weight: 400;
|
||||
width: 100%;
|
||||
}
|
||||
.woocommerce div.product form.cart .reset_variations {
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
font-family: 'Montserrat';
|
||||
letter-spacing: 0.8px;
|
||||
}
|
||||
.woocommerce div.product form.cart .reset_variations:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.woocommerce table.shop_attributes th {
|
||||
text-align: left;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.woocommerce table.shop_attributes td {
|
||||
font-weight: 400;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.woocommerce-message {
|
||||
border-top-color: #0aa3f3;
|
||||
}
|
||||
.woocommerce-message::before {
|
||||
color: #0aa3f3;
|
||||
}
|
||||
.woocommerce #content table.cart td.actions .input-text,
|
||||
.woocommerce table.cart td.actions .input-text,
|
||||
.woocommerce-page #content table.cart td.actions .input-text,
|
||||
.woocommerce-page table.cart td.actions .input-text {
|
||||
width: 200px;
|
||||
padding: 0.45em 0.9em;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.woocommerce #respond input#submit.disabled,
|
||||
.woocommerce #respond input#submit:disabled,
|
||||
.woocommerce #respond input#submit:disabled[disabled],
|
||||
.woocommerce a.button.disabled,
|
||||
.woocommerce a.button:disabled,
|
||||
.woocommerce a.button:disabled[disabled],
|
||||
.woocommerce button.button.disabled,
|
||||
.woocommerce button.button:disabled,
|
||||
.woocommerce button.button:disabled[disabled],
|
||||
.woocommerce input.button.disabled,
|
||||
.woocommerce input.button:disabled,
|
||||
.woocommerce input.button:disabled[disabled] {
|
||||
padding: 1.2em 1.9em;
|
||||
color: #fff;
|
||||
}
|
||||
.woocommerce #respond input#submit.disabled:hover,
|
||||
.woocommerce #respond input#submit:disabled:hover,
|
||||
.woocommerce #respond input#submit:disabled[disabled]:hover,
|
||||
.woocommerce a.button.disabled:hover,
|
||||
.woocommerce a.button:disabled:hover,
|
||||
.woocommerce a.button:disabled[disabled]:hover,
|
||||
.woocommerce button.button.disabled:hover,
|
||||
.woocommerce button.button:disabled:hover,
|
||||
.woocommerce button.button:disabled[disabled]:hover,
|
||||
.woocommerce input.button.disabled:hover,
|
||||
.woocommerce input.button:disabled:hover,
|
||||
.woocommerce input.button:disabled[disabled]:hover {
|
||||
background: #0aa3f3;
|
||||
color: #fff;
|
||||
}
|
||||
.woocommerce-cart #primary .post .entry-content table tbody td,
|
||||
.woocommerce-cart #primary .page .entry-content table tbody td,
|
||||
.woocommerce-checkout #primary .page .entry-content table thead th {
|
||||
padding: 0.5em 1em;
|
||||
}
|
||||
.woocommerce-cart #primary .post .entry-content h2,
|
||||
.woocommerce-cart #primary .page .entry-content h2,
|
||||
.woocommerce-checkout #primary .entry-content .woocommerce-billing-fields h3,
|
||||
.woocommerce-checkout #primary .entry-content #order_review_heading {
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.woocommerce-checkout #primary .entry-content #order_review_heading {
|
||||
margin-top: 50px;
|
||||
}
|
||||
.woocommerce-cart form.woocommerce-shipping-calculator p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.woocommerce .wc-proceed-to-checkout a.button {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
.woocommerce-checkout .woocommerce form .form-row label {
|
||||
font-weight: 600;
|
||||
font-size: 0.8em;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.woocommerce form .form-row input.input-text,
|
||||
.woocommerce form .form-row textarea {
|
||||
font-size: 0.8em;
|
||||
font-weight: 400;
|
||||
}
|
||||
.select2-container .select2-selection--single {
|
||||
height: auto;
|
||||
padding: 15px 20px;
|
||||
border-color: #d8d8d8;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
top: 50%;
|
||||
-webkit-transform: translateY(-50%);
|
||||
-moz-transform: translateY(-50%);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.woocommerce-checkout #primary .entry-content .woocommerce-shipping-fields h3 {
|
||||
font-size: 0.8em;
|
||||
font-weight: 500;
|
||||
}
|
||||
.woocommerce-checkout #primary .entry-content .woocommerce-shipping-fields h3 input[type="checkbox"] {
|
||||
vertical-align: middle;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.woocommerce-checkout #primary .page .entry-content ul>li {
|
||||
margin-bottom: 0;
|
||||
padding: 20px 30px;
|
||||
}
|
||||
.woocommerce-account .woocommerce-MyAccount-navigation {
|
||||
border: 1px solid #d8d8d8;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.woocommerce-account #primary .woocommerce-MyAccount-navigation ul {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.woocommerce-account #primary .woocommerce-MyAccount-navigation ul li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.woocommerce-account #primary .woocommerce-MyAccount-navigation ul li:before {
|
||||
display: none;
|
||||
}
|
||||
.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
|
||||
display: inline-block;
|
||||
padding: 15px 20px;
|
||||
border-bottom: 1px solid #d8d8d8;
|
||||
width: 100%;
|
||||
color: #4a4a4a;
|
||||
}
|
||||
.woocommerce-account .woocommerce-MyAccount-navigation ul li:last-child a {
|
||||
border-bottom: none;
|
||||
}
|
||||
.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a,
|
||||
.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover {
|
||||
background: #f5f5f5;
|
||||
color: #0aa3f3;
|
||||
}
|
||||
.woocommerce-account .woocommerce-MyAccount-content {
|
||||
padding-left: 30px;
|
||||
}
|
||||
.woocommerce-account .woocommerce-MyAccount-content a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.woocommerce-account #primary .woocommerce-Address h3 {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.woocommerce-account .addresses .title .edit {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.woocommerce-account .woocommerce button.woocommerce-Button.button {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.widget_products.woocommerce ul.product_list_widget li,
|
||||
.widget_top_rated_products.woocommerce ul.product_list_widget li,
|
||||
.widget_recent_reviews.woocommerce ul.product_list_widget li,
|
||||
.widget_recently_viewed_products.woocommerce ul.product_list_widget li,
|
||||
.woocommerce .widget_rating_filter ul li {
|
||||
padding-bottom: 15px;
|
||||
border-bottom: 1px solid #d8d8d8;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.widget_products.woocommerce ul.product_list_widget li:last-child,
|
||||
.widget_top_rated_products.woocommerce ul.product_list_widget li:last-child,
|
||||
.widget_recent_reviews.woocommerce ul.product_list_widget li:last-child,
|
||||
.widget_recently_viewed_products.woocommerce ul.product_list_widget li:last-child,
|
||||
.woocommerce .widget_rating_filter ul li:last-child {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
.widget_products.woocommerce ul.product_list_widget li span.woocommerce-Price-amount,
|
||||
.widget_top_rated_products.woocommerce ul.product_list_widget li span.woocommerce-Price-amount,
|
||||
.widget_recently_viewed_products.woocommerce ul.product_list_widget li span.woocommerce-Price-amount {
|
||||
font-size: 0.9em;
|
||||
color: #0aa3f3;
|
||||
font-weight: 400;
|
||||
margin-top: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
.widget_products.woocommerce ul.product_list_widget li img,
|
||||
.widget_top_rated_products.woocommerce ul.product_list_widget li img,
|
||||
.widget_recent_reviews.woocommerce ul.product_list_widget li img,
|
||||
.widget_recently_viewed_products.woocommerce ul.product_list_widget li img {
|
||||
width: 80px;
|
||||
}
|
||||
.widget_products.woocommerce ul.product_list_widget li .star-rating,
|
||||
.widget_top_rated_products.woocommerce ul.product_list_widget li .star-rating,
|
||||
.widget_recent_reviews.woocommerce ul.product_list_widget li .star-rating,
|
||||
.widget_recently_viewed_products.woocommerce ul.product_list_widget li .star-rating {
|
||||
color: #0aa3f3;
|
||||
margin-top: 10px;
|
||||
font-size: 0.8em;
|
||||
font-weight: 400;
|
||||
}
|
||||
.widget_recent_reviews.woocommerce ul.product_list_widget li span.reviewer {
|
||||
font-size: 0.8em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0;
|
||||
margin-top: 5px;
|
||||
display: block;
|
||||
font-style: italic;
|
||||
}
|
||||
.woocommerce .widget_rating_filter ul li a {
|
||||
color: #0aa3f3;
|
||||
font-weight: 400;
|
||||
}
|
||||
.woocommerce .widget_price_filter .price_slider_amount {
|
||||
text-align: left;
|
||||
}
|
||||
.woocommerce .widget_price_filter .price_slider_amount input[type="text"] {
|
||||
display: inline-block;
|
||||
width: 48%;
|
||||
vertical-align: middle;
|
||||
margin-right: 3%;
|
||||
}
|
||||
.woocommerce .widget_price_filter .price_slider_amount input[type="text"] + input[type="text"] {
|
||||
margin-right: 0;
|
||||
}
|
||||
.woocommerce .widget_price_filter .price_slider_amount .button {
|
||||
font-size: 0.8em;
|
||||
padding: 1em 1.9em;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.widget_product_search .woocommerce-product-search:before,
|
||||
.widget_product_search .woocommerce-product-search:after {
|
||||
content: "";
|
||||
display: table;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
.widget_product_search .woocommerce-product-search:after {
|
||||
clear: both;
|
||||
}
|
||||
.widget_product_search .woocommerce-product-search {
|
||||
margin-top: 15px;
|
||||
width: 100%;
|
||||
border: 1px solid #d8d8d8;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.widget_product_search .woocommerce-product-search input[type="search"] {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
background: none;
|
||||
float: left;
|
||||
font-size: 0.9em;
|
||||
height: 60px;
|
||||
width: calc(100% - 50px);
|
||||
}
|
||||
.widget_product_search .woocommerce-product-search button[type="submit"] {
|
||||
float: right;
|
||||
font-size: 0;
|
||||
border: 0;
|
||||
border-radius: 0 5px 5px 0;
|
||||
padding: 0;
|
||||
background-image: url(../../images/bg-search.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
width: 50px;
|
||||
height: 60px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.widget_product_search .woocommerce-product-search button[type="submit"]:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
1
Atomaste Reference/public_html/wp-content/themes/rara-business/css/perfect-scrollbar.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.ps__rail-x,.ps__rail-y{display:none;opacity:0;position:absolute}.ps{overflow:hidden!important;overflow-anchor:none;-ms-overflow-style:none;touch-action:auto;-ms-touch-action:auto}.ps__rail-x{transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;height:15px;bottom:0}.ps__rail-y{transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;width:15px;right:0}.ps--active-x>.ps__rail-x,.ps--active-y>.ps__rail-y{display:block;background-color:transparent}.ps--focus>.ps__rail-x,.ps--focus>.ps__rail-y,.ps--scrolling-x>.ps__rail-x,.ps--scrolling-y>.ps__rail-y,.ps:hover>.ps__rail-x,.ps:hover>.ps__rail-y{opacity:.6}.ps .ps__rail-x.ps--clicking,.ps .ps__rail-x:focus,.ps .ps__rail-x:hover,.ps .ps__rail-y.ps--clicking,.ps .ps__rail-y:focus,.ps .ps__rail-y:hover{background-color:#eee;opacity:.9}.ps__thumb-x,.ps__thumb-y{background-color:#aaa;border-radius:6px;position:absolute}.ps__thumb-x{transition:background-color .2s linear,height .2s ease-in-out;-webkit-transition:background-color .2s linear,height .2s ease-in-out;height:6px;bottom:2px}.ps__thumb-y{transition:background-color .2s linear,width .2s ease-in-out;-webkit-transition:background-color .2s linear,width .2s ease-in-out;width:6px;right:2px}.ps__rail-x.ps--clicking .ps__thumb-x,.ps__rail-x:focus>.ps__thumb-x,.ps__rail-x:hover>.ps__thumb-x{background-color:#999;height:11px}.ps__rail-y.ps--clicking .ps__thumb-y,.ps__rail-y:focus>.ps__thumb-y,.ps__rail-y:hover>.ps__thumb-y{background-color:#999;width:11px}@supports (-ms-overflow-style:none){.ps{overflow:auto!important}}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){.ps{overflow:auto!important}}
|
||||
1
Atomaste Reference/public_html/wp-content/themes/rara-business/css/woocommerce-style.min.css
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the footer
|
||||
*
|
||||
* Contains the closing of the #content div and all content after.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
/**
|
||||
* After Content
|
||||
*
|
||||
* @hooked rara_business_content_end - 20
|
||||
*/
|
||||
do_action( 'rara_business_before_footer' );
|
||||
|
||||
/**
|
||||
* Footer
|
||||
*
|
||||
* @hooked rara_business_footer_start - 20
|
||||
* @hooked rara_business_footer_top - 30
|
||||
* @hooked rara_business_footer_bottom - 40
|
||||
* @hooked rara_business_footer_end - 50
|
||||
*/
|
||||
do_action( 'rara_business_footer' );
|
||||
|
||||
/**
|
||||
* After Footer
|
||||
*
|
||||
* @hooked rara_business_page_end - 20
|
||||
*/
|
||||
do_action( 'rara_business_after_footer' );
|
||||
|
||||
wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Front Page
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
$home_sections = rara_business_get_home_sections();
|
||||
|
||||
if ( 'posts' == get_option( 'show_on_front' ) ) { //Show Static Blog Page
|
||||
include( get_home_template() );
|
||||
}elseif( $home_sections ){
|
||||
get_header();
|
||||
//If any one section are enabled then show custom home page.
|
||||
foreach( $home_sections as $section ){
|
||||
get_template_part( 'sections/' . esc_attr( $section ) );
|
||||
}
|
||||
get_footer();
|
||||
}else {
|
||||
//If all section are disabled then show respective page template.
|
||||
include( get_page_template() );
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business functions
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
$rara_business_theme_data = wp_get_theme();
|
||||
if( ! defined( 'RARA_BUSINESS_THEME_VERSION' ) ) define( 'RARA_BUSINESS_THEME_VERSION', $rara_business_theme_data->get( 'Version' ) );
|
||||
if( ! defined( 'RARA_BUSINESS_THEME_NAME' ) ) define( 'RARA_BUSINESS_THEME_NAME', $rara_business_theme_data->get( 'Name' ) );
|
||||
if( ! defined( 'RARA_BUSINESS_THEME_TEXTDOMAIN' ) ) define( 'RARA_BUSINESS_THEME_TEXTDOMAIN', $rara_business_theme_data->get( 'TextDomain' ) );
|
||||
|
||||
/**
|
||||
* Implement Local Font Method Functions.
|
||||
*/
|
||||
require get_template_directory() . '/inc/class-webfont-loader.php';
|
||||
|
||||
/**
|
||||
* Implement the Custom Functions
|
||||
*/
|
||||
require get_template_directory() . '/inc/custom-functions.php';
|
||||
|
||||
/**
|
||||
* Custom independent extra functions for this theme.
|
||||
*/
|
||||
require get_template_directory() . '/inc/extras.php';
|
||||
|
||||
/**
|
||||
* Functions which enhance the theme by hooking into WordPress.
|
||||
*/
|
||||
require get_template_directory() . '/inc/template-functions.php';
|
||||
|
||||
if( rara_business_is_rara_theme_companion_activated() ) :
|
||||
/**
|
||||
* Modify filter hooks of RTC plugin.
|
||||
*/
|
||||
require get_template_directory() . '/inc/rtc-filters.php';
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Fontawesome
|
||||
*/
|
||||
require get_template_directory() . '/inc/fontawesome.php';
|
||||
|
||||
/**
|
||||
* Customizer Custom controls.
|
||||
*/
|
||||
require get_template_directory() . '/inc/custom-controls/custom-control.php';
|
||||
|
||||
/**
|
||||
* Load Sanitization functions.
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer/sanitization-functions.php';
|
||||
|
||||
/**
|
||||
* Customizer default theme options.
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer/default-theme-options.php';
|
||||
|
||||
/**
|
||||
* Customizer selective refresh.
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer/selective-refresh.php';
|
||||
|
||||
/**
|
||||
* Customizer additions.
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer/customizer.php';
|
||||
|
||||
/**
|
||||
* Metabox additions.
|
||||
*/
|
||||
require get_template_directory() . '/inc/metabox.php';
|
||||
|
||||
/**
|
||||
* Widgets addition.
|
||||
*/
|
||||
require get_template_directory() . '/inc/widgets.php';
|
||||
|
||||
/**
|
||||
* TGMPA Plugin Recommendation
|
||||
*/
|
||||
require get_template_directory() . '/inc/tgmpa/recommended-plugins.php';
|
||||
|
||||
/**
|
||||
* Getting Started
|
||||
*/
|
||||
require get_template_directory() . '/inc/dashboard/dashboard.php';
|
||||
|
||||
|
||||
if ( rara_business_is_woocommerce_activated() ) :
|
||||
/**
|
||||
* Load woocommerce
|
||||
*/
|
||||
require get_template_directory() . '/inc/woocommerce-functions.php';
|
||||
endif;
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* The header for our theme
|
||||
*
|
||||
* This is the template that displays all of the <head> section and everything up until <div id="content">
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
/**
|
||||
* Doctype Hook
|
||||
*
|
||||
* @hooked rara_business_doctype
|
||||
*/
|
||||
do_action( 'rara_business_doctype' );
|
||||
?>
|
||||
<head itemscope itemtype="https://schema.org/WebSite">
|
||||
<?php
|
||||
/**
|
||||
* Before wp_head
|
||||
*
|
||||
* @hooked rara_business_head
|
||||
*/
|
||||
do_action( 'rara_business_before_wp_head' );
|
||||
|
||||
wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?> itemscope itemtype="https://schema.org/WebPage">
|
||||
<?php wp_body_open(); ?>
|
||||
<?php
|
||||
/**
|
||||
* Before Header
|
||||
*
|
||||
* @hooked rara_business_page_start - 20
|
||||
*/
|
||||
do_action( 'rara_business_before_header' );
|
||||
|
||||
/**
|
||||
* Header
|
||||
*
|
||||
* @hooked rara_business_header - 20
|
||||
*/
|
||||
do_action( 'rara_business_header' );
|
||||
|
||||
/**
|
||||
* Before Content
|
||||
*
|
||||
* @hooked rara_business_banner - 15
|
||||
*/
|
||||
do_action( 'rara_business_after_header' );
|
||||
|
||||
/**
|
||||
* Content
|
||||
*
|
||||
* @hooked rara_business_content_start
|
||||
*/
|
||||
do_action( 'rara_business_content' );
|
||||
|
After Width: | Height: | Size: 280 KiB |
|
After Width: | Height: | Size: 285 B |
|
After Width: | Height: | Size: 207 B |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="16" height="13" viewBox="0 0 16 13">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
fill: #fff;
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path d="M15.992,10.889 C15.992,12.051 15.043,12.997 13.876,12.997 L2.116,12.997 C0.949,12.997 -0.000,12.051 -0.000,10.889 L-0.000,2.105 C-0.000,2.102 0.000,2.099 0.000,2.098 C0.000,2.094 0.000,2.091 0.000,2.088 C0.010,0.933 0.955,-0.004 2.116,-0.004 L13.876,-0.004 C15.037,-0.004 15.982,0.933 15.991,2.088 C15.992,2.091 15.992,2.094 15.992,2.098 C15.992,2.099 15.992,2.102 15.992,2.105 L15.992,10.889 ZM2.116,11.710 L13.876,11.710 C14.330,11.710 14.700,11.343 14.700,10.889 L14.700,3.340 L8.366,7.757 C8.255,7.833 8.126,7.872 7.996,7.872 C7.866,7.872 7.737,7.833 7.625,7.757 L1.292,3.339 L1.292,10.889 C1.292,11.343 1.662,11.710 2.116,11.710 ZM13.876,1.285 L2.116,1.285 C1.766,1.285 1.468,1.503 1.348,1.808 L7.996,6.444 L14.644,1.808 C14.524,1.503 14.226,1.285 13.876,1.285 Z" class="cls-1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 564 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 500 B |
@@ -0,0 +1,148 @@
|
||||
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<symbol id="icon-behance" viewBox="0 0 37 32">
|
||||
<path class="path1" d="M33 6.054h-9.125v2.214h9.125v-2.214zM28.5 13.661q-1.607 0-2.607 0.938t-1.107 2.545h7.286q-0.321-3.482-3.571-3.482zM28.786 24.107q1.125 0 2.179-0.571t1.357-1.554h3.946q-1.786 5.482-7.625 5.482-3.821 0-6.080-2.357t-2.259-6.196q0-3.714 2.33-6.17t6.009-2.455q2.464 0 4.295 1.214t2.732 3.196 0.902 4.429q0 0.304-0.036 0.839h-11.75q0 1.982 1.027 3.063t2.973 1.080zM4.946 23.214h5.286q3.661 0 3.661-2.982 0-3.214-3.554-3.214h-5.393v6.196zM4.946 13.625h5.018q1.393 0 2.205-0.652t0.813-2.027q0-2.571-3.393-2.571h-4.643v5.25zM0 4.536h10.607q1.554 0 2.768 0.25t2.259 0.848 1.607 1.723 0.563 2.75q0 3.232-3.071 4.696 2.036 0.571 3.071 2.054t1.036 3.643q0 1.339-0.438 2.438t-1.179 1.848-1.759 1.268-2.161 0.75-2.393 0.232h-10.911v-22.5z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-deviantart" viewBox="0 0 18 32">
|
||||
<path class="path1" d="M18.286 5.411l-5.411 10.393 0.429 0.554h4.982v7.411h-9.054l-0.786 0.536-2.536 4.875-0.536 0.536h-5.375v-5.411l5.411-10.411-0.429-0.536h-4.982v-7.411h9.054l0.786-0.536 2.536-4.875 0.536-0.536h5.375v5.411z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-medium" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M10.661 7.518v20.946q0 0.446-0.223 0.759t-0.652 0.313q-0.304 0-0.589-0.143l-8.304-4.161q-0.375-0.179-0.634-0.598t-0.259-0.83v-20.357q0-0.357 0.179-0.607t0.518-0.25q0.25 0 0.786 0.268l9.125 4.571q0.054 0.054 0.054 0.089zM11.804 9.321l9.536 15.464-9.536-4.75v-10.714zM32 9.643v18.821q0 0.446-0.25 0.723t-0.679 0.277-0.839-0.232l-7.875-3.929zM31.946 7.5q0 0.054-4.58 7.491t-5.366 8.705l-6.964-11.321 5.786-9.411q0.304-0.5 0.929-0.5 0.25 0 0.464 0.107l9.661 4.821q0.071 0.036 0.071 0.107z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-slideshare" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M15.589 13.214q0 1.482-1.134 2.545t-2.723 1.063-2.723-1.063-1.134-2.545q0-1.5 1.134-2.554t2.723-1.054 2.723 1.054 1.134 2.554zM24.554 13.214q0 1.482-1.125 2.545t-2.732 1.063q-1.589 0-2.723-1.063t-1.134-2.545q0-1.5 1.134-2.554t2.723-1.054q1.607 0 2.732 1.054t1.125 2.554zM28.571 16.429v-11.911q0-1.554-0.571-2.205t-1.982-0.652h-19.857q-1.482 0-2.009 0.607t-0.527 2.25v12.018q0.768 0.411 1.58 0.714t1.446 0.5 1.446 0.33 1.268 0.196 1.25 0.071 1.045 0.009 1.009-0.036 0.795-0.036q1.214-0.018 1.696 0.482 0.107 0.107 0.179 0.161 0.464 0.446 1.089 0.911 0.125-1.625 2.107-1.554 0.089 0 0.652 0.027t0.768 0.036 0.813 0.018 0.946-0.018 0.973-0.080 1.089-0.152 1.107-0.241 1.196-0.348 1.205-0.482 1.286-0.616zM31.482 16.339q-2.161 2.661-6.643 4.5 1.5 5.089-0.411 8.304-1.179 2.018-3.268 2.643-1.857 0.571-3.25-0.268-1.536-0.911-1.464-2.929l-0.018-5.821v-0.018q-0.143-0.036-0.438-0.107t-0.42-0.089l-0.018 6.036q0.071 2.036-1.482 2.929-1.411 0.839-3.268 0.268-2.089-0.643-3.25-2.679-1.875-3.214-0.393-8.268-4.482-1.839-6.643-4.5-0.446-0.661-0.071-1.125t1.071 0.018q0.054 0.036 0.196 0.125t0.196 0.143v-12.393q0-1.286 0.839-2.196t2.036-0.911h22.446q1.196 0 2.036 0.911t0.839 2.196v12.393l0.375-0.268q0.696-0.482 1.071-0.018t-0.071 1.125z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-snapchat-ghost" viewBox="0 0 30 32">
|
||||
<path class="path1" d="M15.143 2.286q2.393-0.018 4.295 1.223t2.92 3.438q0.482 1.036 0.482 3.196 0 0.839-0.161 3.411 0.25 0.125 0.5 0.125 0.321 0 0.911-0.241t0.911-0.241q0.518 0 1 0.321t0.482 0.821q0 0.571-0.563 0.964t-1.232 0.563-1.232 0.518-0.563 0.848q0 0.268 0.214 0.768 0.661 1.464 1.83 2.679t2.58 1.804q0.5 0.214 1.429 0.411 0.5 0.107 0.5 0.625 0 1.25-3.911 1.839-0.125 0.196-0.196 0.696t-0.25 0.83-0.589 0.33q-0.357 0-1.107-0.116t-1.143-0.116q-0.661 0-1.107 0.089-0.571 0.089-1.125 0.402t-1.036 0.679-1.036 0.723-1.357 0.598-1.768 0.241q-0.929 0-1.723-0.241t-1.339-0.598-1.027-0.723-1.036-0.679-1.107-0.402q-0.464-0.089-1.125-0.089-0.429 0-1.17 0.134t-1.045 0.134q-0.446 0-0.625-0.33t-0.25-0.848-0.196-0.714q-3.911-0.589-3.911-1.839 0-0.518 0.5-0.625 0.929-0.196 1.429-0.411 1.393-0.571 2.58-1.804t1.83-2.679q0.214-0.5 0.214-0.768 0-0.5-0.563-0.848t-1.241-0.527-1.241-0.563-0.563-0.938q0-0.482 0.464-0.813t0.982-0.33q0.268 0 0.857 0.232t0.946 0.232q0.321 0 0.571-0.125-0.161-2.536-0.161-3.393 0-2.179 0.482-3.214 1.143-2.446 3.071-3.536t4.714-1.125z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-yelp" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M13.804 23.554v2.268q-0.018 5.214-0.107 5.446-0.214 0.571-0.911 0.714-0.964 0.161-3.241-0.679t-2.902-1.589q-0.232-0.268-0.304-0.643-0.018-0.214 0.071-0.464 0.071-0.179 0.607-0.839t3.232-3.857q0.018 0 1.071-1.25 0.268-0.339 0.705-0.438t0.884 0.063q0.429 0.179 0.67 0.518t0.223 0.75zM11.143 19.071q-0.054 0.982-0.929 1.25l-2.143 0.696q-4.911 1.571-5.214 1.571-0.625-0.036-0.964-0.643-0.214-0.446-0.304-1.339-0.143-1.357 0.018-2.973t0.536-2.223 1-0.571q0.232 0 3.607 1.375 1.25 0.518 2.054 0.839l1.5 0.607q0.411 0.161 0.634 0.545t0.205 0.866zM25.893 24.375q-0.125 0.964-1.634 2.875t-2.42 2.268q-0.661 0.25-1.125-0.125-0.25-0.179-3.286-5.125l-0.839-1.375q-0.25-0.375-0.205-0.821t0.348-0.821q0.625-0.768 1.482-0.464 0.018 0.018 2.125 0.714 3.625 1.179 4.321 1.42t0.839 0.366q0.5 0.393 0.393 1.089zM13.893 13.089q0.089 1.821-0.964 2.179-1.036 0.304-2.036-1.268l-6.75-10.679q-0.143-0.625 0.339-1.107 0.732-0.768 3.705-1.598t4.009-0.563q0.714 0.179 0.875 0.804 0.054 0.321 0.393 5.455t0.429 6.777zM25.714 15.018q0.054 0.696-0.464 1.054-0.268 0.179-5.875 1.536-1.196 0.268-1.625 0.411l0.018-0.036q-0.411 0.107-0.821-0.071t-0.661-0.571q-0.536-0.839 0-1.554 0.018-0.018 1.339-1.821 2.232-3.054 2.679-3.643t0.607-0.696q0.5-0.339 1.161-0.036 0.857 0.411 2.196 2.384t1.446 2.991v0.054z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-vine" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M26.732 14.768v3.536q-1.804 0.411-3.536 0.411-1.161 2.429-2.955 4.839t-3.241 3.848-2.286 1.902q-1.429 0.804-2.893-0.054-0.5-0.304-1.080-0.777t-1.518-1.491-1.83-2.295-1.92-3.286-1.884-4.357-1.634-5.616-1.259-6.964h5.054q0.464 3.893 1.25 7.116t1.866 5.661 2.17 4.205 2.5 3.482q3.018-3.018 5.125-7.25-2.536-1.286-3.982-3.929t-1.446-5.946q0-3.429 1.857-5.616t5.071-2.188q3.179 0 4.875 1.884t1.696 5.313q0 2.839-1.036 5.107-0.125 0.018-0.348 0.054t-0.821 0.036-1.125-0.107-1.107-0.455-0.902-0.92q0.554-1.839 0.554-3.286 0-1.554-0.518-2.357t-1.411-0.804q-0.946 0-1.518 0.884t-0.571 2.509q0 3.321 1.875 5.241t4.768 1.92q1.107 0 2.161-0.25z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-vk" viewBox="0 0 35 32">
|
||||
<path class="path1" d="M34.232 9.286q0.411 1.143-2.679 5.25-0.429 0.571-1.161 1.518-1.393 1.786-1.607 2.339-0.304 0.732 0.25 1.446 0.304 0.375 1.446 1.464h0.018l0.071 0.071q2.518 2.339 3.411 3.946 0.054 0.089 0.116 0.223t0.125 0.473-0.009 0.607-0.446 0.491-1.054 0.223l-4.571 0.071q-0.429 0.089-1-0.089t-0.929-0.393l-0.357-0.214q-0.536-0.375-1.25-1.143t-1.223-1.384-1.089-1.036-1.009-0.277q-0.054 0.018-0.143 0.063t-0.304 0.259-0.384 0.527-0.304 0.929-0.116 1.384q0 0.268-0.063 0.491t-0.134 0.33l-0.071 0.089q-0.321 0.339-0.946 0.393h-2.054q-1.268 0.071-2.607-0.295t-2.348-0.946-1.839-1.179-1.259-1.027l-0.446-0.429q-0.179-0.179-0.491-0.536t-1.277-1.625-1.893-2.696-2.188-3.768-2.33-4.857q-0.107-0.286-0.107-0.482t0.054-0.286l0.071-0.107q0.268-0.339 1.018-0.339l4.893-0.036q0.214 0.036 0.411 0.116t0.286 0.152l0.089 0.054q0.286 0.196 0.429 0.571 0.357 0.893 0.821 1.848t0.732 1.455l0.286 0.518q0.518 1.071 1 1.857t0.866 1.223 0.741 0.688 0.607 0.25 0.482-0.089q0.036-0.018 0.089-0.089t0.214-0.393 0.241-0.839 0.17-1.446 0-2.232q-0.036-0.714-0.161-1.304t-0.25-0.821l-0.107-0.214q-0.446-0.607-1.518-0.768-0.232-0.036 0.089-0.429 0.304-0.339 0.679-0.536 0.946-0.464 4.268-0.429 1.464 0.018 2.411 0.232 0.357 0.089 0.598 0.241t0.366 0.429 0.188 0.571 0.063 0.813-0.018 0.982-0.045 1.259-0.027 1.473q0 0.196-0.018 0.75t-0.009 0.857 0.063 0.723 0.205 0.696 0.402 0.438q0.143 0.036 0.304 0.071t0.464-0.196 0.679-0.616 0.929-1.196 1.214-1.92q1.071-1.857 1.911-4.018 0.071-0.179 0.179-0.313t0.196-0.188l0.071-0.054 0.089-0.045t0.232-0.054 0.357-0.009l5.143-0.036q0.696-0.089 1.143 0.045t0.554 0.295z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-search" viewBox="0 0 30 32">
|
||||
<path class="path1" d="M20.571 14.857q0-3.304-2.348-5.652t-5.652-2.348-5.652 2.348-2.348 5.652 2.348 5.652 5.652 2.348 5.652-2.348 2.348-5.652zM29.714 29.714q0 0.929-0.679 1.607t-1.607 0.679q-0.964 0-1.607-0.679l-6.125-6.107q-3.196 2.214-7.125 2.214-2.554 0-4.884-0.991t-4.018-2.679-2.679-4.018-0.991-4.884 0.991-4.884 2.679-4.018 4.018-2.679 4.884-0.991 4.884 0.991 4.018 2.679 2.679 4.018 0.991 4.884q0 3.929-2.214 7.125l6.125 6.125q0.661 0.661 0.661 1.607z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-envelope-o" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M29.714 26.857v-13.714q-0.571 0.643-1.232 1.179-4.786 3.679-7.607 6.036-0.911 0.768-1.482 1.196t-1.545 0.866-1.83 0.438h-0.036q-0.857 0-1.83-0.438t-1.545-0.866-1.482-1.196q-2.821-2.357-7.607-6.036-0.661-0.536-1.232-1.179v13.714q0 0.232 0.17 0.402t0.402 0.17h26.286q0.232 0 0.402-0.17t0.17-0.402zM29.714 8.089v-0.438t-0.009-0.232-0.054-0.223-0.098-0.161-0.161-0.134-0.25-0.045h-26.286q-0.232 0-0.402 0.17t-0.17 0.402q0 3 2.625 5.071 3.446 2.714 7.161 5.661 0.107 0.089 0.625 0.527t0.821 0.67 0.795 0.563 0.902 0.491 0.768 0.161h0.036q0.357 0 0.768-0.161t0.902-0.491 0.795-0.563 0.821-0.67 0.625-0.527q3.714-2.946 7.161-5.661 0.964-0.768 1.795-2.063t0.83-2.348zM32 7.429v19.429q0 1.179-0.839 2.018t-2.018 0.839h-26.286q-1.179 0-2.018-0.839t-0.839-2.018v-19.429q0-1.179 0.839-2.018t2.018-0.839h26.286q1.179 0 2.018 0.839t0.839 2.018z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-close" viewBox="0 0 25 32">
|
||||
<path class="path1" d="M23.179 23.607q0 0.714-0.5 1.214l-2.429 2.429q-0.5 0.5-1.214 0.5t-1.214-0.5l-5.25-5.25-5.25 5.25q-0.5 0.5-1.214 0.5t-1.214-0.5l-2.429-2.429q-0.5-0.5-0.5-1.214t0.5-1.214l5.25-5.25-5.25-5.25q-0.5-0.5-0.5-1.214t0.5-1.214l2.429-2.429q0.5-0.5 1.214-0.5t1.214 0.5l5.25 5.25 5.25-5.25q0.5-0.5 1.214-0.5t1.214 0.5l2.429 2.429q0.5 0.5 0.5 1.214t-0.5 1.214l-5.25 5.25 5.25 5.25q0.5 0.5 0.5 1.214z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-angle-down" viewBox="0 0 21 32">
|
||||
<path class="path1" d="M19.196 13.143q0 0.232-0.179 0.411l-8.321 8.321q-0.179 0.179-0.411 0.179t-0.411-0.179l-8.321-8.321q-0.179-0.179-0.179-0.411t0.179-0.411l0.893-0.893q0.179-0.179 0.411-0.179t0.411 0.179l7.018 7.018 7.018-7.018q0.179-0.179 0.411-0.179t0.411 0.179l0.893 0.893q0.179 0.179 0.179 0.411z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-folder-open" viewBox="0 0 34 32">
|
||||
<path class="path1" d="M33.554 17q0 0.554-0.554 1.179l-6 7.071q-0.768 0.911-2.152 1.545t-2.563 0.634h-19.429q-0.607 0-1.080-0.232t-0.473-0.768q0-0.554 0.554-1.179l6-7.071q0.768-0.911 2.152-1.545t2.563-0.634h19.429q0.607 0 1.080 0.232t0.473 0.768zM27.429 10.857v2.857h-14.857q-1.679 0-3.518 0.848t-2.929 2.134l-6.107 7.179q0-0.071-0.009-0.223t-0.009-0.223v-17.143q0-1.643 1.179-2.821t2.821-1.179h5.714q1.643 0 2.821 1.179t1.179 2.821v0.571h9.714q1.643 0 2.821 1.179t1.179 2.821z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-twitter" viewBox="0 0 30 32">
|
||||
<path class="path1" d="M28.929 7.286q-1.196 1.75-2.893 2.982 0.018 0.25 0.018 0.75 0 2.321-0.679 4.634t-2.063 4.437-3.295 3.759-4.607 2.607-5.768 0.973q-4.839 0-8.857-2.589 0.625 0.071 1.393 0.071 4.018 0 7.161-2.464-1.875-0.036-3.357-1.152t-2.036-2.848q0.589 0.089 1.089 0.089 0.768 0 1.518-0.196-2-0.411-3.313-1.991t-1.313-3.67v-0.071q1.214 0.679 2.607 0.732-1.179-0.786-1.875-2.054t-0.696-2.75q0-1.571 0.786-2.911 2.161 2.661 5.259 4.259t6.634 1.777q-0.143-0.679-0.143-1.321 0-2.393 1.688-4.080t4.080-1.688q2.5 0 4.214 1.821 1.946-0.375 3.661-1.393-0.661 2.054-2.536 3.179 1.661-0.179 3.321-0.893z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-facebook" viewBox="0 0 19 32">
|
||||
<path class="path1" d="M17.125 0.214v4.714h-2.804q-1.536 0-2.071 0.643t-0.536 1.929v3.375h5.232l-0.696 5.286h-4.536v13.554h-5.464v-13.554h-4.554v-5.286h4.554v-3.893q0-3.321 1.857-5.152t4.946-1.83q2.625 0 4.071 0.214z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-github" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M13.714 2.286q3.732 0 6.884 1.839t4.991 4.991 1.839 6.884q0 4.482-2.616 8.063t-6.759 4.955q-0.482 0.089-0.714-0.125t-0.232-0.536q0-0.054 0.009-1.366t0.009-2.402q0-1.732-0.929-2.536 1.018-0.107 1.83-0.321t1.679-0.696 1.446-1.188 0.946-1.875 0.366-2.688q0-2.125-1.411-3.679 0.661-1.625-0.143-3.643-0.5-0.161-1.446 0.196t-1.643 0.786l-0.679 0.429q-1.661-0.464-3.429-0.464t-3.429 0.464q-0.286-0.196-0.759-0.482t-1.491-0.688-1.518-0.241q-0.804 2.018-0.143 3.643-1.411 1.554-1.411 3.679 0 1.518 0.366 2.679t0.938 1.875 1.438 1.196 1.679 0.696 1.83 0.321q-0.696 0.643-0.875 1.839-0.375 0.179-0.804 0.268t-1.018 0.089-1.17-0.384-0.991-1.116q-0.339-0.571-0.866-0.929t-0.884-0.429l-0.357-0.054q-0.375 0-0.518 0.080t-0.089 0.205 0.161 0.25 0.232 0.214l0.125 0.089q0.393 0.179 0.777 0.679t0.563 0.911l0.179 0.411q0.232 0.679 0.786 1.098t1.196 0.536 1.241 0.125 0.991-0.063l0.411-0.071q0 0.679 0.009 1.58t0.009 0.973q0 0.321-0.232 0.536t-0.714 0.125q-4.143-1.375-6.759-4.955t-2.616-8.063q0-3.732 1.839-6.884t4.991-4.991 6.884-1.839zM5.196 21.982q0.054-0.125-0.125-0.214-0.179-0.054-0.232 0.036-0.054 0.125 0.125 0.214 0.161 0.107 0.232-0.036zM5.75 22.589q0.125-0.089-0.036-0.286-0.179-0.161-0.286-0.054-0.125 0.089 0.036 0.286 0.179 0.179 0.286 0.054zM6.286 23.393q0.161-0.125 0-0.339-0.143-0.232-0.304-0.107-0.161 0.089 0 0.321t0.304 0.125zM7.036 24.143q0.143-0.143-0.071-0.339-0.214-0.214-0.357-0.054-0.161 0.143 0.071 0.339 0.214 0.214 0.357 0.054zM8.054 24.589q0.054-0.196-0.232-0.286-0.268-0.071-0.339 0.125t0.232 0.268q0.268 0.107 0.339-0.107zM9.179 24.679q0-0.232-0.304-0.196-0.286 0-0.286 0.196 0 0.232 0.304 0.196 0.286 0 0.286-0.196zM10.214 24.5q-0.036-0.196-0.321-0.161-0.286 0.054-0.25 0.268t0.321 0.143 0.25-0.25z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-bars" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M27.429 24v2.286q0 0.464-0.339 0.804t-0.804 0.339h-25.143q-0.464 0-0.804-0.339t-0.339-0.804v-2.286q0-0.464 0.339-0.804t0.804-0.339h25.143q0.464 0 0.804 0.339t0.339 0.804zM27.429 14.857v2.286q0 0.464-0.339 0.804t-0.804 0.339h-25.143q-0.464 0-0.804-0.339t-0.339-0.804v-2.286q0-0.464 0.339-0.804t0.804-0.339h25.143q0.464 0 0.804 0.339t0.339 0.804zM27.429 5.714v2.286q0 0.464-0.339 0.804t-0.804 0.339h-25.143q-0.464 0-0.804-0.339t-0.339-0.804v-2.286q0-0.464 0.339-0.804t0.804-0.339h25.143q0.464 0 0.804 0.339t0.339 0.804z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-google-plus" viewBox="0 0 41 32">
|
||||
<path class="path1" d="M25.661 16.304q0 3.714-1.554 6.616t-4.429 4.536-6.589 1.634q-2.661 0-5.089-1.036t-4.179-2.786-2.786-4.179-1.036-5.089 1.036-5.089 2.786-4.179 4.179-2.786 5.089-1.036q5.107 0 8.768 3.429l-3.554 3.411q-2.089-2.018-5.214-2.018-2.196 0-4.063 1.107t-2.955 3.009-1.089 4.152 1.089 4.152 2.955 3.009 4.063 1.107q1.482 0 2.723-0.411t2.045-1.027 1.402-1.402 0.875-1.482 0.384-1.321h-7.429v-4.5h12.357q0.214 1.125 0.214 2.179zM41.143 14.125v3.75h-3.732v3.732h-3.75v-3.732h-3.732v-3.75h3.732v-3.732h3.75v3.732h3.732z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-linkedin" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M6.232 11.161v17.696h-5.893v-17.696h5.893zM6.607 5.696q0.018 1.304-0.902 2.179t-2.42 0.875h-0.036q-1.464 0-2.357-0.875t-0.893-2.179q0-1.321 0.92-2.188t2.402-0.866 2.375 0.866 0.911 2.188zM27.429 18.714v10.143h-5.875v-9.464q0-1.875-0.723-2.938t-2.259-1.063q-1.125 0-1.884 0.616t-1.134 1.527q-0.196 0.536-0.196 1.446v9.875h-5.875q0.036-7.125 0.036-11.554t-0.018-5.286l-0.018-0.857h5.875v2.571h-0.036q0.357-0.571 0.732-1t1.009-0.929 1.554-0.777 2.045-0.277q3.054 0 4.911 2.027t1.857 5.938z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-quote-right" viewBox="0 0 30 32">
|
||||
<path class="path1" d="M13.714 5.714v12.571q0 1.857-0.723 3.545t-1.955 2.92-2.92 1.955-3.545 0.723h-1.143q-0.464 0-0.804-0.339t-0.339-0.804v-2.286q0-0.464 0.339-0.804t0.804-0.339h1.143q1.893 0 3.232-1.339t1.339-3.232v-0.571q0-0.714-0.5-1.214t-1.214-0.5h-4q-1.429 0-2.429-1t-1-2.429v-6.857q0-1.429 1-2.429t2.429-1h6.857q1.429 0 2.429 1t1 2.429zM29.714 5.714v12.571q0 1.857-0.723 3.545t-1.955 2.92-2.92 1.955-3.545 0.723h-1.143q-0.464 0-0.804-0.339t-0.339-0.804v-2.286q0-0.464 0.339-0.804t0.804-0.339h1.143q1.893 0 3.232-1.339t1.339-3.232v-0.571q0-0.714-0.5-1.214t-1.214-0.5h-4q-1.429 0-2.429-1t-1-2.429v-6.857q0-1.429 1-2.429t2.429-1h6.857q1.429 0 2.429 1t1 2.429z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-mail-reply" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M32 20q0 2.964-2.268 8.054-0.054 0.125-0.188 0.429t-0.241 0.536-0.232 0.393q-0.214 0.304-0.5 0.304-0.268 0-0.42-0.179t-0.152-0.446q0-0.161 0.045-0.473t0.045-0.42q0.089-1.214 0.089-2.196 0-1.804-0.313-3.232t-0.866-2.473-1.429-1.804-1.884-1.241-2.375-0.759-2.75-0.384-3.134-0.107h-4v4.571q0 0.464-0.339 0.804t-0.804 0.339-0.804-0.339l-9.143-9.143q-0.339-0.339-0.339-0.804t0.339-0.804l9.143-9.143q0.339-0.339 0.804-0.339t0.804 0.339 0.339 0.804v4.571h4q12.732 0 15.625 7.196 0.946 2.393 0.946 5.946z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-youtube" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M17.339 22.214v3.768q0 1.196-0.696 1.196-0.411 0-0.804-0.393v-5.375q0.393-0.393 0.804-0.393 0.696 0 0.696 1.196zM23.375 22.232v0.821h-1.607v-0.821q0-1.214 0.804-1.214t0.804 1.214zM6.125 18.339h1.911v-1.679h-5.571v1.679h1.875v10.161h1.786v-10.161zM11.268 28.5h1.589v-8.821h-1.589v6.75q-0.536 0.75-1.018 0.75-0.321 0-0.375-0.375-0.018-0.054-0.018-0.625v-6.5h-1.589v6.982q0 0.875 0.143 1.304 0.214 0.661 1.036 0.661 0.857 0 1.821-1.089v0.964zM18.929 25.857v-3.518q0-1.304-0.161-1.768-0.304-1-1.268-1-0.893 0-1.661 0.964v-3.875h-1.589v11.839h1.589v-0.857q0.804 0.982 1.661 0.982 0.964 0 1.268-0.982 0.161-0.482 0.161-1.786zM24.964 25.679v-0.232h-1.625q0 0.911-0.036 1.089-0.125 0.643-0.714 0.643-0.821 0-0.821-1.232v-1.554h3.196v-1.839q0-1.411-0.482-2.071-0.696-0.911-1.893-0.911-1.214 0-1.911 0.911-0.5 0.661-0.5 2.071v3.089q0 1.411 0.518 2.071 0.696 0.911 1.929 0.911 1.286 0 1.929-0.946 0.321-0.482 0.375-0.964 0.036-0.161 0.036-1.036zM14.107 9.375v-3.75q0-1.232-0.768-1.232t-0.768 1.232v3.75q0 1.25 0.768 1.25t0.768-1.25zM26.946 22.786q0 4.179-0.464 6.25-0.25 1.054-1.036 1.768t-1.821 0.821q-3.286 0.375-9.911 0.375t-9.911-0.375q-1.036-0.107-1.83-0.821t-1.027-1.768q-0.464-2-0.464-6.25 0-4.179 0.464-6.25 0.25-1.054 1.036-1.768t1.839-0.839q3.268-0.357 9.893-0.357t9.911 0.357q1.036 0.125 1.83 0.839t1.027 1.768q0.464 2 0.464 6.25zM9.125 0h1.821l-2.161 7.125v4.839h-1.786v-4.839q-0.25-1.321-1.089-3.786-0.661-1.839-1.161-3.339h1.893l1.268 4.696zM15.732 5.946v3.125q0 1.446-0.5 2.107-0.661 0.911-1.893 0.911-1.196 0-1.875-0.911-0.5-0.679-0.5-2.107v-3.125q0-1.429 0.5-2.089 0.679-0.911 1.875-0.911 1.232 0 1.893 0.911 0.5 0.661 0.5 2.089zM21.714 3.054v8.911h-1.625v-0.982q-0.946 1.107-1.839 1.107-0.821 0-1.054-0.661-0.143-0.429-0.143-1.339v-7.036h1.625v6.554q0 0.589 0.018 0.625 0.054 0.393 0.375 0.393 0.482 0 1.018-0.768v-6.804h1.625z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-dropbox" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M7.179 12.625l8.821 5.446-6.107 5.089-8.75-5.696zM24.786 22.536v1.929l-8.75 5.232v0.018l-0.018-0.018-0.018 0.018v-0.018l-8.732-5.232v-1.929l2.625 1.714 6.107-5.071v-0.036l0.018 0.018 0.018-0.018v0.036l6.125 5.071zM9.893 2.107l6.107 5.089-8.821 5.429-6.036-4.821zM24.821 12.625l6.036 4.839-8.732 5.696-6.125-5.089zM22.125 2.107l8.732 5.696-6.036 4.821-8.821-5.429z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-instagram" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M18.286 16q0-1.893-1.339-3.232t-3.232-1.339-3.232 1.339-1.339 3.232 1.339 3.232 3.232 1.339 3.232-1.339 1.339-3.232zM20.75 16q0 2.929-2.054 4.982t-4.982 2.054-4.982-2.054-2.054-4.982 2.054-4.982 4.982-2.054 4.982 2.054 2.054 4.982zM22.679 8.679q0 0.679-0.482 1.161t-1.161 0.482-1.161-0.482-0.482-1.161 0.482-1.161 1.161-0.482 1.161 0.482 0.482 1.161zM13.714 4.75q-0.125 0-1.366-0.009t-1.884 0-1.723 0.054-1.839 0.179-1.277 0.33q-0.893 0.357-1.571 1.036t-1.036 1.571q-0.196 0.518-0.33 1.277t-0.179 1.839-0.054 1.723 0 1.884 0.009 1.366-0.009 1.366 0 1.884 0.054 1.723 0.179 1.839 0.33 1.277q0.357 0.893 1.036 1.571t1.571 1.036q0.518 0.196 1.277 0.33t1.839 0.179 1.723 0.054 1.884 0 1.366-0.009 1.366 0.009 1.884 0 1.723-0.054 1.839-0.179 1.277-0.33q0.893-0.357 1.571-1.036t1.036-1.571q0.196-0.518 0.33-1.277t0.179-1.839 0.054-1.723 0-1.884-0.009-1.366 0.009-1.366 0-1.884-0.054-1.723-0.179-1.839-0.33-1.277q-0.357-0.893-1.036-1.571t-1.571-1.036q-0.518-0.196-1.277-0.33t-1.839-0.179-1.723-0.054-1.884 0-1.366 0.009zM27.429 16q0 4.089-0.089 5.661-0.179 3.714-2.214 5.75t-5.75 2.214q-1.571 0.089-5.661 0.089t-5.661-0.089q-3.714-0.179-5.75-2.214t-2.214-5.75q-0.089-1.571-0.089-5.661t0.089-5.661q0.179-3.714 2.214-5.75t5.75-2.214q1.571-0.089 5.661-0.089t5.661 0.089q3.714 0.179 5.75 2.214t2.214 5.75q0.089 1.571 0.089 5.661z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-flickr" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M22.286 2.286q2.125 0 3.634 1.509t1.509 3.634v17.143q0 2.125-1.509 3.634t-3.634 1.509h-17.143q-2.125 0-3.634-1.509t-1.509-3.634v-17.143q0-2.125 1.509-3.634t3.634-1.509h17.143zM12.464 16q0-1.571-1.107-2.679t-2.679-1.107-2.679 1.107-1.107 2.679 1.107 2.679 2.679 1.107 2.679-1.107 1.107-2.679zM22.536 16q0-1.571-1.107-2.679t-2.679-1.107-2.679 1.107-1.107 2.679 1.107 2.679 2.679 1.107 2.679-1.107 1.107-2.679z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-tumblr" viewBox="0 0 19 32">
|
||||
<path class="path1" d="M16.857 23.732l1.429 4.232q-0.411 0.625-1.982 1.179t-3.161 0.571q-1.857 0.036-3.402-0.464t-2.545-1.321-1.696-1.893-0.991-2.143-0.295-2.107v-9.714h-3v-3.839q1.286-0.464 2.304-1.241t1.625-1.607 1.036-1.821 0.607-1.768 0.268-1.58q0.018-0.089 0.080-0.152t0.134-0.063h4.357v7.571h5.946v4.5h-5.964v9.25q0 0.536 0.116 1t0.402 0.938 0.884 0.741 1.455 0.25q1.393-0.036 2.393-0.518z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-dribbble" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M18.286 26.786q-0.75-4.304-2.5-8.893h-0.036l-0.036 0.018q-0.286 0.107-0.768 0.295t-1.804 0.875-2.446 1.464-2.339 2.045-1.839 2.643l-0.268-0.196q3.286 2.679 7.464 2.679 2.357 0 4.571-0.929zM14.982 15.946q-0.375-0.875-0.946-1.982-5.554 1.661-12.018 1.661-0.018 0.125-0.018 0.375 0 2.214 0.786 4.223t2.214 3.598q0.893-1.589 2.205-2.973t2.545-2.223 2.33-1.446 1.777-0.857l0.661-0.232q0.071-0.018 0.232-0.063t0.232-0.080zM13.071 12.161q-2.143-3.804-4.357-6.75-2.464 1.161-4.179 3.321t-2.286 4.857q5.393 0 10.821-1.429zM25.286 17.857q-3.75-1.071-7.304-0.518 1.554 4.268 2.286 8.375 1.982-1.339 3.304-3.384t1.714-4.473zM10.911 4.625q-0.018 0-0.036 0.018 0.018-0.018 0.036-0.018zM21.446 7.214q-3.304-2.929-7.732-2.929-1.357 0-2.768 0.339 2.339 3.036 4.393 6.821 1.232-0.464 2.321-1.080t1.723-1.098 1.17-1.018 0.67-0.723zM25.429 15.875q-0.054-4.143-2.661-7.321l-0.018 0.018q-0.161 0.214-0.339 0.438t-0.777 0.795-1.268 1.080-1.786 1.161-2.348 1.152q0.446 0.946 0.786 1.696 0.036 0.107 0.116 0.313t0.134 0.295q0.643-0.089 1.33-0.125t1.313-0.036 1.232 0.027 1.143 0.071 1.009 0.098 0.857 0.116 0.652 0.107 0.446 0.080zM27.429 16q0 3.732-1.839 6.884t-4.991 4.991-6.884 1.839-6.884-1.839-4.991-4.991-1.839-6.884 1.839-6.884 4.991-4.991 6.884-1.839 6.884 1.839 4.991 4.991 1.839 6.884z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-skype" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M20.946 18.982q0-0.893-0.348-1.634t-0.866-1.223-1.304-0.875-1.473-0.607-1.563-0.411l-1.857-0.429q-0.536-0.125-0.786-0.188t-0.625-0.205-0.536-0.286-0.295-0.375-0.134-0.536q0-1.375 2.571-1.375 0.768 0 1.375 0.214t0.964 0.509 0.679 0.598 0.714 0.518 0.857 0.214q0.839 0 1.348-0.571t0.509-1.375q0-0.982-1-1.777t-2.536-1.205-3.25-0.411q-1.214 0-2.357 0.277t-2.134 0.839-1.589 1.554-0.598 2.295q0 1.089 0.339 1.902t1 1.348 1.429 0.866 1.839 0.58l2.607 0.643q1.607 0.393 2 0.643 0.571 0.357 0.571 1.071 0 0.696-0.714 1.152t-1.875 0.455q-0.911 0-1.634-0.286t-1.161-0.688-0.813-0.804-0.821-0.688-0.964-0.286q-0.893 0-1.348 0.536t-0.455 1.339q0 1.643 2.179 2.813t5.196 1.17q1.304 0 2.5-0.33t2.188-0.955 1.58-1.67 0.589-2.348zM27.429 22.857q0 2.839-2.009 4.848t-4.848 2.009q-2.321 0-4.179-1.429-1.375 0.286-2.679 0.286-2.554 0-4.884-0.991t-4.018-2.679-2.679-4.018-0.991-4.884q0-1.304 0.286-2.679-1.429-1.857-1.429-4.179 0-2.839 2.009-4.848t4.848-2.009q2.321 0 4.179 1.429 1.375-0.286 2.679-0.286 2.554 0 4.884 0.991t4.018 2.679 2.679 4.018 0.991 4.884q0 1.304-0.286 2.679 1.429 1.857 1.429 4.179z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-foursquare" viewBox="0 0 23 32">
|
||||
<path class="path1" d="M17.857 7.75l0.661-3.464q0.089-0.411-0.161-0.714t-0.625-0.304h-12.714q-0.411 0-0.688 0.304t-0.277 0.661v19.661q0 0.125 0.107 0.018l5.196-6.286q0.411-0.464 0.679-0.598t0.857-0.134h4.268q0.393 0 0.661-0.259t0.321-0.527q0.429-2.321 0.661-3.411 0.071-0.375-0.205-0.714t-0.652-0.339h-5.25q-0.518 0-0.857-0.339t-0.339-0.857v-0.75q0-0.518 0.339-0.848t0.857-0.33h6.179q0.321 0 0.625-0.241t0.357-0.527zM21.911 3.786q-0.268 1.304-0.955 4.759t-1.241 6.25-0.625 3.098q-0.107 0.393-0.161 0.58t-0.25 0.58-0.438 0.589-0.688 0.375-1.036 0.179h-4.839q-0.232 0-0.393 0.179-0.143 0.161-7.607 8.821-0.393 0.446-1.045 0.509t-0.866-0.098q-0.982-0.393-0.982-1.75v-25.179q0-0.982 0.679-1.83t2.143-0.848h15.857q1.696 0 2.268 0.946t0.179 2.839zM21.911 3.786l-2.821 14.107q0.071-0.304 0.625-3.098t1.241-6.25 0.955-4.759z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-wordpress" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M2.268 16q0-2.911 1.196-5.589l6.554 17.946q-3.5-1.696-5.625-5.018t-2.125-7.339zM25.268 15.304q0 0.339-0.045 0.688t-0.179 0.884-0.205 0.786-0.313 1.054-0.313 1.036l-1.357 4.571-4.964-14.75q0.821-0.054 1.571-0.143 0.339-0.036 0.464-0.33t-0.045-0.554-0.509-0.241l-3.661 0.179q-1.339-0.018-3.607-0.179-0.214-0.018-0.366 0.089t-0.205 0.268-0.027 0.33 0.161 0.295 0.348 0.143l1.429 0.143 2.143 5.857-3 9-5-14.857q0.821-0.054 1.571-0.143 0.339-0.036 0.464-0.33t-0.045-0.554-0.509-0.241l-3.661 0.179q-0.125 0-0.411-0.009t-0.464-0.009q1.875-2.857 4.902-4.527t6.563-1.67q2.625 0 5.009 0.946t4.259 2.661h-0.179q-0.982 0-1.643 0.723t-0.661 1.705q0 0.214 0.036 0.429t0.071 0.384 0.143 0.411 0.161 0.375 0.214 0.402 0.223 0.375 0.259 0.429 0.25 0.411q1.125 1.911 1.125 3.786zM16.232 17.196l4.232 11.554q0.018 0.107 0.089 0.196-2.25 0.786-4.554 0.786-2 0-3.875-0.571zM28.036 9.411q1.696 3.107 1.696 6.589 0 3.732-1.857 6.884t-4.982 4.973l4.196-12.107q1.054-3.018 1.054-4.929 0-0.75-0.107-1.411zM16 0q3.25 0 6.214 1.268t5.107 3.411 3.411 5.107 1.268 6.214-1.268 6.214-3.411 5.107-5.107 3.411-6.214 1.268-6.214-1.268-5.107-3.411-3.411-5.107-1.268-6.214 1.268-6.214 3.411-5.107 5.107-3.411 6.214-1.268zM16 31.268q3.089 0 5.92-1.214t4.875-3.259 3.259-4.875 1.214-5.92-1.214-5.92-3.259-4.875-4.875-3.259-5.92-1.214-5.92 1.214-4.875 3.259-3.259 4.875-1.214 5.92 1.214 5.92 3.259 4.875 4.875 3.259 5.92 1.214z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-stumbleupon" viewBox="0 0 34 32">
|
||||
<path class="path1" d="M18.964 12.714v-2.107q0-0.75-0.536-1.286t-1.286-0.536-1.286 0.536-0.536 1.286v10.929q0 3.125-2.25 5.339t-5.411 2.214q-3.179 0-5.42-2.241t-2.241-5.42v-4.75h5.857v4.679q0 0.768 0.536 1.295t1.286 0.527 1.286-0.527 0.536-1.295v-11.071q0-3.054 2.259-5.214t5.384-2.161q3.143 0 5.393 2.179t2.25 5.25v2.429l-3.482 1.036zM28.429 16.679h5.857v4.75q0 3.179-2.241 5.42t-5.42 2.241q-3.161 0-5.411-2.223t-2.25-5.366v-4.786l2.339 1.089 3.482-1.036v4.821q0 0.75 0.536 1.277t1.286 0.527 1.286-0.527 0.536-1.277v-4.911z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-digg" viewBox="0 0 37 32">
|
||||
<path class="path1" d="M5.857 5.036h3.643v17.554h-9.5v-12.446h5.857v-5.107zM5.857 19.661v-6.589h-2.196v6.589h2.196zM10.964 10.143v12.446h3.661v-12.446h-3.661zM10.964 5.036v3.643h3.661v-3.643h-3.661zM16.089 10.143h9.518v16.821h-9.518v-2.911h5.857v-1.464h-5.857v-12.446zM21.946 19.661v-6.589h-2.196v6.589h2.196zM27.071 10.143h9.5v16.821h-9.5v-2.911h5.839v-1.464h-5.839v-12.446zM32.911 19.661v-6.589h-2.196v6.589h2.196z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-spotify" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M20.125 21.607q0-0.571-0.536-0.911-3.446-2.054-7.982-2.054-2.375 0-5.125 0.607-0.75 0.161-0.75 0.929 0 0.357 0.241 0.616t0.634 0.259q0.089 0 0.661-0.143 2.357-0.482 4.339-0.482 4.036 0 7.089 1.839 0.339 0.196 0.589 0.196 0.339 0 0.589-0.241t0.25-0.616zM21.839 17.768q0-0.714-0.625-1.089-4.232-2.518-9.786-2.518-2.732 0-5.411 0.75-0.857 0.232-0.857 1.143 0 0.446 0.313 0.759t0.759 0.313q0.125 0 0.661-0.143 2.179-0.589 4.482-0.589 4.982 0 8.714 2.214 0.429 0.232 0.679 0.232 0.446 0 0.759-0.313t0.313-0.759zM23.768 13.339q0-0.839-0.714-1.25-2.25-1.304-5.232-1.973t-6.125-0.67q-3.643 0-6.5 0.839-0.411 0.125-0.688 0.455t-0.277 0.866q0 0.554 0.366 0.929t0.92 0.375q0.196 0 0.714-0.143 2.375-0.661 5.482-0.661 2.839 0 5.527 0.607t4.527 1.696q0.375 0.214 0.714 0.214 0.518 0 0.902-0.366t0.384-0.92zM27.429 16q0 3.732-1.839 6.884t-4.991 4.991-6.884 1.839-6.884-1.839-4.991-4.991-1.839-6.884 1.839-6.884 4.991-4.991 6.884-1.839 6.884 1.839 4.991 4.991 1.839 6.884z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-soundcloud" viewBox="0 0 41 32">
|
||||
<path class="path1" d="M14 24.5l0.286-4.304-0.286-9.339q-0.018-0.179-0.134-0.304t-0.295-0.125q-0.161 0-0.286 0.125t-0.125 0.304l-0.25 9.339 0.25 4.304q0.018 0.179 0.134 0.295t0.277 0.116q0.393 0 0.429-0.411zM19.286 23.982l0.196-3.768-0.214-10.464q0-0.286-0.232-0.429-0.143-0.089-0.286-0.089t-0.286 0.089q-0.232 0.143-0.232 0.429l-0.018 0.107-0.179 10.339q0 0.018 0.196 4.214v0.018q0 0.179 0.107 0.304 0.161 0.196 0.411 0.196 0.196 0 0.357-0.161 0.161-0.125 0.161-0.357zM0.625 17.911l0.357 2.286-0.357 2.25q-0.036 0.161-0.161 0.161t-0.161-0.161l-0.304-2.25 0.304-2.286q0.036-0.161 0.161-0.161t0.161 0.161zM2.161 16.5l0.464 3.696-0.464 3.625q-0.036 0.161-0.179 0.161-0.161 0-0.161-0.179l-0.411-3.607 0.411-3.696q0-0.161 0.161-0.161 0.143 0 0.179 0.161zM3.804 15.821l0.446 4.375-0.446 4.232q0 0.196-0.196 0.196-0.179 0-0.214-0.196l-0.375-4.232 0.375-4.375q0.036-0.214 0.214-0.214 0.196 0 0.196 0.214zM5.482 15.696l0.411 4.5-0.411 4.357q-0.036 0.232-0.25 0.232-0.232 0-0.232-0.232l-0.375-4.357 0.375-4.5q0-0.232 0.232-0.232 0.214 0 0.25 0.232zM7.161 16.018l0.375 4.179-0.375 4.393q-0.036 0.286-0.286 0.286-0.107 0-0.188-0.080t-0.080-0.205l-0.357-4.393 0.357-4.179q0-0.107 0.080-0.188t0.188-0.080q0.25 0 0.286 0.268zM8.839 13.411l0.375 6.786-0.375 4.393q0 0.125-0.089 0.223t-0.214 0.098q-0.286 0-0.321-0.321l-0.321-4.393 0.321-6.786q0.036-0.321 0.321-0.321 0.125 0 0.214 0.098t0.089 0.223zM10.518 11.875l0.339 8.357-0.339 4.357q0 0.143-0.098 0.241t-0.241 0.098q-0.321 0-0.357-0.339l-0.286-4.357 0.286-8.357q0.036-0.339 0.357-0.339 0.143 0 0.241 0.098t0.098 0.241zM12.268 11.161l0.321 9.036-0.321 4.321q-0.036 0.375-0.393 0.375-0.339 0-0.375-0.375l-0.286-4.321 0.286-9.036q0-0.161 0.116-0.277t0.259-0.116q0.161 0 0.268 0.116t0.125 0.277zM19.268 24.411v0 0zM15.732 11.089l0.268 9.107-0.268 4.268q0 0.179-0.134 0.313t-0.313 0.134-0.304-0.125-0.143-0.321l-0.25-4.268 0.25-9.107q0-0.196 0.134-0.321t0.313-0.125 0.313 0.125 0.134 0.321zM17.5 11.429l0.25 8.786-0.25 4.214q0 0.196-0.143 0.339t-0.339 0.143-0.339-0.143-0.161-0.339l-0.214-4.214 0.214-8.786q0.018-0.214 0.161-0.357t0.339-0.143 0.33 0.143 0.152 0.357zM21.286 20.214l-0.25 4.125q0 0.232-0.161 0.393t-0.393 0.161-0.393-0.161-0.179-0.393l-0.107-2.036-0.107-2.089 0.214-11.357v-0.054q0.036-0.268 0.214-0.429 0.161-0.125 0.357-0.125 0.143 0 0.268 0.089 0.25 0.143 0.286 0.464zM41.143 19.875q0 2.089-1.482 3.563t-3.571 1.473h-14.036q-0.232-0.036-0.393-0.196t-0.161-0.393v-16.054q0-0.411 0.5-0.589 1.518-0.607 3.232-0.607 3.482 0 6.036 2.348t2.857 5.777q0.946-0.393 1.964-0.393 2.089 0 3.571 1.482t1.482 3.589z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-codepen" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M3.857 20.875l10.768 7.179v-6.411l-5.964-3.982zM2.75 18.304l3.446-2.304-3.446-2.304v4.607zM17.375 28.054l10.768-7.179-4.804-3.214-5.964 3.982v6.411zM16 19.25l4.857-3.25-4.857-3.25-4.857 3.25zM8.661 14.339l5.964-3.982v-6.411l-10.768 7.179zM25.804 16l3.446 2.304v-4.607zM23.339 14.339l4.804-3.214-10.768-7.179v6.411zM32 11.125v9.75q0 0.732-0.607 1.143l-14.625 9.75q-0.375 0.232-0.768 0.232t-0.768-0.232l-14.625-9.75q-0.607-0.411-0.607-1.143v-9.75q0-0.732 0.607-1.143l14.625-9.75q0.375-0.232 0.768-0.232t0.768 0.232l14.625 9.75q0.607 0.411 0.607 1.143z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-twitch" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M16 7.75v7.75h-2.589v-7.75h2.589zM23.107 7.75v7.75h-2.589v-7.75h2.589zM23.107 21.321l4.518-4.536v-14.196h-21.321v18.732h5.821v3.875l3.875-3.875h7.107zM30.214 0v18.089l-7.75 7.75h-5.821l-3.875 3.875h-3.875v-3.875h-7.107v-20.679l1.946-5.161h26.482z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-meanpath" viewBox="0 0 27 32">
|
||||
<path class="path1" d="M23.411 15.036v2.036q0 0.429-0.241 0.679t-0.67 0.25h-3.607q-0.429 0-0.679-0.25t-0.25-0.679v-2.036q0-0.429 0.25-0.679t0.679-0.25h3.607q0.429 0 0.67 0.25t0.241 0.679zM14.661 19.143v-4.464q0-0.946-0.58-1.527t-1.527-0.58h-2.375q-1.214 0-1.714 0.929-0.5-0.929-1.714-0.929h-2.321q-0.946 0-1.527 0.58t-0.58 1.527v4.464q0 0.393 0.375 0.393h0.982q0.393 0 0.393-0.393v-4.107q0-0.429 0.241-0.679t0.688-0.25h1.679q0.429 0 0.679 0.25t0.25 0.679v4.107q0 0.393 0.375 0.393h0.964q0.393 0 0.393-0.393v-4.107q0-0.429 0.25-0.679t0.679-0.25h1.732q0.429 0 0.67 0.25t0.241 0.679v4.107q0 0.393 0.393 0.393h0.982q0.375 0 0.375-0.393zM25.179 17.429v-2.75q0-0.946-0.589-1.527t-1.536-0.58h-4.714q-0.946 0-1.536 0.58t-0.589 1.527v7.321q0 0.375 0.393 0.375h0.982q0.375 0 0.375-0.375v-3.214q0.554 0.75 1.679 0.75h3.411q0.946 0 1.536-0.58t0.589-1.527zM27.429 6.429v19.143q0 1.714-1.214 2.929t-2.929 1.214h-19.143q-1.714 0-2.929-1.214t-1.214-2.929v-19.143q0-1.714 1.214-2.929t2.929-1.214h19.143q1.714 0 2.929 1.214t1.214 2.929z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-pinterest-p" viewBox="0 0 23 32">
|
||||
<path class="path1" d="M0 10.661q0-1.929 0.67-3.634t1.848-2.973 2.714-2.196 3.304-1.393 3.607-0.464q2.821 0 5.25 1.188t3.946 3.455 1.518 5.125q0 1.714-0.339 3.357t-1.071 3.161-1.786 2.67-2.589 1.839-3.375 0.688q-1.214 0-2.411-0.571t-1.714-1.571q-0.179 0.696-0.5 2.009t-0.42 1.696-0.366 1.268-0.464 1.268-0.571 1.116-0.821 1.384-1.107 1.545l-0.25 0.089-0.161-0.179q-0.268-2.804-0.268-3.357 0-1.643 0.384-3.688t1.188-5.134 0.929-3.625q-0.571-1.161-0.571-3.018 0-1.482 0.929-2.786t2.357-1.304q1.089 0 1.696 0.723t0.607 1.83q0 1.179-0.786 3.411t-0.786 3.339q0 1.125 0.804 1.866t1.946 0.741q0.982 0 1.821-0.446t1.402-1.214 1-1.696 0.679-1.973 0.357-1.982 0.116-1.777q0-3.089-1.955-4.813t-5.098-1.723q-3.571 0-5.964 2.313t-2.393 5.866q0 0.786 0.223 1.518t0.482 1.161 0.482 0.813 0.223 0.545q0 0.5-0.268 1.304t-0.661 0.804q-0.036 0-0.304-0.054-0.911-0.268-1.616-1t-1.089-1.688-0.58-1.929-0.196-1.902z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-get-pocket" viewBox="0 0 31 32">
|
||||
<path class="path1" d="M27.946 2.286q1.161 0 1.964 0.813t0.804 1.973v9.268q0 3.143-1.214 6t-3.259 4.911-4.893 3.259-5.973 1.205q-3.143 0-5.991-1.205t-4.902-3.259-3.268-4.911-1.214-6v-9.268q0-1.143 0.821-1.964t1.964-0.821h25.161zM15.375 21.286q0.839 0 1.464-0.589l7.214-6.929q0.661-0.625 0.661-1.518 0-0.875-0.616-1.491t-1.491-0.616q-0.839 0-1.464 0.589l-5.768 5.536-5.768-5.536q-0.625-0.589-1.446-0.589-0.875 0-1.491 0.616t-0.616 1.491q0 0.911 0.643 1.518l7.232 6.929q0.589 0.589 1.446 0.589z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-vimeo" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M30.518 9.25q-0.179 4.214-5.929 11.625-5.946 7.696-10.036 7.696-2.536 0-4.286-4.696-0.786-2.857-2.357-8.607-1.286-4.679-2.804-4.679-0.321 0-2.268 1.357l-1.375-1.75q0.429-0.375 1.929-1.723t2.321-2.063q2.786-2.464 4.304-2.607 1.696-0.161 2.732 0.991t1.446 3.634q0.786 5.125 1.179 6.661 0.982 4.446 2.143 4.446 0.911 0 2.75-2.875 1.804-2.875 1.946-4.393 0.232-2.482-1.946-2.482-1.018 0-2.161 0.464 2.143-7.018 8.196-6.821 4.482 0.143 4.214 5.821z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-reddit-alien" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M32 15.107q0 1.036-0.527 1.884t-1.42 1.295q0.214 0.821 0.214 1.714 0 2.768-1.902 5.125t-5.188 3.723-7.143 1.366-7.134-1.366-5.179-3.723-1.902-5.125q0-0.839 0.196-1.679-0.911-0.446-1.464-1.313t-0.554-1.902q0-1.464 1.036-2.509t2.518-1.045q1.518 0 2.589 1.125 3.893-2.714 9.196-2.893l2.071-9.304q0.054-0.232 0.268-0.375t0.464-0.089l6.589 1.446q0.321-0.661 0.964-1.063t1.411-0.402q1.107 0 1.893 0.777t0.786 1.884-0.786 1.893-1.893 0.786-1.884-0.777-0.777-1.884l-5.964-1.321-1.857 8.429q5.357 0.161 9.268 2.857 1.036-1.089 2.554-1.089 1.482 0 2.518 1.045t1.036 2.509zM7.464 18.661q0 1.107 0.777 1.893t1.884 0.786 1.893-0.786 0.786-1.893-0.786-1.884-1.893-0.777q-1.089 0-1.875 0.786t-0.786 1.875zM21.929 25q0.196-0.196 0.196-0.464t-0.196-0.464q-0.179-0.179-0.446-0.179t-0.464 0.179q-0.732 0.75-2.161 1.107t-2.857 0.357-2.857-0.357-2.161-1.107q-0.196-0.179-0.464-0.179t-0.446 0.179q-0.196 0.179-0.196 0.455t0.196 0.473q0.768 0.768 2.116 1.214t2.188 0.527 1.625 0.080 1.625-0.080 2.188-0.527 2.116-1.214zM21.875 21.339q1.107 0 1.884-0.786t0.777-1.893q0-1.089-0.786-1.875t-1.875-0.786q-1.107 0-1.893 0.777t-0.786 1.884 0.786 1.893 1.893 0.786z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-hashtag" viewBox="0 0 32 32">
|
||||
<path class="path1" d="M17.696 18.286l1.143-4.571h-4.536l-1.143 4.571h4.536zM31.411 9.286l-1 4q-0.125 0.429-0.554 0.429h-5.839l-1.143 4.571h5.554q0.268 0 0.446 0.214 0.179 0.25 0.107 0.5l-1 4q-0.089 0.429-0.554 0.429h-5.839l-1.446 5.857q-0.125 0.429-0.554 0.429h-4q-0.286 0-0.464-0.214-0.161-0.214-0.107-0.5l1.393-5.571h-4.536l-1.446 5.857q-0.125 0.429-0.554 0.429h-4.018q-0.268 0-0.446-0.214-0.161-0.214-0.107-0.5l1.393-5.571h-5.554q-0.268 0-0.446-0.214-0.161-0.214-0.107-0.5l1-4q0.125-0.429 0.554-0.429h5.839l1.143-4.571h-5.554q-0.268 0-0.446-0.214-0.179-0.25-0.107-0.5l1-4q0.089-0.429 0.554-0.429h5.839l1.446-5.857q0.125-0.429 0.571-0.429h4q0.268 0 0.446 0.214 0.161 0.214 0.107 0.5l-1.393 5.571h4.536l1.446-5.857q0.125-0.429 0.571-0.429h4q0.268 0 0.446 0.214 0.161 0.214 0.107 0.5l-1.393 5.571h5.554q0.268 0 0.446 0.214 0.161 0.214 0.107 0.5z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-chain" viewBox="0 0 30 32">
|
||||
<path class="path1" d="M26 21.714q0-0.714-0.5-1.214l-3.714-3.714q-0.5-0.5-1.214-0.5-0.75 0-1.286 0.571 0.054 0.054 0.339 0.33t0.384 0.384 0.268 0.339 0.232 0.455 0.063 0.491q0 0.714-0.5 1.214t-1.214 0.5q-0.268 0-0.491-0.063t-0.455-0.232-0.339-0.268-0.384-0.384-0.33-0.339q-0.589 0.554-0.589 1.304 0 0.714 0.5 1.214l3.679 3.696q0.482 0.482 1.214 0.482 0.714 0 1.214-0.464l2.625-2.607q0.5-0.5 0.5-1.196zM13.446 9.125q0-0.714-0.5-1.214l-3.679-3.696q-0.5-0.5-1.214-0.5-0.696 0-1.214 0.482l-2.625 2.607q-0.5 0.5-0.5 1.196 0 0.714 0.5 1.214l3.714 3.714q0.482 0.482 1.214 0.482 0.75 0 1.286-0.554-0.054-0.054-0.339-0.33t-0.384-0.384-0.268-0.339-0.232-0.455-0.063-0.491q0-0.714 0.5-1.214t1.214-0.5q0.268 0 0.491 0.063t0.455 0.232 0.339 0.268 0.384 0.384 0.33 0.339q0.589-0.554 0.589-1.304zM29.429 21.714q0 2.143-1.518 3.625l-2.625 2.607q-1.482 1.482-3.625 1.482-2.161 0-3.643-1.518l-3.679-3.696q-1.482-1.482-1.482-3.625 0-2.196 1.571-3.732l-1.571-1.571q-1.536 1.571-3.714 1.571-2.143 0-3.643-1.5l-3.714-3.714q-1.5-1.5-1.5-3.643t1.518-3.625l2.625-2.607q1.482-1.482 3.625-1.482 2.161 0 3.643 1.518l3.679 3.696q1.482 1.482 1.482 3.625 0 2.196-1.571 3.732l1.571 1.571q1.536-1.571 3.714-1.571 2.143 0 3.643 1.5l3.714 3.714q1.5 1.5 1.5 3.643z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-thumb-tack" viewBox="0 0 21 32">
|
||||
<path class="path1" d="M8.571 15.429v-8q0-0.25-0.161-0.411t-0.411-0.161-0.411 0.161-0.161 0.411v8q0 0.25 0.161 0.411t0.411 0.161 0.411-0.161 0.161-0.411zM20.571 21.714q0 0.464-0.339 0.804t-0.804 0.339h-7.661l-0.911 8.625q-0.036 0.214-0.188 0.366t-0.366 0.152h-0.018q-0.482 0-0.571-0.482l-1.357-8.661h-7.214q-0.464 0-0.804-0.339t-0.339-0.804q0-2.196 1.402-3.955t3.17-1.759v-9.143q-0.929 0-1.607-0.679t-0.679-1.607 0.679-1.607 1.607-0.679h11.429q0.929 0 1.607 0.679t0.679 1.607-0.679 1.607-1.607 0.679v9.143q1.768 0 3.17 1.759t1.402 3.955z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-arrow-left" viewBox="0 0 43 32">
|
||||
<path class="path1" d="M42.311 14.044c-0.178-0.178-0.533-0.356-0.711-0.356h-33.778l10.311-10.489c0.178-0.178 0.356-0.533 0.356-0.711 0-0.356-0.178-0.533-0.356-0.711l-1.6-1.422c-0.356-0.178-0.533-0.356-0.889-0.356s-0.533 0.178-0.711 0.356l-14.578 14.933c-0.178 0.178-0.356 0.533-0.356 0.711s0.178 0.533 0.356 0.711l14.756 14.933c0 0.178 0.356 0.356 0.533 0.356s0.533-0.178 0.711-0.356l1.6-1.6c0.178-0.178 0.356-0.533 0.356-0.711s-0.178-0.533-0.356-0.711l-10.311-10.489h33.778c0.178 0 0.533-0.178 0.711-0.356 0.356-0.178 0.533-0.356 0.533-0.711v-2.133c0-0.356-0.178-0.711-0.356-0.889z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-arrow-right" viewBox="0 0 43 32">
|
||||
<path class="path1" d="M0.356 17.956c0.178 0.178 0.533 0.356 0.711 0.356h33.778l-10.311 10.489c-0.178 0.178-0.356 0.533-0.356 0.711 0 0.356 0.178 0.533 0.356 0.711l1.6 1.6c0.178 0.178 0.533 0.356 0.711 0.356s0.533-0.178 0.711-0.356l14.756-14.933c0.178-0.356 0.356-0.711 0.356-0.889s-0.178-0.533-0.356-0.711l-14.756-14.933c0-0.178-0.356-0.356-0.533-0.356s-0.533 0.178-0.711 0.356l-1.6 1.6c-0.178 0.178-0.356 0.533-0.356 0.711s0.178 0.533 0.356 0.711l10.311 10.489h-33.778c-0.178 0-0.533 0.178-0.711 0.356-0.356 0.178-0.533 0.356-0.533 0.711v2.311c0 0.178 0.178 0.533 0.356 0.711z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-play" viewBox="0 0 22 28">
|
||||
<path d="M21.625 14.484l-20.75 11.531c-0.484 0.266-0.875 0.031-0.875-0.516v-23c0-0.547 0.391-0.781 0.875-0.516l20.75 11.531c0.484 0.266 0.484 0.703 0 0.969z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-pause" viewBox="0 0 24 28">
|
||||
<path d="M24 3v22c0 0.547-0.453 1-1 1h-8c-0.547 0-1-0.453-1-1v-22c0-0.547 0.453-1 1-1h8c0.547 0 1 0.453 1 1zM10 3v22c0 0.547-0.453 1-1 1h-8c-0.547 0-1-0.453-1-1v-22c0-0.547 0.453-1 1-1h8c0.547 0 1 0.453 1 1z"></path>
|
||||
</symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 40 KiB |
@@ -0,0 +1,763 @@
|
||||
<?php
|
||||
/**
|
||||
* Download webfonts locally.
|
||||
*
|
||||
* @package wptt/font-loader
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_WebFont_Loader' ) ) {
|
||||
/**
|
||||
* Download webfonts locally.
|
||||
*/
|
||||
class Rara_Business_WebFont_Loader {
|
||||
|
||||
/**
|
||||
* The font-format.
|
||||
*
|
||||
* Use "woff" or "woff2".
|
||||
* This will change the user-agent user to make the request.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0.0
|
||||
* @var string
|
||||
*/
|
||||
protected $font_format = 'woff2';
|
||||
|
||||
/**
|
||||
* The remote URL.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $remote_url;
|
||||
|
||||
/**
|
||||
* Base path.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $base_path;
|
||||
|
||||
/**
|
||||
* Base URL.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $base_url;
|
||||
|
||||
/**
|
||||
* Subfolder name.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $subfolder_name;
|
||||
|
||||
/**
|
||||
* The fonts folder.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $fonts_folder;
|
||||
|
||||
/**
|
||||
* The local stylesheet's path.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $local_stylesheet_path;
|
||||
|
||||
/**
|
||||
* The local stylesheet's URL.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $local_stylesheet_url;
|
||||
|
||||
/**
|
||||
* The remote CSS.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $remote_styles;
|
||||
|
||||
/**
|
||||
* The final CSS.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @var string
|
||||
*/
|
||||
protected $css;
|
||||
|
||||
/**
|
||||
* Cleanup routine frequency.
|
||||
*/
|
||||
const CLEANUP_FREQUENCY = 'monthly';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Get a new instance of the object for a new URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @param string $url The remote URL.
|
||||
*/
|
||||
public function __construct( $url = '' ) {
|
||||
$this->remote_url = $url;
|
||||
|
||||
// Add a cleanup routine.
|
||||
$this->schedule_cleanup();
|
||||
add_action( 'delete_fonts_folder', array( $this, 'delete_fonts_folder' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local URL which contains the styles.
|
||||
*
|
||||
* Fallback to the remote URL if we were unable to write the file locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_url() {
|
||||
|
||||
// Check if the local stylesheet exists.
|
||||
if ( $this->local_file_exists() ) {
|
||||
|
||||
// Attempt to update the stylesheet. Return the local URL on success.
|
||||
if ( $this->write_stylesheet() ) {
|
||||
return $this->get_local_stylesheet_url();
|
||||
}
|
||||
}
|
||||
|
||||
// If the local file exists, return its URL, with a fallback to the remote URL.
|
||||
return file_exists( $this->get_local_stylesheet_path() )
|
||||
? $this->get_local_stylesheet_url()
|
||||
: $this->remote_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local stylesheet URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_stylesheet_url() {
|
||||
if ( ! $this->local_stylesheet_url ) {
|
||||
$this->local_stylesheet_url = str_replace(
|
||||
$this->get_base_path(),
|
||||
$this->get_base_url(),
|
||||
$this->get_local_stylesheet_path()
|
||||
);
|
||||
}
|
||||
return $this->local_stylesheet_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get styles with fonts downloaded locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_styles() {
|
||||
|
||||
// If we already have the local file, return its contents.
|
||||
$local_stylesheet_contents = $this->get_local_stylesheet_contents();
|
||||
if ( $local_stylesheet_contents ) {
|
||||
return $local_stylesheet_contents;
|
||||
}
|
||||
|
||||
// Get the remote URL contents.
|
||||
$this->remote_styles = $this->get_remote_url_contents();
|
||||
|
||||
// Get an array of locally-hosted files.
|
||||
$files = $this->get_local_files_from_css();
|
||||
|
||||
// Convert paths to URLs.
|
||||
foreach ( $files as $remote => $local ) {
|
||||
$files[ $remote ] = str_replace(
|
||||
$this->get_base_path(),
|
||||
$this->get_base_url(),
|
||||
$local
|
||||
);
|
||||
}
|
||||
|
||||
$this->css = str_replace(
|
||||
array_keys( $files ),
|
||||
array_values( $files ),
|
||||
$this->remote_styles
|
||||
);
|
||||
|
||||
$this->write_stylesheet();
|
||||
|
||||
return $this->css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get local stylesheet contents.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string|false Returns the remote URL contents.
|
||||
*/
|
||||
public function get_local_stylesheet_contents() {
|
||||
$local_path = $this->get_local_stylesheet_path();
|
||||
|
||||
// Check if the local stylesheet exists.
|
||||
if ( $this->local_file_exists() ) {
|
||||
|
||||
// Attempt to update the stylesheet. Return false on fail.
|
||||
if ( ! $this->write_stylesheet() ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include $local_path;
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remote file contents.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return string Returns the remote URL contents.
|
||||
*/
|
||||
public function get_remote_url_contents() {
|
||||
|
||||
/**
|
||||
* The user-agent we want to use.
|
||||
*
|
||||
* The default user-agent is the only one compatible with woff (not woff2)
|
||||
* which also supports unicode ranges.
|
||||
*/
|
||||
$user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8';
|
||||
|
||||
// Switch to a user-agent supporting woff2 if we don't need to support IE.
|
||||
if ( 'woff2' === $this->font_format ) {
|
||||
$user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0';
|
||||
}
|
||||
|
||||
// Get the response.
|
||||
$response = wp_remote_get( $this->remote_url, array( 'user-agent' => $user_agent ) );
|
||||
|
||||
// Early exit if there was an error.
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get the CSS from our response.
|
||||
$contents = wp_remote_retrieve_body( $response );
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download files mentioned in our CSS locally.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return array Returns an array of remote URLs and their local counterparts.
|
||||
*/
|
||||
public function get_local_files_from_css() {
|
||||
$font_files = $this->get_remote_files_from_css();
|
||||
$stored = get_site_option( 'downloaded_font_files', array() );
|
||||
$change = false; // If in the end this is true, we need to update the cache option.
|
||||
|
||||
if ( ! defined( 'FS_CHMOD_DIR' ) ) {
|
||||
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
|
||||
}
|
||||
|
||||
// If the fonts folder don't exist, create it.
|
||||
if ( ! file_exists( $this->get_fonts_folder() ) ) {
|
||||
$this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
foreach ( $font_files as $font_family => $files ) {
|
||||
|
||||
// The folder path for this font-family.
|
||||
$folder_path = $this->get_fonts_folder() . '/' . $font_family;
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $folder_path ) ) {
|
||||
$this->get_filesystem()->mkdir( $folder_path, FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
foreach ( $files as $url ) {
|
||||
|
||||
// Get the filename.
|
||||
$filename = basename( wp_parse_url( $url, PHP_URL_PATH ) );
|
||||
$font_path = $folder_path . '/' . $filename;
|
||||
|
||||
// Check if the file already exists.
|
||||
if ( file_exists( $font_path ) ) {
|
||||
|
||||
// Skip if already cached.
|
||||
if ( isset( $stored[ $url ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add file to the cache and change the $changed var to indicate we need to update the option.
|
||||
$stored[ $url ] = $font_path;
|
||||
$change = true;
|
||||
|
||||
// Since the file exists we don't need to proceed with downloading it.
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we got this far, we need to download the file.
|
||||
*/
|
||||
|
||||
// require file.php if the download_url function doesn't exist.
|
||||
if ( ! function_exists( 'download_url' ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
}
|
||||
|
||||
// Download file to temporary location.
|
||||
$tmp_path = download_url( $url );
|
||||
|
||||
// Make sure there were no errors.
|
||||
if ( is_wp_error( $tmp_path ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move temp file to final destination.
|
||||
$success = $this->get_filesystem()->move( $tmp_path, $font_path, true );
|
||||
if ( $success ) {
|
||||
$stored[ $url ] = $font_path;
|
||||
$change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there were changes, update the option.
|
||||
if ( $change ) {
|
||||
|
||||
// Cleanup the option and then save it.
|
||||
foreach ( $stored as $url => $path ) {
|
||||
if ( ! file_exists( $path ) ) {
|
||||
unset( $stored[ $url ] );
|
||||
}
|
||||
}
|
||||
update_site_option( 'downloaded_font_files', $stored );
|
||||
}
|
||||
|
||||
return $stored;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font files from the CSS.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @return array Returns an array of font-families and the font-files used.
|
||||
*/
|
||||
public function get_remote_files_from_css() {
|
||||
|
||||
$font_faces = explode( '@font-face', $this->remote_styles );
|
||||
|
||||
$result = array();
|
||||
|
||||
// Loop all our font-face declarations.
|
||||
foreach ( $font_faces as $font_face ) {
|
||||
|
||||
// Make sure we only process styles inside this declaration.
|
||||
$style = explode( '}', $font_face )[0];
|
||||
|
||||
// Sanity check.
|
||||
if ( false === strpos( $style, 'font-family' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get an array of our font-families.
|
||||
preg_match_all( '/font-family.*?\;/', $style, $matched_font_families );
|
||||
|
||||
// Get an array of our font-files.
|
||||
preg_match_all( '/url\(.*?\)/i', $style, $matched_font_files );
|
||||
|
||||
// Get the font-family name.
|
||||
$font_family = 'unknown';
|
||||
if ( isset( $matched_font_families[0] ) && isset( $matched_font_families[0][0] ) ) {
|
||||
$font_family = rtrim( ltrim( $matched_font_families[0][0], 'font-family:' ), ';' );
|
||||
$font_family = trim( str_replace( array( "'", ';' ), '', $font_family ) );
|
||||
$font_family = sanitize_key( strtolower( str_replace( ' ', '-', $font_family ) ) );
|
||||
}
|
||||
|
||||
// Make sure the font-family is set in our array.
|
||||
if ( ! isset( $result[ $font_family ] ) ) {
|
||||
$result[ $font_family ] = array();
|
||||
}
|
||||
|
||||
// Get files for this font-family and add them to the array.
|
||||
foreach ( $matched_font_files as $match ) {
|
||||
|
||||
// Sanity check.
|
||||
if ( ! isset( $match[0] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the file URL.
|
||||
$font_family_url = rtrim( ltrim( $match[0], 'url(' ), ')' );
|
||||
|
||||
// Make sure to convert relative URLs to absolute.
|
||||
$font_family_url = $this->get_absolute_path( $font_family_url );
|
||||
|
||||
$result[ $font_family ][] = $font_family_url;
|
||||
}
|
||||
|
||||
// Make sure we have unique items.
|
||||
// We're using array_flip here instead of array_unique for improved performance.
|
||||
$result[ $font_family ] = array_flip( array_flip( $result[ $font_family ] ) );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the CSS to the filesystem.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.1.0
|
||||
* @return string|false Returns the absolute path of the file on success, or false on fail.
|
||||
*/
|
||||
protected function write_stylesheet() {
|
||||
$file_path = $this->get_local_stylesheet_path();
|
||||
$filesystem = $this->get_filesystem();
|
||||
|
||||
if ( ! defined( 'FS_CHMOD_DIR' ) ) {
|
||||
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
|
||||
}
|
||||
|
||||
// If the folder doesn't exist, create it.
|
||||
if ( ! file_exists( $this->get_fonts_folder() ) ) {
|
||||
$this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR );
|
||||
}
|
||||
|
||||
// If the file doesn't exist, create it. Return false if it can not be created.
|
||||
if ( ! $filesystem->exists( $file_path ) && ! $filesystem->touch( $file_path ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we got this far, we need to write the file.
|
||||
// Get the CSS.
|
||||
if ( ! $this->css ) {
|
||||
$this->get_styles();
|
||||
}
|
||||
|
||||
// Put the contents in the file. Return false if that fails.
|
||||
if ( ! $filesystem->put_contents( $file_path, $this->css ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $file_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stylesheet path.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_stylesheet_path() {
|
||||
if ( ! $this->local_stylesheet_path ) {
|
||||
$this->local_stylesheet_path = $this->get_fonts_folder() . '/' . $this->get_local_stylesheet_filename() . '.css';
|
||||
}
|
||||
return $this->local_stylesheet_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the local stylesheet filename.
|
||||
*
|
||||
* This is a hash, generated from the site-URL, the wp-content path and the URL.
|
||||
* This way we can avoid issues with sites changing their URL, or the wp-content path etc.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_local_stylesheet_filename() {
|
||||
return md5( $this->get_base_url() . $this->get_base_path() . $this->remote_url . $this->font_format );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the font-format to be used.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
* @param string $format The format to be used. Use "woff" or "woff2".
|
||||
* @return void
|
||||
*/
|
||||
public function set_font_format( $format = 'woff2' ) {
|
||||
$this->font_format = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font files and preload them.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function preload_local_fonts() {
|
||||
// Make sure variables are set.
|
||||
// Get the remote URL contents.
|
||||
$styles = $this->get_styles();
|
||||
|
||||
// Get an array of locally-hosted files.
|
||||
$local_font = array();
|
||||
$font_files = $this->get_remote_files_from_css( $styles );
|
||||
|
||||
foreach ( $font_files as $font_family => $files ) {
|
||||
if ( is_array( $files ) ) {
|
||||
$local_font[] = end( $files );
|
||||
}
|
||||
}
|
||||
|
||||
// Caching this for further optimization.
|
||||
update_site_option( 'rara_business_local_font_files', $local_font );
|
||||
|
||||
foreach ( $local_font as $key => $local_font ) {
|
||||
if ( $local_font ) {
|
||||
echo '<link rel="preload" href="' . esc_url( $local_font ) . '" as="font" type="font/' . esc_attr( $this->font_format ) . '" crossorigin>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the local stylesheet exists.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return bool
|
||||
*/
|
||||
public function local_file_exists() {
|
||||
return ( ! file_exists( $this->get_local_stylesheet_path() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base path.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_base_path() {
|
||||
if ( ! $this->base_path ) {
|
||||
$this->base_path = apply_filters( 'rara_business_get_local_fonts_base_path', $this->get_filesystem()->wp_content_dir() );
|
||||
}
|
||||
return $this->base_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URL.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_base_url() {
|
||||
if ( ! $this->base_url ) {
|
||||
$this->base_url = apply_filters( 'rara_business_get_local_fonts_base_url', content_url() );
|
||||
}
|
||||
return $this->base_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subfolder name.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return string
|
||||
*/
|
||||
public function get_subfolder_name() {
|
||||
if ( ! $this->subfolder_name ) {
|
||||
$this->subfolder_name = apply_filters( 'rara_business_get_local_fonts_subfolder_name', 'fonts' );
|
||||
}
|
||||
return $this->subfolder_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the folder for fonts.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function get_fonts_folder() {
|
||||
if ( ! $this->fonts_folder ) {
|
||||
$this->fonts_folder = $this->get_base_path();
|
||||
if ( $this->get_subfolder_name() ) {
|
||||
$this->fonts_folder .= '/' . $this->get_subfolder_name();
|
||||
}
|
||||
}
|
||||
return $this->fonts_folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file preloads.
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $format
|
||||
*/
|
||||
public function load_preload_local_fonts( $url, $format = 'woff2' ) {
|
||||
// Check if cache font files present or not
|
||||
$local_font_files = get_site_option( 'rara_business_local_font_files', false );
|
||||
|
||||
if ( is_array( $local_font_files ) && ! empty( $local_font_files ) ) {
|
||||
$font_format = apply_filters( 'rara_business_local_google_fonts_format', $format );
|
||||
foreach ( $local_font_files as $key => $local_font ) {
|
||||
if ( $local_font ) {
|
||||
echo '<link rel="preload" href="' . esc_url( $local_font ) . '" as="font" type="font/' . esc_attr( $font_format ) . '" crossorigin>';
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Now preload font data after processing it, as we didn't get stored data.
|
||||
$font = rara_business_webfont_loader_instance( $url );
|
||||
$this->set_font_format( $format );
|
||||
$this->preload_local_fonts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule a cleanup.
|
||||
*
|
||||
* Deletes the fonts files on a regular basis.
|
||||
* This way font files will get updated regularly,
|
||||
* and we avoid edge cases where unused files remain in the server.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return void
|
||||
*/
|
||||
public function schedule_cleanup() {
|
||||
if ( ! is_multisite() || ( is_multisite() && is_main_site() ) ) {
|
||||
if ( ! wp_next_scheduled( 'delete_fonts_folder' ) && ! wp_installing() ) {
|
||||
wp_schedule_event( time(), self::CLEANUP_FREQUENCY, 'delete_fonts_folder' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the fonts folder.
|
||||
*
|
||||
* This runs as part of a cleanup routine.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1.0
|
||||
* @return bool
|
||||
*/
|
||||
public function delete_fonts_folder() {
|
||||
//deleting site option for the theme
|
||||
delete_site_option( 'rara_business_local_font_files' );
|
||||
return $this->get_filesystem()->delete( $this->get_fonts_folder(), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filesystem.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0.0
|
||||
* @return \WP_Filesystem_Base
|
||||
*/
|
||||
protected function get_filesystem() {
|
||||
global $wp_filesystem;
|
||||
|
||||
// If the filesystem has not been instantiated yet, do it here.
|
||||
if ( ! $wp_filesystem ) {
|
||||
if ( ! function_exists( 'WP_Filesystem' ) ) {
|
||||
require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' );
|
||||
}
|
||||
WP_Filesystem();
|
||||
}
|
||||
return $wp_filesystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an absolute URL from a relative URL.
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param string $url The URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_absolute_path( $url ) {
|
||||
|
||||
// If dealing with a root-relative URL.
|
||||
if ( 0 === stripos( $url, '/' ) ) {
|
||||
$parsed_url = parse_url( $this->remote_url );
|
||||
return $parsed_url['scheme'] . '://' . $parsed_url['hostname'] . $url;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'rara_business_get_webfont_styles' ) ) {
|
||||
/**
|
||||
* Get styles for a webfont.
|
||||
*
|
||||
* This will get the CSS from the remote API,
|
||||
* download any fonts it contains,
|
||||
* replace references to remote URLs with locally-downloaded assets,
|
||||
* and finally return the resulting CSS.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param string $url The URL of the remote webfont.
|
||||
* @param string $format The font-format. If you need to support IE, change this to "woff".
|
||||
*
|
||||
* @return string Returns the CSS.
|
||||
*/
|
||||
function rara_business_get_webfont_styles( $url, $format = 'woff2' ) {
|
||||
$font = new Rara_Business_WebFont_Loader( $url );
|
||||
$font->set_font_format( $format );
|
||||
return $font->get_styles();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'rara_business_get_webfont_url' ) ) {
|
||||
/**
|
||||
* Get a stylesheet URL for a webfont.
|
||||
*
|
||||
* @since 1.1.0
|
||||
*
|
||||
* @param string $url The URL of the remote webfont.
|
||||
* @param string $format The font-format. If you need to support IE, change this to "woff".
|
||||
*
|
||||
* @return string Returns the CSS.
|
||||
*/
|
||||
function rara_business_get_webfont_url( $url, $format = 'woff2' ) {
|
||||
$font = new Rara_Business_WebFont_Loader( $url );
|
||||
$font->set_font_format( $format );
|
||||
return $font->get_url();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create instance of Rara_Business_WebFont_Loader class.
|
||||
*/
|
||||
function rara_business_webfont_loader_instance( $font_url = '' ) {
|
||||
return new Rara_Business_WebFont_Loader( $font_url );
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/** Admin Notice */
|
||||
.notice-info .notice-text {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.notice-text p.dismiss-link {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*User stick note*/
|
||||
h3.sticky_title {
|
||||
margin-top: 12px;
|
||||
margin-bottom: 11px;
|
||||
}
|
||||
|
||||
span.sticky_info_row {
|
||||
display: block;
|
||||
line-height: 23px;
|
||||
}
|
||||
|
||||
label.row-element {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
label.row-element.more-detail{
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
.customize-text_editor{
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.customize-text_editor_desc a {
|
||||
background-color: #0089BD;
|
||||
padding: 4px;
|
||||
color: #fff;
|
||||
border-radius: 7px;
|
||||
margin: 2px 0;
|
||||
display: inline-block;
|
||||
transition:all ease 0.3s;
|
||||
-webkit-transition:all ease 0.3s;
|
||||
-moz-transition:all ease 0.3s;
|
||||
}
|
||||
.customize-text_editor_desc a:hover {
|
||||
background-color: #fff;
|
||||
color: #0089BD;
|
||||
}
|
||||
.customize-text_editor_desc .download-link{
|
||||
display: block;
|
||||
}
|
||||
.customize-text_editor_desc span {
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.customize-text_editor_desc .upgrade-pro{
|
||||
color: #FFF !important;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
width: 90%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#accordion-section-theme_info{
|
||||
color: #0089BD;
|
||||
}
|
||||
|
||||
.control-section-pro-section .accordion-section-title .button {
|
||||
margin-top: -4px;
|
||||
font-weight: 700;
|
||||
margin-left: 8px;
|
||||
background: #f89300;
|
||||
color: #fff;
|
||||
border-color: #f89300;
|
||||
padding: 0 20px 1px;
|
||||
}
|
||||
|
||||
.control-section-pro-section .accordion-section-title .button:hover,
|
||||
.control-section-pro-section .accordion-section-title .button:focus{
|
||||
background: #dc8200;
|
||||
border-color: #dc8200;
|
||||
}
|
||||
|
||||
.rtl .control-section-pro-section .accordion-section-title .button {
|
||||
margin-left: 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
if( ! function_exists( 'rara_business_register_custom_controls' ) ) :
|
||||
/**
|
||||
* Register Custom Controls
|
||||
*/
|
||||
function rara_business_register_custom_controls( $wp_customize ){
|
||||
|
||||
// Load our custom control.
|
||||
require_once get_template_directory() . '/inc/custom-controls/note/class-note-control.php';
|
||||
require_once get_template_directory() . '/inc/custom-controls/radioimg/class-radio-image-control.php';
|
||||
require_once get_template_directory() . '/inc/custom-controls/select/class-select-control.php';
|
||||
require_once get_template_directory() . '/inc/custom-controls/slider/class-slider-control.php';
|
||||
require_once get_template_directory() . '/inc/custom-controls/toggle/class-toggle-control.php';
|
||||
require_once get_template_directory() . '/inc/custom-controls/repeater/class-repeater-setting.php';
|
||||
require_once get_template_directory() . '/inc/custom-controls/repeater/class-control-repeater.php';
|
||||
|
||||
// Register the control type.
|
||||
$wp_customize->register_control_type( 'Rara_Business_Radio_Image_Control' );
|
||||
$wp_customize->register_control_type( 'Rara_Business_Select_Control' );
|
||||
$wp_customize->register_control_type( 'Rara_Business_Slider_Control' );
|
||||
$wp_customize->register_control_type( 'Rara_Business_Toggle_Control' );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_register_custom_controls' );
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: Note.
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_Note_Control' ) ) {
|
||||
|
||||
class Rara_Business_Note_Control extends WP_Customize_Control {
|
||||
|
||||
public function render_content(){ ?>
|
||||
<span class="customize-control-title">
|
||||
<?php echo esc_html( $this->label ); ?>
|
||||
</span>
|
||||
|
||||
<?php if( $this->description ){ ?>
|
||||
<span class="description customize-control-description">
|
||||
<?php echo wp_kses_post($this->description); ?>
|
||||
</span>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: radio-image.
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_Radio_Image_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Radio Image control (modified radio).
|
||||
*/
|
||||
class Rara_Business_Radio_Image_Control extends WP_Customize_Control {
|
||||
|
||||
public $type = 'radio-image';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'rara-business-radio-image', get_template_directory_uri() . '/inc/custom-controls/radioimg/radio-image.css', null );
|
||||
wp_enqueue_script( 'rara-business-radio-image', get_template_directory_uri() . '/inc/custom-controls/radioimg/radio-image.js', array( 'jquery' ), false, true ); //for radio-image
|
||||
}
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
<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 id="input_{{ data.id }}" class="image">
|
||||
<# for ( key in data.choices ) { #>
|
||||
<input {{{ data.inputAttrs }}} class="image-select" type="radio" value="{{ key }}" name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #>>
|
||||
<label for="{{ data.id }}{{ key }}">
|
||||
<img src="{{ data.choices[ key ] }}">
|
||||
<span class="image-clickable"></span>
|
||||
</label>
|
||||
</input>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*Radio Image Button */
|
||||
.customize-control-radio-image label {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.customize-control-radio-image input {
|
||||
display: none;
|
||||
}
|
||||
.customize-control-radio-image input img {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.customize-control-radio-image input:checked + label img {
|
||||
-webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
|
||||
border: 1px solid #3498DB;
|
||||
}
|
||||
.customize-control-radio-image input + label .image-clickable {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
/*Radio Image Button Ends */
|
||||
@@ -0,0 +1,16 @@
|
||||
wp.customize.controlConstructor['radio-image'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this;
|
||||
|
||||
// Change the value
|
||||
this.container.on( 'click', 'input', function() {
|
||||
control.setting.set( jQuery( this ).val() );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,508 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Customizer Repeater Control.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if( ! class_exists( 'Rara_Business_Control_Repeater' ) ) {
|
||||
/**
|
||||
* Repeater control
|
||||
*/
|
||||
class Rara_Business_Control_Repeater extends WP_Customize_Control {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'rara-business-repeater';
|
||||
|
||||
/**
|
||||
* Data type
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $option_type = 'theme_mod';
|
||||
|
||||
/**
|
||||
* The fields that each container row will contain.
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array();
|
||||
|
||||
/**
|
||||
* Will store a filtered version of value for advenced fields (like images).
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $filtered_value = array();
|
||||
|
||||
/**
|
||||
* The row label
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $row_label = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Supplied `$args` override class property defaults.
|
||||
* If `$args['settings']` is not defined, use the $id as the setting ID.
|
||||
*
|
||||
* @param WP_Customize_Manager $manager Customizer bootstrap instance.
|
||||
* @param string $id Control ID.
|
||||
* @param array $args {@see WP_Customize_Control::__construct}.
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array() ) {
|
||||
|
||||
parent::__construct( $manager, $id, $args );
|
||||
|
||||
// Set up defaults for row labels.
|
||||
$this->row_label = array(
|
||||
'type' => 'text',
|
||||
'value' => esc_attr__( 'row', 'rara-business' ),
|
||||
'field' => false,
|
||||
);
|
||||
|
||||
// Validate row-labels.
|
||||
$this->row_label( $args );
|
||||
|
||||
if ( empty( $this->button_label ) ) {
|
||||
$this->button_label = sprintf( esc_attr__( 'Add new %s', 'rara-business' ), $this->row_label['value'] );
|
||||
}
|
||||
|
||||
if ( empty( $args['fields'] ) || ! is_array( $args['fields'] ) ) {
|
||||
$args['fields'] = array();
|
||||
}
|
||||
|
||||
// An array to store keys of fields that need to be filtered.
|
||||
$media_fields_to_filter = array();
|
||||
|
||||
foreach ( $args['fields'] as $key => $value ) {
|
||||
$args['fields'][ $key ]['default'] = ( isset( $value['default'] ) ) ? $value['default'] : '';
|
||||
$args['fields'][ $key ]['id'] = $key;
|
||||
|
||||
// We check if the filed is an uploaded media ( image , file, video, etc.. ).
|
||||
if ( isset( $value['type'] ) ) {
|
||||
switch ( $value['type'] ) {
|
||||
case 'image':
|
||||
case 'cropped_image':
|
||||
case 'upload':
|
||||
// We add it to the list of fields that need some extra filtering/processing.
|
||||
$media_fields_to_filter[ $key ] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->fields = $args['fields'];
|
||||
|
||||
// Now we are going to filter the fields.
|
||||
// First we create a copy of the value that would be used otherwise.
|
||||
$this->filtered_value = $this->value();
|
||||
|
||||
if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {
|
||||
|
||||
// We iterate over the list of fields.
|
||||
foreach ( $this->filtered_value as &$filtered_value_field ) {
|
||||
|
||||
if ( is_array( $filtered_value_field ) && ! empty( $filtered_value_field ) ) {
|
||||
|
||||
// We iterate over the list of properties for this field.
|
||||
foreach ( $filtered_value_field as $key => &$value ) {
|
||||
|
||||
// We check if this field was marked as requiring extra filtering (in this case image, cropped_images, upload).
|
||||
if ( array_key_exists( $key, $media_fields_to_filter ) ) {
|
||||
|
||||
// What follows was made this way to preserve backward compatibility.
|
||||
// The repeater control use to store the URL for images instead of the attachment ID.
|
||||
// We check if the value look like an ID (otherwise it's probably a URL so don't filter it).
|
||||
if ( is_numeric( $value ) ) {
|
||||
|
||||
// "sanitize" the value.
|
||||
$attachment_id = (int) $value;
|
||||
|
||||
// Try to get the attachment_url.
|
||||
$url = wp_get_attachment_url( $attachment_id );
|
||||
|
||||
$filename = basename( get_attached_file( $attachment_id ) );
|
||||
|
||||
// If we got a URL.
|
||||
if ( $url ) {
|
||||
|
||||
// 'id' is needed for form hidden value, URL is needed to display the image.
|
||||
$value = array(
|
||||
'id' => $attachment_id,
|
||||
'url' => $url,
|
||||
'filename' => $filename,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
$this->json['default'] = ( isset( $this->default ) ) ? $this->default : $this->setting->default;
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
|
||||
if ( 'user_meta' === $this->option_type ) {
|
||||
$this->json['value'] = get_user_meta( get_current_user_id(), $this->id, true );
|
||||
}
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
$fields = $this->fields;
|
||||
|
||||
$this->json['fields'] = $fields;
|
||||
$this->json['row_label'] = $this->row_label;
|
||||
|
||||
// If filtered_value has been set and is not empty we use it instead of the actual value.
|
||||
if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {
|
||||
$this->json['value'] = $this->filtered_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
// If we have a color picker field we need to enqueue the WordPress Color Picker style and script.
|
||||
if ( is_array( $this->fields ) && ! empty( $this->fields ) ) {
|
||||
foreach ( $this->fields as $field ) {
|
||||
if ( isset( $field['type'] ) ){
|
||||
if( 'color' === $field['type'] ){
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
}elseif( 'font' === $field['type'] ){
|
||||
wp_enqueue_script( 'all', get_template_directory_uri() . '/js/all.min.js', array( 'jquery' ), '6.1.1', true );
|
||||
wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/js/v4-shims.min.js', array( 'jquery', 'all' ), '6.1.1', true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
wp_enqueue_script( 'rara-business-repeater', get_template_directory_uri() . '/inc/custom-controls/repeater/repeater.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), false, true );
|
||||
wp_enqueue_style( 'rara-business-repeater', get_template_directory_uri() . '/inc/custom-controls/repeater/repeater.css', null );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control's content.
|
||||
* Allows the content to be overriden without having to rewrite the wrapper in $this->render().
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function render_content() {
|
||||
?>
|
||||
<label>
|
||||
<?php if ( ! empty( $this->label ) ) : ?>
|
||||
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $this->description ) ) : ?>
|
||||
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" {{{ data.inputAttrs }}} value="" <?php echo wp_kses_post( $this->get_link() ); ?> />
|
||||
</label>
|
||||
|
||||
<ul class="repeater-fields"></ul>
|
||||
|
||||
<?php if ( isset( $this->choices['limit'] ) ) : ?>
|
||||
<p class="limit"><?php printf( esc_html__( 'Limit: %s rows', 'rara-business' ), esc_html( $this->choices['limit'] ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
<button class="button-secondary repeater-add"><?php echo esc_html( $this->button_label ); ?></button>
|
||||
|
||||
<?php
|
||||
|
||||
$this->repeater_js_template();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function repeater_js_template() {
|
||||
?>
|
||||
<script type="text/html" class="customize-control-repeater-content">
|
||||
<# var field; var index = data.index; #>
|
||||
|
||||
<li class="repeater-row minimized" data-row="{{{ index }}}">
|
||||
|
||||
<div class="repeater-row-header">
|
||||
<span class="repeater-row-label"></span>
|
||||
<i class="dashicons dashicons-arrow-down repeater-minimize"></i>
|
||||
</div>
|
||||
<div class="repeater-row-content">
|
||||
<# _.each( data, function( field, i ) { #>
|
||||
|
||||
<div class="repeater-field repeater-field-{{{ field.type }}}">
|
||||
|
||||
<# if ( 'text' === field.type || 'font' === field.type || 'url' === field.type || 'link' === field.type || 'email' === field.type || 'tel' === field.type || 'date' === field.type ) { #>
|
||||
|
||||
<# if ( 'link' === field.type ) { #>
|
||||
<# field.type = 'url' #>
|
||||
<# } #>
|
||||
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
<input type="{{field.type}}" name="" value="{{{ field.default }}}" data-field="{{{ field.id }}}">
|
||||
</label>
|
||||
|
||||
<# } else if ( 'hidden' === field.type ) { #>
|
||||
|
||||
<input type="hidden" data-field="{{{ field.id }}}" <# if ( field.default ) { #> value="{{{ field.default }}}" <# } #> />
|
||||
|
||||
<# } else if ( 'checkbox' === field.type ) { #>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" value="true" data-field="{{{ field.id }}}" <# if ( field.default ) { #> checked="checked" <# } #> /> {{ field.label }}
|
||||
<# if ( field.description ) { #>
|
||||
{{ field.description }}
|
||||
<# } #>
|
||||
</label>
|
||||
|
||||
<# } else if ( 'select' === field.type ) { #>
|
||||
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
<select data-field="{{{ field.id }}}">
|
||||
<# _.each( field.choices, function( choice, i ) { #>
|
||||
<option value="{{{ i }}}" <# if ( field.default == i ) { #> selected="selected" <# } #>>{{ choice }}</option>
|
||||
<# }); #>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<# } else if ( 'radio' === field.type ) { #>
|
||||
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
|
||||
<# _.each( field.choices, function( choice, i ) { #>
|
||||
<label>
|
||||
<input type="radio" name="{{{ field.id }}}{{ index }}" data-field="{{{ field.id }}}" value="{{{ i }}}" <# if ( field.default == i ) { #> checked="checked" <# } #>> {{ choice }} <br/>
|
||||
</label>
|
||||
<# }); #>
|
||||
</label>
|
||||
|
||||
<# } else if ( 'radio-image' === field.type ) { #>
|
||||
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
|
||||
<# _.each( field.choices, function( choice, i ) { #>
|
||||
<input type="radio" id="{{{ field.id }}}_{{ index }}_{{{ i }}}" name="{{{ field.id }}}{{ index }}" data-field="{{{ field.id }}}" value="{{{ i }}}" <# if ( field.default == i ) { #> checked="checked" <# } #>>
|
||||
<label for="{{{ field.id }}}_{{ index }}_{{{ i }}}">
|
||||
<img src="{{ choice }}">
|
||||
</label>
|
||||
</input>
|
||||
<# }); #>
|
||||
</label>
|
||||
|
||||
<# } else if ( 'color' === field.type ) { #>
|
||||
|
||||
<# var defaultValue = '';
|
||||
if ( field.default ) {
|
||||
if ( '#' !== field.default.substring( 0, 1 ) ) {
|
||||
defaultValue = '#' + field.default;
|
||||
} else {
|
||||
defaultValue = field.default;
|
||||
}
|
||||
defaultValue = ' data-default-color=' + defaultValue; // Quotes added automatically.
|
||||
} #>
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{{ field.label }}}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{{ field.description }}}</span>
|
||||
<# } #>
|
||||
<input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php echo esc_attr__( 'Hex Value', 'rara-business' ); ?>" value="{{{ field.default }}}" data-field="{{{ field.id }}}" {{ defaultValue }} />
|
||||
|
||||
</label>
|
||||
|
||||
<# } else if ( 'textarea' === field.type ) { #>
|
||||
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
<textarea rows="5" data-field="{{{ field.id }}}">{{ field.default }}</textarea>
|
||||
|
||||
<# } else if ( field.type === 'image' || field.type === 'cropped_image' ) { #>
|
||||
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
</label>
|
||||
|
||||
<figure class="rara-business-image-attachment" data-placeholder="<?php esc_attr_e( 'No Image Selected', 'rara-business' ); ?>" >
|
||||
<# if ( field.default ) { #>
|
||||
<# var defaultImageURL = ( field.default.url ) ? field.default.url : field.default; #>
|
||||
<img src="{{{ defaultImageURL }}}">
|
||||
<# } else { #>
|
||||
<?php esc_attr_e( 'No Image Selected', 'rara-business' ); ?>
|
||||
<# } #>
|
||||
</figure>
|
||||
|
||||
<div class="actions">
|
||||
<button type="button" class="button remove-button<# if ( ! field.default ) { #> hidden<# } #>"><?php esc_html_e( 'Remove', 'rara-business' ); ?></button>
|
||||
<button type="button" class="button upload-button" data-label=" <?php esc_attr_e( 'Add Image', 'rara-business' ); ?>" data-alt-label="<?php esc_attr_e( 'Change Image', 'rara-business' ); ?>" >
|
||||
<# if ( field.default ) { #>
|
||||
<?php esc_attr_e( 'Change Image', 'rara-business' ); ?>
|
||||
<# } else { #>
|
||||
<?php esc_attr_e( 'Add Image', 'rara-business' ); ?>
|
||||
<# } #>
|
||||
</button>
|
||||
<# if ( field.default.id ) { #>
|
||||
<input type="hidden" class="hidden-field" value="{{{ field.default.id }}}" data-field="{{{ field.id }}}" >
|
||||
<# } else { #>
|
||||
<input type="hidden" class="hidden-field" value="{{{ field.default }}}" data-field="{{{ field.id }}}" >
|
||||
<# } #>
|
||||
</div>
|
||||
|
||||
<# } else if ( field.type === 'upload' ) { #>
|
||||
|
||||
<label>
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
</label>
|
||||
|
||||
<figure class="rara-business-file-attachment" data-placeholder="<?php esc_attr_e( 'No File Selected', 'rara-business' ); ?>" >
|
||||
<# if ( field.default ) { #>
|
||||
<# var defaultFilename = ( field.default.filename ) ? field.default.filename : field.default; #>
|
||||
<span class="file"><span class="dashicons dashicons-media-default"></span> {{ defaultFilename }}</span>
|
||||
<# } else { #>
|
||||
<?php esc_attr_e( 'No File Selected', 'rara-business' ); ?>
|
||||
<# } #>
|
||||
</figure>
|
||||
|
||||
<div class="actions">
|
||||
<button type="button" class="button remove-button<# if ( ! field.default ) { #> hidden<# } #>"></button>
|
||||
<button type="button" class="button upload-button" data-label="<?php esc_attr_e( 'Add File', 'rara-business' ); ?>" data-alt-label="<?php esc_attr_e( 'Change File', 'rara-business' ); ?>" >
|
||||
<# if ( field.default ) { #>
|
||||
<?php esc_attr_e( 'Change File', 'rara-business' ); ?>
|
||||
<# } else { #>
|
||||
<?php esc_attr_e( 'Add File', 'rara-business' ); ?>
|
||||
<# } #>
|
||||
</button>
|
||||
<# if ( field.default.id ) { #>
|
||||
<input type="hidden" class="hidden-field" value="{{{ field.default.id }}}" data-field="{{{ field.id }}}" >
|
||||
<# } else { #>
|
||||
<input type="hidden" class="hidden-field" value="{{{ field.default }}}" data-field="{{{ field.id }}}" >
|
||||
<# } #>
|
||||
</div>
|
||||
|
||||
<# } else if ( 'custom' === field.type ) { #>
|
||||
|
||||
<# if ( field.label ) { #>
|
||||
<span class="customize-control-title">{{ field.label }}</span>
|
||||
<# } #>
|
||||
<# if ( field.description ) { #>
|
||||
<span class="description customize-control-description">{{ field.description }}</span>
|
||||
<# } #>
|
||||
<div data-field="{{{ field.id }}}">{{{ field.default }}}</div>
|
||||
|
||||
<# } #>
|
||||
|
||||
</div>
|
||||
<# }); #>
|
||||
<button type="button" class="button-link repeater-row-remove"><?php esc_html_e( 'Remove', 'rara-business' ); ?></button>
|
||||
</div>
|
||||
</li>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate row-labels.
|
||||
*
|
||||
* @access protected
|
||||
* @since 2.4.0
|
||||
* @param array $args {@see WP_Customize_Control::__construct}.
|
||||
*/
|
||||
protected function row_label( $args ) {
|
||||
|
||||
// Validating args for row labels.
|
||||
if ( isset( $args['row_label'] ) && is_array( $args['row_label'] ) && ! empty( $args['row_label'] ) ) {
|
||||
|
||||
// Validating row label type.
|
||||
if ( isset( $args['row_label']['type'] ) && ( 'text' === $args['row_label']['type'] || 'field' === $args['row_label']['type'] ) ) {
|
||||
$this->row_label['type'] = $args['row_label']['type'];
|
||||
}
|
||||
|
||||
// Validating row label type.
|
||||
if ( isset( $args['row_label']['value'] ) && ! empty( $args['row_label']['value'] ) ) {
|
||||
$this->row_label['value'] = esc_attr( $args['row_label']['value'] );
|
||||
}
|
||||
|
||||
// Validating row label field.
|
||||
if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) {
|
||||
$this->row_label['field'] = esc_attr( $args['row_label']['field'] );
|
||||
} else {
|
||||
// If from field is not set correctly, making sure standard is set as the type.
|
||||
$this->row_label['type'] = 'text';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Repeater Customizer Setting.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_Repeater_Setting' ) ) {
|
||||
|
||||
/**
|
||||
* Repeater Settings.
|
||||
*/
|
||||
class Rara_Business_Repeater_Setting extends WP_Customize_Setting {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Any supplied $args override class property defaults.
|
||||
*
|
||||
* @access public
|
||||
* @param WP_Customize_Manager $manager The WordPress WP_Customize_Manager object.
|
||||
* @param string $id A specific ID of the setting. Can be a theme mod or option name.
|
||||
* @param array $args Setting arguments.
|
||||
*/
|
||||
public function __construct( $manager, $id, $args = array() ) {
|
||||
parent::__construct( $manager, $id, $args );
|
||||
|
||||
// Will onvert the setting from JSON to array. Must be triggered very soon.
|
||||
add_filter( "customize_sanitize_{$this->id}", array( $this, 'sanitize_repeater_setting' ), 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the value of the setting.
|
||||
*
|
||||
* @access public
|
||||
* @return mixed The value.
|
||||
*/
|
||||
public function value() {
|
||||
$value = parent::value();
|
||||
if ( ! is_array( $value ) ) {
|
||||
$value = array();
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the JSON encoded setting coming from Customizer to an Array.
|
||||
*
|
||||
* @access public
|
||||
* @param string $value URL Encoded JSON Value.
|
||||
* @return array
|
||||
*/
|
||||
public static function sanitize_repeater_setting( $value ){
|
||||
if ( ! is_array( $value ) ) {
|
||||
$value = json_decode( urldecode( $value ) );
|
||||
}
|
||||
$sanitized = ( empty( $value ) || ! is_array( $value ) ) ? array() : $value;
|
||||
|
||||
// Make sure that every row is an array, not an object.
|
||||
foreach ( $sanitized as $key => $_value ) {
|
||||
if ( empty( $_value ) ) {
|
||||
unset( $sanitized[ $key ] );
|
||||
} else {
|
||||
$sanitized[ $key ] = (array) $_value;
|
||||
}
|
||||
}
|
||||
|
||||
// Reindex array.
|
||||
$sanitized = array_values( $sanitized );
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row {
|
||||
border: 1px solid #999;
|
||||
margin-top: 0.5rem;
|
||||
background: #eee;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row.minimized {
|
||||
border: 1px solid #dfdfdf;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row.minimized:hover {
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row.minimized .repeater-row-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row label {
|
||||
margin-bottom: 12px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row .repeater-field.repeater-field- {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input img {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row .repeater-field.repeater-field-radio-image input:checked + label img {
|
||||
-webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.25);
|
||||
border: 1px solid #3498DB;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-fields .repeater-row .repeater-field:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater button.repeater-add {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-content {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field {
|
||||
margin-bottom: 12px;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px dotted #CCC;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field .customize-control-title {
|
||||
font-size: 13px;
|
||||
line-height: initial;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field .customize-control-description {
|
||||
font-size: 13px;
|
||||
line-height: initial;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field.repeater-field-hidden {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field-select select {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field-checkbox label {
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field-checkbox input {
|
||||
line-height: 28px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-field-textarea textarea {
|
||||
width: 100%;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-header {
|
||||
background: white;
|
||||
border: 1px solid #dfdfdf;
|
||||
position: relative;
|
||||
padding: 10px 15px;
|
||||
height: auto;
|
||||
min-height: 20px;
|
||||
line-height: 30px;
|
||||
overflow: hidden;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-header:hover {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-header .dashicons {
|
||||
font-size: 18px;
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
top: 2px;
|
||||
color: #a0a5aa;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-label {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
display: block;
|
||||
width: 90%;
|
||||
overflow: hidden;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-remove {
|
||||
color: #a00;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-row-remove:hover {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .repeater-minimize {
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
.customize-control-rara-business-repeater .remove-button,
|
||||
.customize-control-rara-business-repeater .upload-button {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
.rara-business-image-attachment {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.rara-business-image-attachment img {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.rara-business-file-attachment {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.rara-business-file-attachment .file {
|
||||
display: block;
|
||||
padding: 10px 5px;
|
||||
border: 1px dotted #c3c3c3;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
.limit {
|
||||
padding: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.limit.highlight {
|
||||
background: #D32F2F;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/** Font awesome list */
|
||||
.font-group{
|
||||
text-align: center;
|
||||
height: 350px;
|
||||
overflow-y: scroll;
|
||||
position: relative;
|
||||
border: 1px solid #EEE;
|
||||
margin: 0;
|
||||
}
|
||||
.font-group li{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
display: inline-block;
|
||||
margin: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
input[type="font"]{
|
||||
width: 100%;
|
||||
border: 0;
|
||||
}
|
||||
@@ -0,0 +1,860 @@
|
||||
/*jshint -W065 */
|
||||
var rarabusinessRepeaterRow = function( rowIndex, container, label ){
|
||||
'use strict';
|
||||
|
||||
var self = this;
|
||||
|
||||
this.rowIndex = rowIndex;
|
||||
this.container = container;
|
||||
this.label = label;
|
||||
this.header = this.container.find( '.repeater-row-header' ),
|
||||
|
||||
this.header.on( 'click', function() {
|
||||
self.toggleMinimize();
|
||||
});
|
||||
|
||||
this.container.on( 'click', '.repeater-row-remove', function() {
|
||||
self.remove();
|
||||
});
|
||||
|
||||
this.header.on( 'mousedown', function() {
|
||||
self.container.trigger( 'row:start-dragging' );
|
||||
});
|
||||
|
||||
this.container.on( 'keyup change', 'input, select, textarea', function( e ) {
|
||||
self.container.trigger( 'row:update', [ self.rowIndex, jQuery( e.target ).data( 'field' ), e.target ] );
|
||||
});
|
||||
|
||||
this.setRowIndex = function( rowIndex ) {
|
||||
this.rowIndex = rowIndex;
|
||||
this.container.attr( 'data-row', rowIndex );
|
||||
this.container.data( 'row', rowIndex );
|
||||
this.updateLabel();
|
||||
};
|
||||
|
||||
this.toggleMinimize = function() {
|
||||
// Store the previous state.
|
||||
this.container.toggleClass( 'minimized' );
|
||||
this.header.find( '.dashicons' ).toggleClass( 'dashicons-arrow-up' ).toggleClass( 'dashicons-arrow-down' );
|
||||
};
|
||||
|
||||
this.remove = function() {
|
||||
this.container.slideUp( 300, function() {
|
||||
jQuery( this ).detach();
|
||||
});
|
||||
this.container.trigger( 'row:remove', [ this.rowIndex ] );
|
||||
};
|
||||
|
||||
this.updateLabel = function() {
|
||||
var rowLabelField,
|
||||
rowLabel;
|
||||
|
||||
if ( 'field' === this.label.type ) {
|
||||
rowLabelField = this.container.find( '.repeater-field [data-field="' + this.label.field + '"]' );
|
||||
if ( 'function' === typeof rowLabelField.val ) {
|
||||
rowLabel = rowLabelField.val();
|
||||
if ( '' !== rowLabel ) {
|
||||
this.header.find( '.repeater-row-label' ).text( rowLabel );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.header.find( '.repeater-row-label' ).text( this.label.value + ' ' + ( this.rowIndex + 1 ) );
|
||||
};
|
||||
|
||||
this.updateLabel();
|
||||
};
|
||||
|
||||
wp.customize.controlConstructor['rara-business-repeater'] = wp.customize.Control.extend({
|
||||
ready: function(){
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
limit,
|
||||
theNewRow;
|
||||
|
||||
// The current value set in Control Class (set in Rara_Business_Control_Repeater::to_json() function)
|
||||
var settingValue = this.params.value;
|
||||
|
||||
// The hidden field that keeps the data saved (though we never update it)
|
||||
this.settingField = this.container.find( '[data-customize-setting-link]' ).first();
|
||||
|
||||
// Set the field value for the first time, we'll fill it up later
|
||||
this.setValue( [], false );
|
||||
|
||||
// The DIV that holds all the rows
|
||||
this.repeaterFieldsContainer = this.container.find( '.repeater-fields' ).first();
|
||||
|
||||
// Set number of rows to 0
|
||||
this.currentIndex = 0;
|
||||
|
||||
// Save the rows objects
|
||||
this.rows = [];
|
||||
|
||||
// Default limit choice
|
||||
limit = false;
|
||||
if ( 'undefined' !== typeof this.params.choices.limit ) {
|
||||
limit = ( 0 >= this.params.choices.limit ) ? false : parseInt( this.params.choices.limit );
|
||||
}
|
||||
|
||||
this.container.on( 'click', 'button.repeater-add', function( e ) {
|
||||
e.preventDefault();
|
||||
if ( ! limit || control.currentIndex < limit ) {
|
||||
theNewRow = control.addRow();
|
||||
theNewRow.toggleMinimize();
|
||||
control.initColorPicker();
|
||||
//control.initDropdownPages( theNewRow );
|
||||
} else {
|
||||
jQuery( control.selector + ' .limit' ).addClass( 'highlight' );
|
||||
}
|
||||
});
|
||||
|
||||
this.container.on( 'click', '.repeater-row-remove', function( e ) {
|
||||
control.currentIndex--;
|
||||
if ( ! limit || control.currentIndex < limit ) {
|
||||
jQuery( control.selector + ' .limit' ).removeClass( 'highlight' );
|
||||
}
|
||||
});
|
||||
|
||||
this.container.on( 'click keypress', '.repeater-field-image .upload-button,.repeater-field-cropped_image .upload-button,.repeater-field-upload .upload-button', function( e ) {
|
||||
e.preventDefault();
|
||||
control.$thisButton = jQuery( this );
|
||||
control.openFrame( e );
|
||||
});
|
||||
|
||||
this.container.on( 'click keypress', '.repeater-field-image .remove-button,.repeater-field-cropped_image .remove-button', function( e ) {
|
||||
e.preventDefault();
|
||||
control.$thisButton = jQuery( this );
|
||||
control.removeImage( e );
|
||||
});
|
||||
|
||||
this.container.on( 'click keypress', '.repeater-field-upload .remove-button', function( e ) {
|
||||
e.preventDefault();
|
||||
control.$thisButton = jQuery( this );
|
||||
control.removeFile( e );
|
||||
});
|
||||
|
||||
/**
|
||||
* Function that loads the Mustache template
|
||||
*/
|
||||
this.repeaterTemplate = _.memoize( function() {
|
||||
var compiled,
|
||||
/*
|
||||
* Underscore's default ERB-style templates are incompatible with PHP
|
||||
* when asp_tags is enabled, so WordPress uses Mustache-inspired templating syntax.
|
||||
*
|
||||
* @see trac ticket #22344.
|
||||
*/
|
||||
options = {
|
||||
evaluate: /<#([\s\S]+?)#>/g,
|
||||
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
|
||||
escape: /\{\{([^\}]+?)\}\}(?!\})/g,
|
||||
variable: 'data'
|
||||
};
|
||||
|
||||
return function( data ) {
|
||||
compiled = _.template( control.container.find( '.customize-control-repeater-content' ).first().html(), null, options );
|
||||
return compiled( data );
|
||||
};
|
||||
});
|
||||
|
||||
// When we load the control, the fields have not been filled up
|
||||
// This is the first time that we create all the rows
|
||||
if( settingValue.length ){
|
||||
_.each( settingValue, function( subValue ) {
|
||||
theNewRow = control.addRow( subValue );
|
||||
control.initColorPicker();
|
||||
//control.initDropdownPages( theNewRow, subValue );
|
||||
});
|
||||
}
|
||||
|
||||
// Once we have displayed the rows, we cleanup the values
|
||||
this.setValue( settingValue, true, true );
|
||||
|
||||
this.repeaterFieldsContainer.sortable({
|
||||
handle: '.repeater-row-header',
|
||||
update: function( e, ui ) {
|
||||
control.sort();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the media modal.
|
||||
*/
|
||||
openFrame: function( event ){
|
||||
'use strict';
|
||||
|
||||
if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.$thisButton.closest( '.repeater-field' ).hasClass( 'repeater-field-cropped_image' ) ) {
|
||||
this.initCropperFrame();
|
||||
} else {
|
||||
this.initFrame();
|
||||
}
|
||||
|
||||
this.frame.open();
|
||||
},
|
||||
|
||||
initFrame: function(){
|
||||
'use strict';
|
||||
|
||||
var libMediaType = this.getMimeType();
|
||||
|
||||
this.frame = wp.media({
|
||||
states: [
|
||||
new wp.media.controller.Library({
|
||||
library: wp.media.query({ type: libMediaType }),
|
||||
multiple: false,
|
||||
date: false
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
// When a file is selected, run a callback.
|
||||
this.frame.on( 'select', this.onSelect, this );
|
||||
},
|
||||
/**
|
||||
* Create a media modal select frame, and store it so the instance can be reused when needed.
|
||||
* This is mostly a copy/paste of Core api.CroppedImageControl in /wp-admin/js/customize-control.js
|
||||
*/
|
||||
initCropperFrame: function(){
|
||||
'use strict';
|
||||
|
||||
// We get the field id from which this was called
|
||||
var currentFieldId = this.$thisButton.siblings( 'input.hidden-field' ).attr( 'data-field' ),
|
||||
attrs = [ 'width', 'height', 'flex_width', 'flex_height' ], // A list of attributes to look for
|
||||
libMediaType = this.getMimeType();
|
||||
|
||||
// Make sure we got it
|
||||
if ( 'string' === typeof currentFieldId && '' !== currentFieldId ) {
|
||||
|
||||
// Make fields is defined and only do the hack for cropped_image
|
||||
if ( 'object' === typeof this.params.fields[ currentFieldId ] && 'cropped_image' === this.params.fields[ currentFieldId ].type ) {
|
||||
|
||||
//Iterate over the list of attributes
|
||||
attrs.forEach( function( el, index ) {
|
||||
|
||||
// If the attribute exists in the field
|
||||
if ( 'undefined' !== typeof this.params.fields[ currentFieldId ][ el ] ) {
|
||||
|
||||
// Set the attribute in the main object
|
||||
this.params[ el ] = this.params.fields[ currentFieldId ][ el ];
|
||||
}
|
||||
}.bind( this ) );
|
||||
}
|
||||
}
|
||||
|
||||
this.frame = wp.media({
|
||||
button: {
|
||||
text: 'Select and Crop',
|
||||
close: false
|
||||
},
|
||||
states: [
|
||||
new wp.media.controller.Library({
|
||||
library: wp.media.query({ type: libMediaType }),
|
||||
multiple: false,
|
||||
date: false,
|
||||
suggestedWidth: this.params.width,
|
||||
suggestedHeight: this.params.height
|
||||
}),
|
||||
new wp.media.controller.CustomizeImageCropper({
|
||||
imgSelectOptions: this.calculateImageSelectOptions,
|
||||
control: this
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
this.frame.on( 'select', this.onSelectForCrop, this );
|
||||
this.frame.on( 'cropped', this.onCropped, this );
|
||||
this.frame.on( 'skippedcrop', this.onSkippedCrop, this );
|
||||
|
||||
},
|
||||
|
||||
onSelect: function(){
|
||||
'use strict';
|
||||
|
||||
var attachment = this.frame.state().get( 'selection' ).first().toJSON();
|
||||
|
||||
if ( this.$thisButton.closest( '.repeater-field' ).hasClass( 'repeater-field-upload' ) ) {
|
||||
this.setFileInRepeaterField( attachment );
|
||||
} else {
|
||||
this.setImageInRepeaterField( attachment );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* After an image is selected in the media modal, switch to the cropper
|
||||
* state if the image isn't the right size.
|
||||
*/
|
||||
|
||||
onSelectForCrop: function(){
|
||||
'use strict';
|
||||
|
||||
var attachment = this.frame.state().get( 'selection' ).first().toJSON();
|
||||
|
||||
if ( this.params.width === attachment.width && this.params.height === attachment.height && ! this.params.flex_width && ! this.params.flex_height ) {
|
||||
this.setImageInRepeaterField( attachment );
|
||||
} else {
|
||||
this.frame.setState( 'cropper' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* After the image has been cropped, apply the cropped image data to the setting.
|
||||
*
|
||||
* @param {object} croppedImage Cropped attachment data.
|
||||
*/
|
||||
onCropped: function( croppedImage ){
|
||||
'use strict';
|
||||
|
||||
this.setImageInRepeaterField( croppedImage );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a set of options, computed from the attached image data and
|
||||
* control-specific data, to be fed to the imgAreaSelect plugin in
|
||||
* wp.media.view.Cropper.
|
||||
*
|
||||
* @param {wp.media.model.Attachment} attachment
|
||||
* @param {wp.media.controller.Cropper} controller
|
||||
* @returns {Object} Options
|
||||
*/
|
||||
calculateImageSelectOptions: function( attachment, controller ){
|
||||
'use strict';
|
||||
|
||||
var control = controller.get( 'control' ),
|
||||
flexWidth = !! parseInt( control.params.flex_width, 10 ),
|
||||
flexHeight = !! parseInt( control.params.flex_height, 10 ),
|
||||
realWidth = attachment.get( 'width' ),
|
||||
realHeight = attachment.get( 'height' ),
|
||||
xInit = parseInt( control.params.width, 10 ),
|
||||
yInit = parseInt( control.params.height, 10 ),
|
||||
ratio = xInit / yInit,
|
||||
xImg = realWidth,
|
||||
yImg = realHeight,
|
||||
x1,
|
||||
y1,
|
||||
imgSelectOptions;
|
||||
|
||||
controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) );
|
||||
|
||||
if ( xImg / yImg > ratio ) {
|
||||
yInit = yImg;
|
||||
xInit = yInit * ratio;
|
||||
} else {
|
||||
xInit = xImg;
|
||||
yInit = xInit / ratio;
|
||||
}
|
||||
|
||||
x1 = ( xImg - xInit ) / 2;
|
||||
y1 = ( yImg - yInit ) / 2;
|
||||
|
||||
imgSelectOptions = {
|
||||
handles: true,
|
||||
keys: true,
|
||||
instance: true,
|
||||
persistent: true,
|
||||
imageWidth: realWidth,
|
||||
imageHeight: realHeight,
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: xInit + x1,
|
||||
y2: yInit + y1
|
||||
};
|
||||
|
||||
if ( false === flexHeight && false === flexWidth ) {
|
||||
imgSelectOptions.aspectRatio = xInit + ':' + yInit;
|
||||
}
|
||||
if ( false === flexHeight ) {
|
||||
imgSelectOptions.maxHeight = yInit;
|
||||
}
|
||||
if ( false === flexWidth ) {
|
||||
imgSelectOptions.maxWidth = xInit;
|
||||
}
|
||||
|
||||
return imgSelectOptions;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return whether the image must be cropped, based on required dimensions.
|
||||
*
|
||||
* @param {bool} flexW
|
||||
* @param {bool} flexH
|
||||
* @param {int} dstW
|
||||
* @param {int} dstH
|
||||
* @param {int} imgW
|
||||
* @param {int} imgH
|
||||
* @return {bool}
|
||||
*/
|
||||
mustBeCropped: function( flexW, flexH, dstW, dstH, imgW, imgH ){
|
||||
'use strict';
|
||||
|
||||
if ( true === flexW && true === flexH ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( true === flexW && dstH === imgH ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( true === flexH && dstW === imgW ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( dstW === imgW && dstH === imgH ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( imgW <= dstW ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* If cropping was skipped, apply the image data directly to the setting.
|
||||
*/
|
||||
onSkippedCrop: function(){
|
||||
'use strict';
|
||||
|
||||
var attachment = this.frame.state().get( 'selection' ).first().toJSON();
|
||||
this.setImageInRepeaterField( attachment );
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the setting and re-renders the control UI.
|
||||
*
|
||||
* @param {object} attachment
|
||||
*/
|
||||
setImageInRepeaterField: function( attachment ){
|
||||
'use strict';
|
||||
|
||||
var $targetDiv = this.$thisButton.closest( '.repeater-field-image,.repeater-field-cropped_image' );
|
||||
|
||||
$targetDiv.find( '.rara-business-image-attachment' ).html( '<img src="' + attachment.url + '">' ).hide().slideDown( 'slow' );
|
||||
|
||||
$targetDiv.find( '.hidden-field' ).val( attachment.id );
|
||||
this.$thisButton.text( this.$thisButton.data( 'alt-label' ) );
|
||||
$targetDiv.find( '.remove-button' ).show();
|
||||
|
||||
//This will activate the save button
|
||||
$targetDiv.find( 'input, textarea, select' ).trigger( 'change' );
|
||||
this.frame.close();
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the setting and re-renders the control UI.
|
||||
*
|
||||
* @param {object} attachment
|
||||
*/
|
||||
setFileInRepeaterField: function( attachment ){
|
||||
'use strict';
|
||||
|
||||
var $targetDiv = this.$thisButton.closest( '.repeater-field-upload' );
|
||||
|
||||
$targetDiv.find( '.rara-business-file-attachment' ).html( '<span class="file"><span class="dashicons dashicons-media-default"></span> ' + attachment.filename + '</span>' ).hide().slideDown( 'slow' );
|
||||
|
||||
$targetDiv.find( '.hidden-field' ).val( attachment.id );
|
||||
this.$thisButton.text( this.$thisButton.data( 'alt-label' ) );
|
||||
$targetDiv.find( '.upload-button' ).show();
|
||||
$targetDiv.find( '.remove-button' ).show();
|
||||
|
||||
//This will activate the save button
|
||||
$targetDiv.find( 'input, textarea, select' ).trigger( 'change' );
|
||||
this.frame.close();
|
||||
},
|
||||
|
||||
getMimeType: function(){
|
||||
'use strict';
|
||||
|
||||
// We get the field id from which this was called
|
||||
var currentFieldId = this.$thisButton.siblings( 'input.hidden-field' ).attr( 'data-field' ),
|
||||
attrs = [ 'mime_type' ]; // A list of attributes to look for
|
||||
|
||||
// Make sure we got it
|
||||
if ( 'string' === typeof currentFieldId && '' !== currentFieldId ) {
|
||||
|
||||
// Make fields is defined and only do the hack for cropped_image
|
||||
if ( 'object' === typeof this.params.fields[ currentFieldId ] && 'upload' === this.params.fields[ currentFieldId ].type ) {
|
||||
|
||||
// If the attribute exists in the field
|
||||
if ( 'undefined' !== typeof this.params.fields[ currentFieldId ].mime_type ) {
|
||||
|
||||
// Set the attribute in the main object
|
||||
return this.params.fields[ currentFieldId ].mime_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 'image';
|
||||
},
|
||||
|
||||
removeImage: function( event ){
|
||||
'use strict';
|
||||
|
||||
var $targetDiv,
|
||||
$uploadButton;
|
||||
|
||||
if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$targetDiv = this.$thisButton.closest( '.repeater-field-image,.repeater-field-cropped_image,.repeater-field-upload' );
|
||||
$uploadButton = $targetDiv.find( '.upload-button' );
|
||||
|
||||
$targetDiv.find( '.rara-business-image-attachment' ).slideUp( 'fast', function() {
|
||||
jQuery( this ).show().html( jQuery( this ).data( 'placeholder' ) );
|
||||
});
|
||||
$targetDiv.find( '.hidden-field' ).val( '' );
|
||||
$uploadButton.text( $uploadButton.data( 'label' ) );
|
||||
this.$thisButton.hide();
|
||||
|
||||
$targetDiv.find( 'input, textarea, select' ).trigger( 'change' );
|
||||
},
|
||||
|
||||
removeFile: function( event ){
|
||||
'use strict';
|
||||
|
||||
var $targetDiv,
|
||||
$uploadButton;
|
||||
|
||||
if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$targetDiv = this.$thisButton.closest( '.repeater-field-upload' );
|
||||
$uploadButton = $targetDiv.find( '.upload-button' );
|
||||
|
||||
$targetDiv.find( '.rara-business-file-attachment' ).slideUp( 'fast', function() {
|
||||
jQuery( this ).show().html( jQuery( this ).data( 'placeholder' ) );
|
||||
});
|
||||
$targetDiv.find( '.hidden-field' ).val( '' );
|
||||
$uploadButton.text( $uploadButton.data( 'label' ) );
|
||||
this.$thisButton.hide();
|
||||
|
||||
$targetDiv.find( 'input, textarea, select' ).trigger( 'change' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the current value of the setting
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
getValue: function(){
|
||||
'use strict';
|
||||
|
||||
// The setting is saved in JSON
|
||||
return JSON.parse( decodeURI( this.setting.get() ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set a new value for the setting
|
||||
*
|
||||
* @param newValue Object
|
||||
* @param refresh If we want to refresh the previewer or not
|
||||
*/
|
||||
setValue: function( newValue, refresh, filtering ){
|
||||
'use strict';
|
||||
|
||||
// We need to filter the values after the first load to remove data requrired for diplay but that we don't want to save in DB
|
||||
var filteredValue = newValue,
|
||||
filter = [];
|
||||
|
||||
if ( filtering ) {
|
||||
jQuery.each( this.params.fields, function( index, value ) {
|
||||
if ( 'image' === value.type || 'cropped_image' === value.type || 'upload' === value.type ) {
|
||||
filter.push( index );
|
||||
}
|
||||
});
|
||||
jQuery.each( newValue, function( index, value ) {
|
||||
jQuery.each( filter, function( ind, field ) {
|
||||
if ( 'undefined' !== typeof value[field] && 'undefined' !== typeof value[field].id ) {
|
||||
filteredValue[index][field] = value[field].id;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.setting.set( encodeURI( JSON.stringify( filteredValue ) ) );
|
||||
|
||||
if ( refresh ) {
|
||||
// Trigger the change event on the hidden field so
|
||||
// previewer refresh the website on Customizer
|
||||
this.settingField.trigger( 'change' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a new row to repeater settings based on the structure.
|
||||
*
|
||||
* @param data (Optional) Object of field => value pairs (undefined if you want to get the default values)
|
||||
*/
|
||||
addRow: function( data ){
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
template = control.repeaterTemplate(), // The template for the new row (defined on Rara_Business_Control_Repeater::render_content() ).
|
||||
settingValue = this.getValue(), // Get the current setting value.
|
||||
newRowSetting = {}, // Saves the new setting data.
|
||||
templateData, // Data to pass to the template
|
||||
newRow,
|
||||
i;
|
||||
|
||||
if ( template ) {
|
||||
|
||||
// The control structure is going to define the new fields
|
||||
// We need to clone control.params.fields. Assigning it
|
||||
// ould result in a reference assignment.
|
||||
templateData = jQuery.extend( true, {}, control.params.fields );
|
||||
|
||||
// But if we have passed data, we'll use the data values instead
|
||||
if ( data ) {
|
||||
for ( i in data ) {
|
||||
if ( data.hasOwnProperty( i ) && templateData.hasOwnProperty( i ) ) {
|
||||
templateData[ i ]['default'] = data[ i ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templateData.index = this.currentIndex;
|
||||
|
||||
// Append the template content
|
||||
template = template( templateData );
|
||||
|
||||
// Create a new row object and append the element
|
||||
newRow = new rarabusinessRepeaterRow(
|
||||
control.currentIndex,
|
||||
jQuery( template ).appendTo( control.repeaterFieldsContainer ),
|
||||
control.params.row_label
|
||||
);
|
||||
|
||||
newRow.container.on( 'row:remove', function( e, rowIndex ) {
|
||||
control.deleteRow( rowIndex );
|
||||
});
|
||||
|
||||
newRow.container.on( 'row:update', function( e, rowIndex, fieldName, element ) {
|
||||
control.updateField.call( control, e, rowIndex, fieldName, element );
|
||||
newRow.updateLabel();
|
||||
});
|
||||
|
||||
// Add the row to rows collection
|
||||
this.rows[ this.currentIndex ] = newRow;
|
||||
|
||||
for ( i in templateData ) {
|
||||
if ( templateData.hasOwnProperty( i ) ) {
|
||||
newRowSetting[ i ] = templateData[ i ]['default'];
|
||||
}
|
||||
}
|
||||
|
||||
settingValue[ this.currentIndex ] = newRowSetting;
|
||||
this.setValue( settingValue, true );
|
||||
|
||||
this.currentIndex++;
|
||||
|
||||
return newRow;
|
||||
}
|
||||
},
|
||||
|
||||
sort: function(){
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
$rows = this.repeaterFieldsContainer.find( '.repeater-row' ),
|
||||
newOrder = [],
|
||||
settings = control.getValue(),
|
||||
newRows = [],
|
||||
newSettings = [];
|
||||
|
||||
$rows.each( function( i, element ) {
|
||||
newOrder.push( jQuery( element ).data( 'row' ) );
|
||||
});
|
||||
|
||||
jQuery.each( newOrder, function( newPosition, oldPosition ) {
|
||||
newRows[ newPosition ] = control.rows[ oldPosition ];
|
||||
newRows[ newPosition ].setRowIndex( newPosition );
|
||||
|
||||
newSettings[ newPosition ] = settings[ oldPosition ];
|
||||
});
|
||||
|
||||
control.rows = newRows;
|
||||
control.setValue( newSettings );
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete a row in the repeater setting
|
||||
*
|
||||
* @param index Position of the row in the complete Setting Array
|
||||
*/
|
||||
deleteRow: function( index ){
|
||||
'use strict';
|
||||
|
||||
var currentSettings = this.getValue(),
|
||||
row,
|
||||
i,
|
||||
prop;
|
||||
|
||||
if ( currentSettings[ index ] ) {
|
||||
|
||||
// Find the row
|
||||
row = this.rows[ index ];
|
||||
if ( row ) {
|
||||
|
||||
// The row exists, let's delete it
|
||||
|
||||
// Remove the row settings
|
||||
delete currentSettings[ index ];
|
||||
|
||||
// Remove the row from the rows collection
|
||||
delete this.rows[ index ];
|
||||
|
||||
// Update the new setting values
|
||||
this.setValue( currentSettings, true );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Remap the row numbers
|
||||
i = 1;
|
||||
for ( prop in this.rows ) {
|
||||
if ( this.rows.hasOwnProperty( prop ) && this.rows[ prop ] ) {
|
||||
this.rows[ prop ].updateLabel();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update a single field inside a row.
|
||||
* Triggered when a field has changed
|
||||
*
|
||||
* @param e Event Object
|
||||
*/
|
||||
updateField: function( e, rowIndex, fieldId, element ){
|
||||
'use strict';
|
||||
|
||||
var type,
|
||||
row,
|
||||
currentSettings;
|
||||
|
||||
if ( ! this.rows[ rowIndex ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! this.params.fields[ fieldId ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
type = this.params.fields[ fieldId].type;
|
||||
row = this.rows[ rowIndex ];
|
||||
currentSettings = this.getValue();
|
||||
|
||||
element = jQuery( element );
|
||||
|
||||
if ( 'undefined' === typeof currentSettings[ row.rowIndex ][ fieldId ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'checkbox' === type ) {
|
||||
|
||||
currentSettings[ row.rowIndex ][ fieldId ] = element.is( ':checked' );
|
||||
|
||||
} else {
|
||||
|
||||
// Update the settings
|
||||
currentSettings[ row.rowIndex ][ fieldId ] = element.val();
|
||||
|
||||
}
|
||||
this.setValue( currentSettings, true );
|
||||
},
|
||||
|
||||
/**
|
||||
* Init the color picker on color fields
|
||||
* Called after AddRow
|
||||
*
|
||||
*/
|
||||
initColorPicker: function(){
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
colorPicker = control.container.find( '.color-picker-hex' ),
|
||||
options = {},
|
||||
fieldId = colorPicker.data( 'field' );
|
||||
|
||||
// We check if the color palette parameter is defined.
|
||||
if ( 'undefined' !== typeof fieldId && 'undefined' !== typeof control.params.fields[ fieldId ] && 'undefined' !== typeof control.params.fields[ fieldId ].palettes && 'object' === typeof control.params.fields[ fieldId ].palettes ) {
|
||||
options.palettes = control.params.fields[ fieldId ].palettes;
|
||||
}
|
||||
|
||||
// When the color picker value is changed we update the value of the field
|
||||
options.change = function( event, ui ) {
|
||||
|
||||
var currentPicker = jQuery( event.target ),
|
||||
row = currentPicker.closest( '.repeater-row' ),
|
||||
rowIndex = row.data( 'row' ),
|
||||
currentSettings = control.getValue();
|
||||
|
||||
currentSettings[ rowIndex ][ currentPicker.data( 'field' ) ] = ui.color.toString();
|
||||
control.setValue( currentSettings, true );
|
||||
|
||||
};
|
||||
|
||||
// Init the color picker
|
||||
if ( 0 !== colorPicker.length ) {
|
||||
colorPicker.wpColorPicker( options );
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
jQuery( document ).ready(function($){
|
||||
'use strict';
|
||||
$(document).on('click','.repeater-add',function() {
|
||||
$('.repeater-field').find('input[type="font"]').attr('placeholder','search icons');
|
||||
});
|
||||
|
||||
$(document).on( 'click', 'input[type="font"]', function(){
|
||||
var $this = $(this);
|
||||
if( ( ! $this.hasClass('ajax-running') ) && $this.siblings( '.font-awesome-list' ).length < 1 ){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url : ajaxurl,
|
||||
data: {
|
||||
action : 'rara_business_get_fontawesome_ajax',
|
||||
rara_business_customize_nonce: rara_business_customize.nonce
|
||||
},
|
||||
beforeSend: function(){
|
||||
$this.addClass('ajax-running');
|
||||
},
|
||||
success: function (response) {
|
||||
var html = '<div class="font-awesome-list">'+response+'</div>';
|
||||
$this.after(html);
|
||||
$this.removeClass('ajax-running');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on( 'click', '.font-group li', function(event){
|
||||
var val = $(this).data( 'font' );
|
||||
$(this).parent().parent().siblings( 'input[type="font"]' ).val( val );
|
||||
$(this).parent().parent().siblings( 'input[type="font"]' ).trigger( 'change' );
|
||||
$(this).parent().parent().fadeOut( 'slow', function(){
|
||||
$(this).remove();
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$(document).on( 'keyup', 'input[type="font"]', function(){
|
||||
var value = $(this).val();
|
||||
var matcher = new RegExp( value, 'gi' );
|
||||
$(this).next( '.font-awesome-list' ).children('.font-group').children( 'li' ).show().not(function(){
|
||||
return matcher.test( $(this).find( 'svg' ).attr( 'class' ) );
|
||||
}).hide();
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: rara-business-select.
|
||||
*
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_Select_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Select control.
|
||||
*/
|
||||
class Rara_Business_Select_Control extends WP_Customize_Control {
|
||||
|
||||
public $type = 'rara-business-select';
|
||||
|
||||
public $multiple = 1;
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['multiple'] = $this->multiple;
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'rara-business-selectize', get_template_directory_uri() . '/inc/custom-controls/select/select.css', null );
|
||||
wp_enqueue_script( 'rara-business-selectize', get_template_directory_uri() . '/inc/custom-controls/select/selectize.js', array( 'jquery' ) ); //for multi select
|
||||
wp_enqueue_script( 'rara-business-select', get_template_directory_uri() . '/inc/custom-controls/select/select.js', array( 'jquery', 'rara-business-selectize' ), false, true ); //for multi select
|
||||
}
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( ! data.choices ) return; #>
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
<label>
|
||||
<# if ( data.label ) { #>
|
||||
<span class="customize-control-title">{{ data.label }}</span>
|
||||
<# } #>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<select {{{ data.inputAttrs }}} {{{ data.link }}} data-multiple="{{ data.multiple }}"<# if ( 1 < data.multiple ) { #> multiple<# } #>>
|
||||
<# if ( 1 < data.multiple && data.value ) { #>
|
||||
<# for ( key in data.value ) { #>
|
||||
<option value="{{ data.value[ key ] }}" selected>{{ data.choices[ data.value[ key ] ] }}</option>
|
||||
<# } #>
|
||||
<# for ( key in data.choices ) { #>
|
||||
<# if ( data.value[ key ] in data.value ) { #>
|
||||
<# } else { #>
|
||||
<option value="{{ key }}">{{ data.choices[ key ] }}</option>
|
||||
<# } #>
|
||||
<# } #>
|
||||
<# } else { #>
|
||||
<# for ( key in data.choices ) { #>
|
||||
<option value="{{ key }}"<# if ( key === data.value ) { #>selected<# } #>>{{ data.choices[ key ] }}</option>
|
||||
<# } #>
|
||||
<# } #>
|
||||
</select>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
/* Select Control */
|
||||
.selectize-control {
|
||||
position: relative;
|
||||
}
|
||||
.selectize-control.single .selectize-input,
|
||||
.selectize-control.single .selectize-input input {
|
||||
cursor: pointer;
|
||||
}
|
||||
.selectize-control.single .selectize-input.input-active, .selectize-control.single .selectize-input.input-active input {
|
||||
cursor: text;
|
||||
}
|
||||
.selectize-control.single .selectize-input:after {
|
||||
content: "\f347";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin-top: 0;
|
||||
width: 12px;
|
||||
height: 36px;
|
||||
font-family: dashicons;
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.06);
|
||||
line-height: 36px;
|
||||
padding: 0 3px;
|
||||
}
|
||||
.selectize-control.single .selectize-input.dropdown-active:after {
|
||||
content: "\f343";
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.selectize-control.single .selectize-input.disabled {
|
||||
opacity: 0.5;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
.selectize-control.single.rtl .selectize-input:after {
|
||||
left: 15px;
|
||||
right: auto;
|
||||
}
|
||||
.selectize-control.rtl .selectize-input > input {
|
||||
margin: 0 4px 0 -2px !important;
|
||||
}
|
||||
.selectize-control .plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
|
||||
visibility: visible !important;
|
||||
background: #f2f2f2 !important;
|
||||
background: rgba(0, 0, 0, 0.06) !important;
|
||||
border: 0 none !important;
|
||||
-webkit-box-shadow: inset 0 0 12px 4px #ffffff;
|
||||
box-shadow: inset 0 0 12px 4px #ffffff;
|
||||
}
|
||||
.selectize-control .plugin-drag_drop .ui-sortable-placeholder::after {
|
||||
content: '!';
|
||||
visibility: hidden;
|
||||
}
|
||||
.selectize-control .plugin-drag_drop .ui-sortable-helper {
|
||||
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.selectize-control .plugin-remove_button [data-value] {
|
||||
position: relative;
|
||||
padding-right: 24px !important;
|
||||
}
|
||||
.selectize-control .plugin-remove_button [data-value] .remove {
|
||||
z-index: 1;
|
||||
/* fixes ie bug (see #392) */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 17px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
padding: 2px 0 0 0;
|
||||
border-left: 1px solid #d0d0d0;
|
||||
-webkit-border-radius: 0 2px 2px 0;
|
||||
-moz-border-radius: 0 2px 2px 0;
|
||||
border-radius: 0 2px 2px 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.selectize-control .plugin-remove_button .remove:hover {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.selectize-control .plugin-remove_button.active .remove {
|
||||
border-left-color: #cacaca;
|
||||
}
|
||||
.selectize-control .plugin .disabled [data-value] .remove:hover {
|
||||
background: none;
|
||||
}
|
||||
.selectize-control .plugin .disabled [data-value] .remove {
|
||||
border-left-color: #ffffff;
|
||||
}
|
||||
.selectize-control.multi .selectize-input {
|
||||
min-height: 36px;
|
||||
}
|
||||
.selectize-control.multi .selectize-input.has-items {
|
||||
padding: 6px 8px 3px;
|
||||
}
|
||||
.selectize-control.multi .selectize-input > div {
|
||||
cursor: pointer;
|
||||
margin: 0 3px 3px 0;
|
||||
padding: 2px 6px;
|
||||
background: #f2f2f2;
|
||||
color: #303030;
|
||||
border: 0 solid #d0d0d0;
|
||||
}
|
||||
.selectize-control.multi .selectize-input > div.active {
|
||||
background: #e8e8e8;
|
||||
color: #303030;
|
||||
border: 0 solid #cacaca;
|
||||
}
|
||||
.selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active {
|
||||
color: #7d7d7d;
|
||||
background: #ffffff;
|
||||
border: 0 solid #ffffff;
|
||||
}
|
||||
.selectize-dropdown {
|
||||
position: relative;
|
||||
top: -4px !important;
|
||||
z-index: 10;
|
||||
border: 1px solid #d0d0d0;
|
||||
background: #ffffff;
|
||||
margin: -1px 0 0 0;
|
||||
border-top: 0 none;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
-webkit-border-radius: 0 0 3px 3px;
|
||||
-moz-border-radius: 0 0 3px 3px;
|
||||
border-radius: 0 0 3px 3px;
|
||||
z-index: 999;
|
||||
}
|
||||
.selectize-dropdown-header {
|
||||
position: relative;
|
||||
padding: 5px 8px;
|
||||
border-bottom: 1px solid #d0d0d0;
|
||||
background: #f8f8f8;
|
||||
-webkit-border-radius: 3px 3px 0 0;
|
||||
-moz-border-radius: 3px 3px 0 0;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
.selectize-dropdown-header-close {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 50%;
|
||||
color: #303030;
|
||||
opacity: 0.4;
|
||||
margin-top: -12px;
|
||||
line-height: 20px;
|
||||
font-size: 20px !important;
|
||||
}
|
||||
.selectize-dropdown-header-close:hover {
|
||||
color: #000000;
|
||||
}
|
||||
.selectize-dropdown.plugin-optgroup_columns .optgroup {
|
||||
border-right: 1px solid #f2f2f2;
|
||||
border-top: 0 none;
|
||||
float: left;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
|
||||
border-right: 0 none;
|
||||
}
|
||||
.selectize-dropdown.plugin-optgroup_columns .optgroup:before {
|
||||
display: none;
|
||||
}
|
||||
.selectize-dropdown.plugin-optgroup_columns .optgroup-header {
|
||||
border-top: 0 none;
|
||||
}
|
||||
.selectize-dropdown, .selectize-input, .selectize-input input {
|
||||
color: #303030;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
-webkit-font-smoothing: inherit;
|
||||
}
|
||||
.selectize-input, .selectize-control.single .selectize-input.input-active {
|
||||
background: #ffffff;
|
||||
cursor: text;
|
||||
display: inline-block;
|
||||
}
|
||||
.selectize-input {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
padding: 8px 8px;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.selectize-input.full {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.selectize-input.disabled, .selectize-input.disabled * {
|
||||
cursor: default !important;
|
||||
}
|
||||
.selectize-input.focus {
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.selectize-input.dropdown-active {
|
||||
-webkit-border-radius: 3px 3px 0 0;
|
||||
-moz-border-radius: 3px 3px 0 0;
|
||||
border-radius: 3px 3px 0 0;
|
||||
}
|
||||
.selectize-input > * {
|
||||
vertical-align: baseline;
|
||||
display: -moz-inline-stack;
|
||||
display: inline-block;
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
.selectize-input > input {
|
||||
display: inline-block !important;
|
||||
padding: 0 !important;
|
||||
min-height: 0 !important;
|
||||
max-height: none !important;
|
||||
max-width: 100% !important;
|
||||
margin: 0 2px 0 0 !important;
|
||||
text-indent: 0 !important;
|
||||
border: 0 none !important;
|
||||
background: none !important;
|
||||
line-height: inherit !important;
|
||||
-webkit-user-select: auto !important;
|
||||
-webkit-box-shadow: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
.selectize-input > input::-ms-clear {
|
||||
display: none;
|
||||
}
|
||||
.selectize-input > input:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
.selectize-input::after {
|
||||
content: ' ';
|
||||
display: block;
|
||||
clear: left;
|
||||
}
|
||||
.selectize-input.dropdown-active::before {
|
||||
content: ' ';
|
||||
display: block;
|
||||
position: absolute;
|
||||
background: #f0f0f0;
|
||||
height: 1px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.selectize-dropdown [data-selectable] {
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
}
|
||||
.selectize-dropdown [data-selectable] .highlight {
|
||||
background: rgba(125, 168, 208, 0.2);
|
||||
-webkit-border-radius: 1px;
|
||||
-moz-border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
}
|
||||
.selectize-dropdown [data-selectable],
|
||||
.selectize-dropdown .optgroup-header {
|
||||
padding: 5px 8px;
|
||||
}
|
||||
.selectize-dropdown .optgroup:first-child .optgroup-header {
|
||||
border-top: 0 none;
|
||||
}
|
||||
.selectize-dropdown .optgroup-header {
|
||||
color: #303030;
|
||||
background: #ffffff;
|
||||
cursor: default;
|
||||
}
|
||||
.selectize-dropdown .active {
|
||||
background-color: #f5fafd;
|
||||
color: #495c68;
|
||||
}
|
||||
.selectize-dropdown .active.create {
|
||||
color: #495c68;
|
||||
}
|
||||
.selectize-dropdown .create {
|
||||
color: rgba(48, 48, 48, 0.5);
|
||||
}
|
||||
.selectize-dropdown-content {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
max-height: 200px;
|
||||
}
|
||||
/* Select Control Ends */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*jshint -W065 */
|
||||
wp.customize.controlConstructor['rara-business-select'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
element = this.container.find( 'select' ),
|
||||
multiple = parseInt( element.data( 'multiple' ) ),
|
||||
selectValue;
|
||||
|
||||
// If this is a multi-select control,
|
||||
// then we'll need to initialize selectize using the appropriate arguments.
|
||||
// If this is a single-select, then we can initialize selectize without any arguments.
|
||||
if ( multiple > 1 ) {
|
||||
jQuery( element ).selectize({
|
||||
maxItems: multiple,
|
||||
plugins: ['remove_button', 'drag_drop']
|
||||
});
|
||||
} else {
|
||||
jQuery( element ).selectize();
|
||||
}
|
||||
|
||||
// Change value
|
||||
this.container.on( 'change', 'select', function() {
|
||||
|
||||
selectValue = jQuery( this ).val();
|
||||
|
||||
// If this is a multi-select, then we need to convert the value to an object.
|
||||
if ( multiple > 1 ) {
|
||||
selectValue = _.extend( {}, jQuery( this ).val() );
|
||||
}
|
||||
|
||||
control.setting.set( selectValue );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: slider.
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_Slider_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Slider control (range).
|
||||
*/
|
||||
class Rara_Business_Slider_Control extends WP_Customize_Control {
|
||||
|
||||
public $type = 'slider';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
$this->json['choices']['min'] = ( isset( $this->choices['min'] ) ) ? $this->choices['min'] : '0';
|
||||
$this->json['choices']['max'] = ( isset( $this->choices['max'] ) ) ? $this->choices['max'] : '100';
|
||||
$this->json['choices']['step'] = ( isset( $this->choices['step'] ) ) ? $this->choices['step'] : '1';
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'rara-business-slider', get_template_directory_uri() . '/inc/custom-controls/slider/slider.css', null );
|
||||
wp_enqueue_script( 'rara-business-slider', get_template_directory_uri() . '/inc/custom-controls/slider/slider.js', array( 'jquery' ), false, true ); //for slider
|
||||
}
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
<label>
|
||||
<# if ( data.label ) { #>
|
||||
<span class="customize-control-title">{{{ data.label }}}</span>
|
||||
<# } #>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<div class="wrapper">
|
||||
<input {{{ data.inputAttrs }}} type="range" min="{{ data.choices['min'] }}" max="{{ data.choices['max'] }}" step="{{ data.choices['step'] }}" value="{{ data.value }}" {{{ data.link }}} data-reset_value="{{ data.default }}" />
|
||||
<div class="range_value">
|
||||
<span class="value">{{ data.value }}</span>
|
||||
<# if ( data.choices['suffix'] ) { #>
|
||||
{{ data.choices['suffix'] }}
|
||||
<# } #>
|
||||
</div>
|
||||
<div class="slider-reset">
|
||||
<span class="dashicons dashicons-image-rotate"></span>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
.customize-control-slider input[type=range] {
|
||||
-webkit-appearance: none;
|
||||
-webkit-transition: background .3s;
|
||||
-moz-transition: background .3s;
|
||||
transition: background .3s;
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
height: 5px;
|
||||
width: calc(100% - 70px);
|
||||
padding: 0;
|
||||
}
|
||||
.customize-control-slider input[type=range]:focus {
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
}
|
||||
.customize-control-slider input[type=range]:hover {
|
||||
background-color: rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.customize-control-slider input[type=range]::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
-webkit-border-radius: 50%;
|
||||
background-color: #3498D9;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background-color: #3498D9;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-moz-range-thumb {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background-color: #3498D9;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-ms-thumb {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
border-radius: 50%;
|
||||
border: 0;
|
||||
background-color: #3498D9;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-moz-range-track {
|
||||
border: inherit;
|
||||
background: transparent;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-ms-track {
|
||||
border: inherit;
|
||||
color: transparent;
|
||||
background: transparent;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-ms-fill-lower, .customize-control-slider input[type=range]::-ms-fill-upper {
|
||||
background: transparent;
|
||||
}
|
||||
.customize-control-slider input[type=range]::-ms-tooltip {
|
||||
display: none;
|
||||
}
|
||||
.customize-control-slider .range_value {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
padding: 0 5px;
|
||||
font-weight: 400;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
.customize-control-slider .range_value {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
padding: 0 5px;
|
||||
font-weight: 400;
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
.customize-control-slider .slider-reset {
|
||||
color: rgba(0, 0, 0, 0.2);
|
||||
float: right;
|
||||
-webkit-transition: color .5s ease-in;
|
||||
-moz-transition: color .5s ease-in;
|
||||
-ms-transition: color .5s ease-in;
|
||||
-o-transition: color .5s ease-in;
|
||||
transition: color .5s ease-in;
|
||||
}
|
||||
.customize-control-slider .slider-reset span {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.customize-control-slider .slider-reset:hover {
|
||||
color: red;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
wp.customize.controlConstructor['slider'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
value,
|
||||
thisInput,
|
||||
inputDefault,
|
||||
changeAction;
|
||||
|
||||
// Update the text value
|
||||
jQuery(document).on('input change', 'input[type=range]', function() {
|
||||
jQuery( this ).closest( 'label' ).find( '.range_value .value' ).html(jQuery(this).val());
|
||||
});
|
||||
|
||||
// Handle the reset button
|
||||
jQuery( '.slider-reset' ).on( 'click', function() {
|
||||
thisInput = jQuery( this ).closest( 'label' ).find( 'input' );
|
||||
inputDefault = thisInput.data( 'reset_value' );
|
||||
thisInput.val( inputDefault );
|
||||
thisInput.change();
|
||||
jQuery( this ).closest( 'label' ).find( '.range_value .value' ).text( inputDefault );
|
||||
});
|
||||
|
||||
if ( 'postMessage' === control.setting.transport ) {
|
||||
changeAction = 'mousemove change';
|
||||
} else {
|
||||
changeAction = 'change';
|
||||
}
|
||||
|
||||
// Save changes.
|
||||
this.container.on( changeAction, 'input', function() {
|
||||
control.setting.set( jQuery( this ).val() );
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: toggle.
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Rara_Business_Toggle_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Toggle control (modified checkbox).
|
||||
*/
|
||||
class Rara_Business_Toggle_Control extends WP_Customize_Control {
|
||||
|
||||
public $type = 'toggle';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'rara-business-toggle', get_template_directory_uri() . '/inc/custom-controls/toggle/toggle.css', null );
|
||||
wp_enqueue_script( 'rara-business-toggle', get_template_directory_uri() . '/inc/custom-controls/toggle/toggle.js', array( 'jquery' ), false, true ); //for toggle
|
||||
}
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
<label for="toggle_{{ data.id }}">
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<input {{{ data.inputAttrs }}} name="toggle_{{ data.id }}" id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( '1' == data.value ) { #> checked<# } #> hidden />
|
||||
<span class="switch"></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
.customize-control-toggle label {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.customize-control-toggle label .customize-control-title {
|
||||
width: calc(100% - 55px);
|
||||
}
|
||||
.customize-control-toggle label .description {
|
||||
order: 99;
|
||||
}
|
||||
.customize-control-toggle input[type="checkbox"] {
|
||||
display: none;
|
||||
}
|
||||
.customize-control-toggle .switch {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 12px;
|
||||
border-radius: 8px;
|
||||
background: #ccc;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: background 350ms ease;
|
||||
}
|
||||
.customize-control-toggle .switch:before, .customize-control-toggle .switch:after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -3px;
|
||||
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
}
|
||||
.customize-control-toggle .switch:before {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
transform: translate3d(0, -50%, 0) scale(0);
|
||||
}
|
||||
.customize-control-toggle .switch:after {
|
||||
background: #999;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
transform: translate3d(0, -50%, 0);
|
||||
}
|
||||
.customize-control-toggle .switch:active:before {
|
||||
transform: translate3d(0, -50%, 0) scale(3);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch {
|
||||
background: rgba(52, 152, 222, 0.3);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:before {
|
||||
background: rgba(52, 152, 222, 0.075);
|
||||
transform: translate3d(100%, -50%, 0) scale(1);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:after {
|
||||
background: #3498DE;
|
||||
transform: translate3d(100%, -50%, 0);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:active:before {
|
||||
background: rgba(52, 152, 222, 0.075);
|
||||
transform: translate3d(100%, -50%, 0) scale(3);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
wp.customize.controlConstructor['toggle'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
checkboxValue = control.setting._value;
|
||||
|
||||
// Save the value
|
||||
this.container.on( 'change', 'input', function() {
|
||||
checkboxValue = ( jQuery( this ).is( ':checked' ) ) ? true : false;
|
||||
control.setting.set( checkboxValue );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,562 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Custom functions
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_setup' ) ) :
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
function rara_business_setup() {
|
||||
/*
|
||||
* Make theme available for translation.
|
||||
* Translations can be filed in the /languages/ directory.
|
||||
* If you're building a theme based on Rara Business, use a find and replace
|
||||
* to change 'rara-business' to the name of your theme in all the template files.
|
||||
*/
|
||||
load_theme_textdomain( 'rara-business', 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' );
|
||||
|
||||
/*
|
||||
* 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' );
|
||||
|
||||
// This theme uses wp_nav_menu() in one location.
|
||||
register_nav_menus( array(
|
||||
'primary' => esc_html__( 'Primary', 'rara-business' ),
|
||||
) );
|
||||
|
||||
/*
|
||||
* Switch default core markup for search form, comment form, and comments
|
||||
* to output valid HTML5.
|
||||
*/
|
||||
add_theme_support( 'html5', array(
|
||||
'search-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
) );
|
||||
|
||||
// Set up the WordPress core custom background feature.
|
||||
add_theme_support( 'custom-background', apply_filters( 'rara_business_custom_background_args', array(
|
||||
'default-color' => 'ffffff',
|
||||
'default-image' => '',
|
||||
) ) );
|
||||
|
||||
// Add excerpt support for page.
|
||||
add_post_type_support( 'page', 'excerpt' );
|
||||
|
||||
// Add theme support for selective refresh for widgets.
|
||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||
|
||||
/**
|
||||
* Add support for core custom logo.
|
||||
*
|
||||
* @link https://codex.wordpress.org/Theme_Logo
|
||||
*/
|
||||
add_theme_support( 'custom-logo', array(
|
||||
'header-text' => array( 'site-title', 'site-description' ),
|
||||
) );
|
||||
|
||||
add_theme_support( 'custom-header', apply_filters( 'rara_business_custom_header_args', array(
|
||||
'default-image' => get_template_directory_uri().'/images/banner-image.jpg',
|
||||
'width' => 1920,
|
||||
'height' => 780,
|
||||
'header-text' => false,
|
||||
'video' => true,
|
||||
) ) );
|
||||
|
||||
register_default_headers( array(
|
||||
'default-image' => array(
|
||||
'url' => '%s/images/banner-image.jpg',
|
||||
'thumbnail_url' => '%s/images/banner-image.jpg',
|
||||
'description' => __( 'Default Header Image', 'rara-business' ),
|
||||
),
|
||||
) );
|
||||
|
||||
/** Images sizes */
|
||||
add_image_size( 'rara-business-featured', 770, 499, true );
|
||||
add_image_size( 'rara-business-team', 370, 280, true );
|
||||
add_image_size( 'rara-business-blog', 370, 240, true );
|
||||
add_image_size( 'rara-business-portfolio', 370, 370, true );
|
||||
add_image_size( 'rara-business-schema', 600, 60 );
|
||||
|
||||
/** Starter Content */
|
||||
$starter_content = array(
|
||||
// Specify the core-defined pages to create and add custom thumbnails to some of them.
|
||||
'posts' => array(
|
||||
'home',
|
||||
'blog',
|
||||
'portfolio' => array(
|
||||
'post_type' => 'page',
|
||||
'post_title' => 'Portfolio',
|
||||
'template' => 'templates/portfolio.php',
|
||||
)
|
||||
),
|
||||
|
||||
// Default to a static front page and assign the front and posts pages.
|
||||
'options' => array(
|
||||
'show_on_front' => 'page',
|
||||
'page_on_front' => '{{home}}',
|
||||
'page_for_posts' => '{{blog}}',
|
||||
),
|
||||
|
||||
// Set up nav menus for each of the two areas registered in the theme.
|
||||
'nav_menus' => array(
|
||||
// Assign a menu to the "top" location.
|
||||
'primary' => array(
|
||||
'name' => __( 'Primary', 'rara-business' ),
|
||||
'items' => array(
|
||||
'page_home',
|
||||
'page_blog',
|
||||
'page_portfolio' => array(
|
||||
'type' => 'post_type',
|
||||
'object' => 'page',
|
||||
'object_id' => '{{portfolio}}',
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$starter_content = apply_filters( 'rara_business_starter_content', $starter_content );
|
||||
|
||||
add_theme_support( 'starter-content', $starter_content );
|
||||
|
||||
// Add theme support for Responsive Videos.
|
||||
add_theme_support( 'jetpack-responsive-videos' );
|
||||
|
||||
remove_theme_support( 'widgets-block-editor' );
|
||||
}
|
||||
endif;
|
||||
add_action( 'after_setup_theme', 'rara_business_setup' );
|
||||
|
||||
/**
|
||||
* 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 rara_business_content_width() {
|
||||
$GLOBALS['content_width'] = apply_filters( 'rara_business_content_width', 770 );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'rara_business_content_width', 0 );
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles.
|
||||
*/
|
||||
function rara_business_scripts() {
|
||||
// Use minified libraries if SCRIPT_DEBUG is turned off
|
||||
$build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : '';
|
||||
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
||||
$rtc_activated = rara_business_is_rara_theme_companion_activated();
|
||||
|
||||
wp_enqueue_style( 'animate', get_template_directory_uri(). '/css' . $build . '/animate' . $suffix . '.css', array(), '3.5.2' );
|
||||
|
||||
if( get_theme_mod( 'ed_localgoogle_fonts',false ) && ! is_customize_preview() && ! is_admin() ){
|
||||
if ( get_theme_mod( 'ed_preload_local_fonts',false ) ) {
|
||||
rara_business_load_preload_local_fonts( rara_business_get_webfont_url( rara_business_fonts_url() ) );
|
||||
}
|
||||
wp_enqueue_style( 'rara-business-google-fonts', rara_business_get_webfont_url( rara_business_fonts_url() ) );
|
||||
}else{
|
||||
wp_enqueue_style( 'rara-business-google-fonts', rara_business_fonts_url(), array(), null );
|
||||
}
|
||||
|
||||
if( rara_business_is_woocommerce_activated() ){
|
||||
wp_enqueue_style( 'rara-business-woocommerce', get_template_directory_uri(). '/css' . $build . '/woocommerce-style' . $suffix . '.css' );
|
||||
}
|
||||
|
||||
if( $rtc_activated && is_active_widget( false, false, 'rrtc_description_widget' ) ){
|
||||
wp_enqueue_style( 'perfect-scrollbar', get_template_directory_uri(). '/css' . $build . '/perfect-scrollbar' . $suffix . '.css', array(), '1.3.0' );
|
||||
wp_enqueue_script( 'perfect-scrollbar', get_template_directory_uri() . '/js' . $build . '/perfect-scrollbar' . $suffix . '.js', array( 'jquery' ), '1.3.0', true );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'rara-business-style', get_stylesheet_uri(), array(), RARA_BUSINESS_THEME_VERSION );
|
||||
|
||||
if( $rtc_activated && ( is_front_page() || is_page_template( 'templates/portfolio.php' ) ) ){
|
||||
wp_enqueue_script( 'masonry' );
|
||||
wp_enqueue_script( 'isotope-pkgd', get_template_directory_uri() . '/js' . $build . '/isotope.pkgd' . $suffix . '.js', array( 'jquery' ), '3.0.5', true );
|
||||
}
|
||||
wp_enqueue_script( 'all', get_template_directory_uri() . '/js' . $build . '/all' . $suffix . '.js', array( 'jquery' ), '6.1.1', true );
|
||||
wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/js' . $build . '/v4-shims' . $suffix . '.js', array( 'jquery' ), '6.1.1', true );
|
||||
wp_enqueue_script( 'rara-business-modal-accessibility', get_template_directory_uri() . '/js' . $build . '/modal-accessibility' . $suffix . '.js', array( 'jquery' ), RARA_BUSINESS_THEME_VERSION, true );
|
||||
if( get_theme_mod( 'ed_animation',true ) ){
|
||||
wp_enqueue_script( 'wow', get_template_directory_uri() . '/js' . $build . '/wow' . $suffix . '.js', array( 'jquery' ), RARA_BUSINESS_THEME_VERSION, true );
|
||||
}
|
||||
|
||||
// Register custom js
|
||||
wp_register_script( 'rara-business-custom', get_template_directory_uri() . '/js' . $build . '/custom' . $suffix . '.js', array( 'jquery' ), RARA_BUSINESS_THEME_VERSION, true );
|
||||
|
||||
$localize_array = array(
|
||||
// Rtl
|
||||
'rtl' => is_rtl(),
|
||||
'animation' => esc_attr( get_theme_mod( 'ed_animation', true ) ),
|
||||
);
|
||||
|
||||
wp_localize_script( 'rara-business-custom', 'rb_localize_data', $localize_array );
|
||||
|
||||
// Enqueued custom script with localized data.
|
||||
wp_enqueue_script( 'rara-business-custom' );
|
||||
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'rara_business_scripts' );
|
||||
|
||||
/**
|
||||
* Enqueue admin scripts.
|
||||
*/
|
||||
function rara_business_admin_scripts( $hook_suffix ) {
|
||||
// Register admin js script
|
||||
wp_register_script( 'rara-business-admin-js', get_template_directory_uri().'/inc/js/admin.js', array( 'jquery' ), RARA_BUSINESS_THEME_VERSION, true );
|
||||
|
||||
// localize script to remove metabox in front page
|
||||
$show_front = get_option( 'show_on_front' ); //What to show on the front page
|
||||
$front_page_id = get_option( 'page_on_front' ); //The ID of the static front page.
|
||||
$frontpage_sections = rara_business_get_home_sections();
|
||||
|
||||
$admin_data = array();
|
||||
if ( $hook_suffix == 'post.php' || $hook_suffix == 'post-new.php' ) {
|
||||
|
||||
if( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) {
|
||||
$post_id = $_GET['post'];
|
||||
} else {
|
||||
$post_id = -9999;
|
||||
}
|
||||
|
||||
// Get page template
|
||||
$page_template = get_page_template_slug( $post_id );
|
||||
|
||||
if( ( 'page' == $show_front && $front_page_id > 0 ) && $post_id == $front_page_id && ! empty( $frontpage_sections ) ){
|
||||
$admin_data['hide_metabox'] = 1;
|
||||
} elseif ( '' != $page_template ) {
|
||||
$admin_data['hide_metabox'] = 1;
|
||||
} else {
|
||||
$admin_data['hide_metabox'] = '';
|
||||
}
|
||||
}else {
|
||||
$admin_data['hide_metabox'] = '';
|
||||
}
|
||||
wp_localize_script( 'rara-business-admin-js', 'rb_show_metabox', $admin_data );
|
||||
|
||||
// Enqueued script with localized data.
|
||||
wp_enqueue_script( 'rara-business-admin-js' );
|
||||
|
||||
wp_enqueue_style( 'rara-business-admin-style', get_template_directory_uri() . '/inc/css/admin.css', '', RARA_BUSINESS_THEME_VERSION );
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'rara_business_admin_scripts' );
|
||||
|
||||
/**
|
||||
* Adds custom classes to the array of body classes.
|
||||
*
|
||||
* @param array $classes Classes for the body element.
|
||||
* @return array
|
||||
*/
|
||||
function rara_business_body_classes( $classes ) {
|
||||
$default_options = rara_business_default_theme_options(); // Get default theme options
|
||||
$banner_control = get_theme_mod( 'ed_banner_section', $default_options['ed_banner_section'] );
|
||||
$custom_header_image = get_header_image_tag(); // get custom header image tag
|
||||
|
||||
// Adds a class of hfeed to non-singular pages.
|
||||
if ( ! is_singular() ) {
|
||||
$classes[] = 'hfeed';
|
||||
}
|
||||
|
||||
if( is_front_page() && ! is_home() && ( has_header_video() || ! empty( $custom_header_image ) ) && 'no_banner' != $banner_control ){
|
||||
$classes[] = 'homepage hasbanner';
|
||||
}
|
||||
|
||||
// Add sibebar layout classes.
|
||||
$classes[] = rara_business_sidebar_layout();
|
||||
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'body_class', 'rara_business_body_classes' );
|
||||
|
||||
/**
|
||||
* Add a pingback url auto-discovery header for singularly identifiable articles.
|
||||
*/
|
||||
function rara_business_pingback_header() {
|
||||
if ( is_singular() && pings_open() ) {
|
||||
echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
|
||||
}
|
||||
}
|
||||
add_action( 'wp_head', 'rara_business_pingback_header' );
|
||||
|
||||
if( ! function_exists( 'rara_business_change_comment_form_default_fields' ) ) :
|
||||
/**
|
||||
* Change Comment form default fields i.e. author, email & url.
|
||||
* https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/
|
||||
*/
|
||||
function rara_business_change_comment_form_default_fields( $fields ){
|
||||
// get the current commenter if available
|
||||
$commenter = wp_get_current_commenter();
|
||||
|
||||
// core functionality
|
||||
$req = get_option( 'require_name_email' );
|
||||
$aria_req = ( $req ? " aria-required='true'" : '' );
|
||||
$required = ( $req ? " required" : '' );
|
||||
$author = ( $req ? __( 'Name*', 'rara-business' ) : __( 'Name', 'rara-business' ) );
|
||||
$email = ( $req ? __( 'Email*', 'rara-business' ) : __( 'Email', 'rara-business' ) );
|
||||
|
||||
// Change just the author field
|
||||
$fields['author'] = '<p class="comment-form-author"><label class="screen-reader-text" for="author">' . esc_html__( 'Name', 'rara-business' ) . '<span class="required">*</span></label><input id="author" name="author" placeholder="' . esc_attr( $author ) . '" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $required . ' /></p>';
|
||||
|
||||
$fields['email'] = '<p class="comment-form-email"><label class="screen-reader-text" for="email">' . esc_html__( 'Email', 'rara-business' ) . '<span class="required">*</span></label><input id="email" name="email" placeholder="' . esc_attr( $email ) . '" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $required. ' /></p>';
|
||||
|
||||
$fields['url'] = '<p class="comment-form-url"><label class="screen-reader-text" for="url">' . esc_html__( 'Website', 'rara-business' ) . '</label><input id="url" name="url" placeholder="' . esc_attr__( 'Website', 'rara-business' ) . '" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>';
|
||||
|
||||
return $fields;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'comment_form_default_fields', 'rara_business_change_comment_form_default_fields' );
|
||||
|
||||
if( ! function_exists( 'rara_business_change_comment_form_defaults' ) ) :
|
||||
/**
|
||||
* Change Comment Form defaults
|
||||
* https://blog.josemcastaneda.com/2016/08/08/copy-paste-hurting-theme/
|
||||
*/
|
||||
function rara_business_change_comment_form_defaults( $defaults ){
|
||||
$defaults['comment_field'] = '<p class="comment-form-comment"><label class="screen-reader-text" for="comment">' . esc_html__( 'Comment', 'rara-business' ) . '</label><textarea id="comment" name="comment" placeholder="' . esc_attr__( 'Comment', 'rara-business' ) . '" cols="45" rows="8" aria-required="true" required></textarea></p>';
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'comment_form_defaults', 'rara_business_change_comment_form_defaults' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_excerpt_more' ) ) :
|
||||
/**
|
||||
* Replaces "[...]" (appended to automatically generated excerpts) with ... *
|
||||
*/
|
||||
function rara_business_excerpt_more( $more ) {
|
||||
return is_admin() ? $more : ' … ';
|
||||
}
|
||||
endif;
|
||||
add_filter( 'excerpt_more', 'rara_business_excerpt_more' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_excerpt_length' ) ) :
|
||||
/**
|
||||
* Changes the default 55 character in excerpt
|
||||
*/
|
||||
function rara_business_excerpt_length( $length ) {
|
||||
$excerpt_length = get_theme_mod( 'excerpt_length', 55 );
|
||||
return is_admin() ? $length : absint( $excerpt_length );
|
||||
}
|
||||
endif;
|
||||
add_filter( 'excerpt_length', 'rara_business_excerpt_length', 999 );
|
||||
|
||||
if ( !function_exists( 'rara_business_video_controls' ) ) :
|
||||
/**
|
||||
* Customize video play/pause button in the custom header.
|
||||
*
|
||||
* @param array $settings Video settings.
|
||||
*/
|
||||
function rara_business_video_controls( $settings ) {
|
||||
$settings['l10n']['play'] = '<span class="screen-reader-text">' . __( 'Play background video', 'rara-business' ) . '</span>' . rara_business_get_svg( array( 'icon' => 'play' ) );
|
||||
$settings['l10n']['pause'] = '<span class="screen-reader-text">' . __( 'Pause background video', 'rara-business' ) . '</span>' . rara_business_get_svg( array( 'icon' => 'pause' ) );
|
||||
return $settings;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'header_video_settings', 'rara_business_video_controls' );
|
||||
|
||||
if( ! function_exists( 'rara_business_include_svg_icons' ) ) :
|
||||
/**
|
||||
* Add SVG definitions to the footer.
|
||||
*/
|
||||
function rara_business_include_svg_icons() {
|
||||
// Define SVG sprite file.
|
||||
$svg_icons = get_parent_theme_file_path( '/images/svg-icons.svg' );
|
||||
|
||||
// If it exists, include it.
|
||||
if ( file_exists( $svg_icons ) ) {
|
||||
require_once( $svg_icons );
|
||||
}
|
||||
}
|
||||
endif;
|
||||
add_action( 'wp_footer', 'rara_business_include_svg_icons', 9999 );
|
||||
|
||||
if( ! function_exists( 'rara_business_get_the_archive_title' ) ) :
|
||||
/**
|
||||
* Filter Archive Title
|
||||
*/
|
||||
function rara_business_get_the_archive_title( $title ){
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$hide_prefix = get_theme_mod( 'ed_prefix_archive', $default_options['ed_prefix_archive'] );
|
||||
|
||||
if( $hide_prefix ){
|
||||
if( is_category() ){
|
||||
$title = single_cat_title( '', false );
|
||||
}elseif ( is_tag() ){
|
||||
$title = single_tag_title( '', false );
|
||||
}elseif( is_author() ){
|
||||
$title = '<span class="vcard">' . get_the_author() . '</span>';
|
||||
}elseif ( is_year() ) {
|
||||
$title = get_the_date( __( 'Y', 'rara-business' ) );
|
||||
}elseif ( is_month() ) {
|
||||
$title = get_the_date( __( 'F Y', 'rara-business' ) );
|
||||
}elseif ( is_day() ) {
|
||||
$title = get_the_date( __( 'F j, Y', 'rara-business' ) );
|
||||
}elseif ( is_post_type_archive() ) {
|
||||
$title = post_type_archive_title( '', false );
|
||||
}elseif ( is_tax() ) {
|
||||
$tax = get_taxonomy( get_queried_object()->taxonomy );
|
||||
$title = single_term_title( '', false );
|
||||
}
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'get_the_archive_title', 'rara_business_get_the_archive_title' );
|
||||
|
||||
if( ! function_exists( 'rara_business_get_comment_author_link' ) ) :
|
||||
/**
|
||||
* Filter to modify comment author link
|
||||
* @link https://developer.wordpress.org/reference/functions/get_comment_author_link/
|
||||
*/
|
||||
function rara_business_get_comment_author_link( $return, $author, $comment_ID ){
|
||||
$comment = get_comment( $comment_ID );
|
||||
$url = get_comment_author_url( $comment );
|
||||
$author = get_comment_author( $comment );
|
||||
|
||||
if ( empty( $url ) || 'http://' == $url )
|
||||
$return = '<span itemprop="name">'. esc_html( $author ) .'</span>';
|
||||
else
|
||||
$return = '<span itemprop="name"><a href="'. esc_url( $url ) .'" rel="external nofollow" class="url" itemprop="url">'. esc_html( $author ) .'</a></span>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
endif;
|
||||
add_filter( 'get_comment_author_link', 'rara_business_get_comment_author_link', 10, 3 );
|
||||
|
||||
if( ! function_exists( 'rara_business_admin_notice' ) ) :
|
||||
/**
|
||||
* Addmin notice for getting started page
|
||||
*/
|
||||
function rara_business_admin_notice(){
|
||||
global $pagenow;
|
||||
$theme_args = wp_get_theme();
|
||||
$meta = get_option( 'rara_business_admin_notice' );
|
||||
$name = $theme_args->__get( 'Name' );
|
||||
$current_screen = get_current_screen();
|
||||
$dismissnonce = wp_create_nonce( 'rara_business_admin_notice' );
|
||||
|
||||
if( 'themes.php' == $pagenow && !$meta ){
|
||||
|
||||
if( $current_screen->id !== 'dashboard' && $current_screen->id !== 'themes' ){
|
||||
return;
|
||||
}
|
||||
|
||||
if( is_network_admin() ){
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! current_user_can( 'manage_options' ) ){
|
||||
return;
|
||||
} ?>
|
||||
|
||||
<div class="welcome-message notice notice-info">
|
||||
<div class="notice-wrapper">
|
||||
<div class="notice-text">
|
||||
<h3><?php esc_html_e( 'Congratulations!', 'rara-business' ); ?></h3>
|
||||
<p><?php printf( __( '%1$s is now installed and ready to use. Click below to see theme documentation, plugins to install and other details to get started.', 'rara-business' ), esc_html( $name ) ) ; ?></p>
|
||||
<p><a href="<?php echo esc_url( admin_url( 'themes.php?page=rara-business-dashboard' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Go to the dashboard.', 'rara-business' ); ?></a></p>
|
||||
<p class="dismiss-link"><strong><a href="?rara_business_admin_notice=1&_wpnonce=<?php echo esc_attr( $dismissnonce ); ?>"><?php esc_html_e( 'Dismiss', 'rara-business' ); ?></a></strong></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
endif;
|
||||
add_action( 'admin_notices', 'rara_business_admin_notice' );
|
||||
|
||||
if( ! function_exists( 'rara_business_update_admin_notice' ) ) :
|
||||
/**
|
||||
* Updating admin notice on dismiss
|
||||
*/
|
||||
function rara_business_update_admin_notice(){
|
||||
if (!current_user_can('manage_options')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Bail if the nonce doesn't check out
|
||||
if ( isset( $_GET['rara_business_admin_notice'] ) && $_GET['rara_business_admin_notice'] = '1' && wp_verify_nonce( $_GET['_wpnonce'], 'rara_business_admin_notice' ) ) {
|
||||
update_option( 'rara_business_admin_notice', true );
|
||||
}
|
||||
}
|
||||
endif;
|
||||
add_action( 'admin_init', 'rara_business_update_admin_notice' );
|
||||
|
||||
if( ! function_exists( 'rara_business_get_page_id_by_template' ) ) :
|
||||
/**
|
||||
* Returns Page ID by Page Template
|
||||
*/
|
||||
function rara_business_get_page_id_by_template( $template_name ){
|
||||
$args = array(
|
||||
'meta_key' => '_wp_page_template',
|
||||
'meta_value' => $template_name
|
||||
);
|
||||
return get_pages( $args );
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_get_fontawesome_ajax' ) ) :
|
||||
/**
|
||||
* Return an array of all icons.
|
||||
*/
|
||||
function rara_business_get_fontawesome_ajax() {
|
||||
// Bail if the nonce doesn't check out
|
||||
if ( ! isset( $_POST['rara_business_customize_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['rara_business_customize_nonce'] ), 'rara_business_customize_nonce' ) ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
// Do another nonce check
|
||||
check_ajax_referer( 'rara_business_customize_nonce', 'rara_business_customize_nonce' );
|
||||
|
||||
// Bail if user can't edit theme options
|
||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
// Get all of our fonts
|
||||
$fonts = rara_business_get_fontawesome_list();
|
||||
|
||||
ob_start();
|
||||
if( $fonts ){ ?>
|
||||
<ul class="font-group">
|
||||
<?php
|
||||
foreach( $fonts as $font ){
|
||||
echo '<li data-font="' . esc_attr( $font ) . '"><i class="' . esc_attr( $font ) . '"></i></li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
echo ob_get_clean();
|
||||
|
||||
// Exit
|
||||
wp_die();
|
||||
}
|
||||
endif;
|
||||
add_action( 'wp_ajax_rara_business_get_fontawesome_ajax', 'rara_business_get_fontawesome_ajax' );
|
||||
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara_Business Customizer Notification Section Class.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
/**
|
||||
* Rara_Business_Customizer_Notice_Section class
|
||||
*/
|
||||
class Rara_Business_Customizer_Notice_Section extends WP_Customize_Section {
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'customizer-plugin-notice-section';
|
||||
/**
|
||||
* Custom button text to output.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $recommended_actions = '';
|
||||
/**
|
||||
* Recommended Plugins.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $recommended_plugins = '';
|
||||
/**
|
||||
* Total number of required actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $total_actions = '';
|
||||
/**
|
||||
* Plugin text.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $plugin_text = '';
|
||||
/**
|
||||
* Dismiss button.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $dismiss_button = '';
|
||||
|
||||
/**
|
||||
* Check if plugin is installed/activated
|
||||
*
|
||||
* @param plugin-slug $slug the plugin slug.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check_active( $slug ) {
|
||||
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug . '.php' ) ) {
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
$needs = is_plugin_active( $slug . '/' . $slug . '.php' ) ? 'deactivate' : 'activate';
|
||||
|
||||
return array(
|
||||
'status' => is_plugin_active( $slug . '/' . $slug . '.php' ),
|
||||
'needs' => $needs,
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status' => false,
|
||||
'needs' => 'install',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the install/activate button link for plugins
|
||||
*
|
||||
* @param plugin-state $state The plugin state (not installed/inactive/active).
|
||||
* @param plugin-slug $slug The plugin slug.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function create_action_link( $state, $slug ) {
|
||||
switch ( $state ) {
|
||||
case 'install':
|
||||
return wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'install-plugin',
|
||||
'plugin' => $slug,
|
||||
),
|
||||
network_admin_url( 'update.php' )
|
||||
),
|
||||
'install-plugin_' . $slug
|
||||
);
|
||||
break;
|
||||
case 'deactivate':
|
||||
return add_query_arg(
|
||||
array(
|
||||
'action' => 'deactivate',
|
||||
'plugin' => rawurlencode( $slug . '/' . $slug . '.php' ),
|
||||
'plugin_status' => 'all',
|
||||
'paged' => '1',
|
||||
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . $slug . '/' . $slug . '.php' ),
|
||||
), network_admin_url( 'plugins.php' )
|
||||
);
|
||||
break;
|
||||
case 'activate':
|
||||
return add_query_arg(
|
||||
array(
|
||||
'action' => 'activate',
|
||||
'plugin' => rawurlencode( $slug . '/' . $slug . '.php' ),
|
||||
'plugin_status' => 'all',
|
||||
'paged' => '1',
|
||||
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $slug . '/' . $slug . '.php' ),
|
||||
), network_admin_url( 'plugins.php' )
|
||||
);
|
||||
break;
|
||||
}// End switch().
|
||||
}
|
||||
|
||||
/**
|
||||
* Call plugin API to get plugins info
|
||||
*
|
||||
* @param plugin-slug $slug The plugin slug.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function call_plugin_api( $slug ) {
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
|
||||
$call_api = get_transient( 'cust_notice_plugin_info_' . $slug );
|
||||
if ( false === $call_api ) {
|
||||
$call_api = plugins_api(
|
||||
'plugin_information', array(
|
||||
'slug' => $slug,
|
||||
'fields' => array(
|
||||
'downloaded' => false,
|
||||
'rating' => false,
|
||||
'description' => false,
|
||||
'short_description' => true,
|
||||
'donate_link' => false,
|
||||
'tags' => false,
|
||||
'sections' => false,
|
||||
'homepage' => false,
|
||||
'added' => false,
|
||||
'last_updated' => false,
|
||||
'compatibility' => false,
|
||||
'tested' => false,
|
||||
'requires' => false,
|
||||
'downloadlink' => false,
|
||||
'icons' => false,
|
||||
),
|
||||
)
|
||||
);
|
||||
set_transient( 'cust_notice_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $call_api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
global $rara_business_recommended_plugins;
|
||||
|
||||
global $install_button_label;
|
||||
global $activate_button_label;
|
||||
global $deactivate_button_label;
|
||||
|
||||
$customize_plugins = array();
|
||||
|
||||
$show_recommended_plugins = get_option( 'rara_business_show_recommended_plugins' );
|
||||
|
||||
foreach ( $rara_business_recommended_plugins as $slug => $plugin_opt ) {
|
||||
|
||||
if ( ! $plugin_opt['recommended'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( isset( $show_recommended_plugins[ $slug ] ) && $show_recommended_plugins[ $slug ] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$active = $this->check_active( $slug );
|
||||
|
||||
if ( ! empty( $active['needs'] ) && ( $active['needs'] == 'deactivate' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rara_business_recommended_plugin['url'] = $this->create_action_link( $active['needs'], $slug );
|
||||
if ( $active['needs'] !== 'install' && $active['status'] ) {
|
||||
$rara_business_recommended_plugin['class'] = 'active';
|
||||
} else {
|
||||
$rara_business_recommended_plugin['class'] = '';
|
||||
}
|
||||
|
||||
switch ( $active['needs'] ) {
|
||||
case 'install':
|
||||
$rara_business_recommended_plugin['button_class'] = 'install-now button';
|
||||
$rara_business_recommended_plugin['button_label'] = $install_button_label;
|
||||
break;
|
||||
case 'activate':
|
||||
$rara_business_recommended_plugin['button_class'] = 'activate-now button button-primary';
|
||||
$rara_business_recommended_plugin['button_label'] = $activate_button_label;
|
||||
break;
|
||||
case 'deactivate':
|
||||
$rara_business_recommended_plugin['button_class'] = 'deactivate-now button';
|
||||
$rara_business_recommended_plugin['button_label'] = $deactivate_button_label;
|
||||
break;
|
||||
}
|
||||
$info = $this->call_plugin_api( $slug );
|
||||
$rara_business_recommended_plugin['id'] = $slug;
|
||||
$rara_business_recommended_plugin['plugin_slug'] = $slug;
|
||||
|
||||
if ( ! empty( $plugin_opt['description'] ) ) {
|
||||
$rara_business_recommended_plugin['description'] = $plugin_opt['description'];
|
||||
} else {
|
||||
$rara_business_recommended_plugin['description'] = $info->short_description;
|
||||
}
|
||||
|
||||
$rara_business_recommended_plugin['title'] = $info->name;
|
||||
|
||||
$customize_plugins[] = $rara_business_recommended_plugin;
|
||||
|
||||
}// End foreach().
|
||||
|
||||
$json['recommended_plugins'] = $customize_plugins;
|
||||
$json['plugin_text'] = $this->plugin_text;
|
||||
$json['dismiss_button'] = $this->dismiss_button;
|
||||
return $json;
|
||||
|
||||
}
|
||||
/**
|
||||
* Outputs the structure for the customizer control
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function render_template() {
|
||||
?>
|
||||
<# if( data.recommended_plugins.length > 0 ){ #>
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
|
||||
<h3 class="accordion-section-title">
|
||||
<span class="section-title" data-plugin_text="{{ data.plugin_text }}">
|
||||
<# if( data.recommended_plugins.length > 0 ){ #>
|
||||
{{ data.plugin_text }}
|
||||
<# } #>
|
||||
</span>
|
||||
</h3>
|
||||
<div class="recomended-actions_container" id="plugin-filter">
|
||||
<# if( data.recommended_plugins.length > 0 ){ #>
|
||||
<# for (action in data.recommended_plugins) { #>
|
||||
<div class="rara-recommeded-actions-container rara-recommended-plugins" data-index="{{ data.recommended_plugins[action].index }}">
|
||||
<# if( !data.recommended_plugins[action].check ){ #>
|
||||
<div class="rara-recommeded-actions">
|
||||
<p class="title">{{ data.recommended_plugins[action].title }}</p>
|
||||
<span data-action="dismiss" class="dashicons dashicons-no dismiss-button-recommended-plugin" id="{{ data.recommended_plugins[action].id }}"></span>
|
||||
<div class="description">{{{ data.recommended_plugins[action].description }}}</div>
|
||||
<# if( data.recommended_plugins[action].plugin_slug ){ #>
|
||||
<div class="custom-action">
|
||||
<p class="plugin-card-{{ data.recommended_plugins[action].plugin_slug }} action_button {{ data.recommended_plugins[action].class }}">
|
||||
<a data-slug="{{ data.recommended_plugins[action].plugin_slug }}"
|
||||
class="{{ data.recommended_plugins[action].button_class }}"
|
||||
href="{{ data.recommended_plugins[action].url }}">{{ data.recommended_plugins[action].button_label }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<# } #>
|
||||
<# if( data.recommended_plugins[action].help ){ #>
|
||||
<div class="custom-action">{{{ data.recommended_plugins[action].help }}}</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
<# } #>
|
||||
</div>
|
||||
</li>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Customizer Notification System.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* TI Customizer Notify Class
|
||||
*/
|
||||
class Rara_Business_Customizer_Notice {
|
||||
|
||||
/**
|
||||
* Recommended plugins
|
||||
*
|
||||
* @var array $recommended_plugins Recommended plugins displayed in customize notification system.
|
||||
*/
|
||||
private $recommended_plugins;
|
||||
|
||||
/**
|
||||
* The single instance of Rara_Business_Customizer_Notice
|
||||
*
|
||||
* @var Rara_Business_Customizer_Notice $instance The Rara_Business_Customizer_Notice instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Title of Recommended plugins section in customize
|
||||
*
|
||||
* @var string $recommended_plugins_title Title of Recommended plugins section displayed in customize notification system.
|
||||
*/
|
||||
private $recommended_plugins_title;
|
||||
|
||||
/**
|
||||
* Dismiss button label
|
||||
*
|
||||
* @var string $dismiss_button Dismiss button label displayed in customize notification system.
|
||||
*/
|
||||
private $dismiss_button;
|
||||
|
||||
/**
|
||||
* Install button label for plugins
|
||||
*
|
||||
* @var string $install_button_label Label of install button for plugins displayed in customize notification system.
|
||||
*/
|
||||
private $install_button_label;
|
||||
|
||||
/**
|
||||
* Activate button label for plugins
|
||||
*
|
||||
* @var string $activate_button_label Label of activate button for plugins displayed in customize notification system.
|
||||
*/
|
||||
private $activate_button_label;
|
||||
|
||||
/**
|
||||
* Deactivate button label for plugins
|
||||
*
|
||||
* @var string $deactivate_button_label Label of deactivate button for plugins displayed in customize notification system.
|
||||
*/
|
||||
private $deactivate_button_label;
|
||||
|
||||
/**
|
||||
* The Main Rara_Business_Customizer_Notice instance.
|
||||
*
|
||||
* We make sure that only one instance of Rara_Business_Customizer_Notice exists in the memory at one time.
|
||||
*
|
||||
* @param array $config The configuration array.
|
||||
*/
|
||||
public static function init( $config ) {
|
||||
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Rara_Business_Customizer_Notice ) ) {
|
||||
self::$instance = new Rara_Business_Customizer_Notice;
|
||||
if ( ! empty( $config ) && is_array( $config ) ) {
|
||||
self::$instance->config = $config;
|
||||
self::$instance->setup_config();
|
||||
self::$instance->setup_actions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the class props based on the config array.
|
||||
*/
|
||||
public function setup_config() {
|
||||
|
||||
// global arrays for recommended plugins/actions
|
||||
global $rara_business_recommended_plugins;
|
||||
global $install_button_label;
|
||||
global $activate_button_label;
|
||||
global $deactivate_button_label;
|
||||
|
||||
$this->recommended_plugins = isset( $this->config['recommended_plugins'] ) ? $this->config['recommended_plugins'] : array();
|
||||
$this->recommended_plugins_title = isset( $this->config['recommended_plugins_title'] ) ? $this->config['recommended_plugins_title'] : '';
|
||||
$this->dismiss_button = isset( $this->config['dismiss_button'] ) ? $this->config['dismiss_button'] : '';
|
||||
|
||||
$rara_business_recommended_plugins = array();
|
||||
|
||||
if ( isset( $this->recommended_plugins ) ) {
|
||||
$rara_business_recommended_plugins = $this->recommended_plugins;
|
||||
}
|
||||
|
||||
$install_button_label = isset( $this->config['install_button_label'] ) ? $this->config['install_button_label'] : '';
|
||||
$activate_button_label = isset( $this->config['activate_button_label'] ) ? $this->config['activate_button_label'] : '';
|
||||
$deactivate_button_label = isset( $this->config['deactivate_button_label'] ) ? $this->config['deactivate_button_label'] : '';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the actions used for this class.
|
||||
*/
|
||||
public function setup_actions() {
|
||||
|
||||
// Register the section
|
||||
add_action( 'customize_register', array( $this, 'customize_register_notice' ) );
|
||||
|
||||
// Enqueue scripts and styles
|
||||
add_action( 'customize_controls_enqueue_scripts', array( $this, 'scripts_for_customizer' ), 0 );
|
||||
|
||||
/* ajax callback for dismissable recommended plugins */
|
||||
add_action( 'wp_ajax_dismiss_recommended_plugins', array( $this, 'dismiss_recommended_plugins_callback' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Scripts and styles used in the Themeisle_Customizer_Notify class
|
||||
*/
|
||||
public function scripts_for_customizer() {
|
||||
|
||||
wp_enqueue_style( 'rara-business-customizer-notice', get_template_directory_uri() . '/inc/customizer-plugin-recommend/customizer-notice/css/customizer-notice.css', array(), RARA_BUSINESS_THEME_VERSION );
|
||||
|
||||
wp_enqueue_style( 'plugin-install' );
|
||||
wp_enqueue_script( 'plugin-install' );
|
||||
wp_add_inline_script( 'plugin-install', 'var pagenow = "customizer";' );
|
||||
|
||||
wp_enqueue_script( 'updates' );
|
||||
|
||||
wp_enqueue_script( 'rara-business-customizer-notice', get_template_directory_uri() . '/inc/customizer-plugin-recommend/customizer-notice/js/customizer-notice.js', array( 'customize-controls' ), RARA_BUSINESS_THEME_VERSION );
|
||||
wp_localize_script(
|
||||
'rara-business-customizer-notice', 'customizer_notice_data', array(
|
||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||
'template_directory' => get_template_directory_uri(),
|
||||
'base_path' => admin_url(),
|
||||
'activating_string' => __( 'Activating', 'rara-business' ),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the section for the recommended actions/plugins in customize
|
||||
*
|
||||
* @param object $wp_customize The customizer object.
|
||||
*/
|
||||
public function customize_register_notice( $wp_customize ) {
|
||||
|
||||
/**
|
||||
* Include the Rara_Business_Customizer_Notice_Section class.
|
||||
*/
|
||||
require_once get_template_directory() . '/inc/customizer-plugin-recommend/customizer-notice/class-customizer-notice-section.php';
|
||||
|
||||
$wp_customize->register_section_type( 'Rara_Business_Customizer_Notice_Section' );
|
||||
|
||||
$wp_customize->add_section(
|
||||
new Rara_Business_Customizer_Notice_Section(
|
||||
$wp_customize,
|
||||
'customizer-plugin-notice-section',
|
||||
array(
|
||||
'plugin_text' => $this->recommended_plugins_title,
|
||||
'dismiss_button' => $this->dismiss_button,
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss recommended plugins
|
||||
*/
|
||||
public function dismiss_recommended_plugins_callback() {
|
||||
|
||||
$action_id = ( isset( $_GET['id'] ) ) ? $_GET['id'] : 0;
|
||||
|
||||
echo esc_html( $action_id ); /* this is needed and it's the id of the dismissable required action */
|
||||
|
||||
if ( ! empty( $action_id ) ) {
|
||||
/* if the option exists, update the record for the specified id */
|
||||
$show_recommended_plugins = get_option( 'rara_business_show_recommended_plugins' );
|
||||
|
||||
switch ( $_GET['todo'] ) {
|
||||
case 'add':
|
||||
$show_recommended_plugins[ $action_id ] = false;
|
||||
break;
|
||||
case 'dismiss':
|
||||
$show_recommended_plugins[ $action_id ] = true;
|
||||
break;
|
||||
}
|
||||
update_option( 'rara_business_show_recommended_plugins', $show_recommended_plugins );
|
||||
}
|
||||
die(); // this is required to return a proper result
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
div.recomended-actions_container {
|
||||
margin-bottom: 2em;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.recomended-actions_container p.succes {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions p.title {
|
||||
margin-bottom: 0;
|
||||
color: #555d66;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions div.description {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions .custom-action {
|
||||
margin-top: 1em;
|
||||
padding-top: 1em;
|
||||
border-top: 1px solid #fafafa;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions .custom-action p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.recomended-actions_container .rara-recommeded-actions-container:not(:first-child) {
|
||||
overflow: hidden;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.recomended-actions_container .rara-recommeded-actions-container:first-child {
|
||||
height: auto;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.recomended-actions_container .rara-recommeded-actions-container {
|
||||
-webkit-transition: opacity 2s;
|
||||
/* Safari */
|
||||
transition: opacity 2s;
|
||||
}
|
||||
|
||||
.recomended-actions_container .hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.recomended-actions_container #demo_content .button {
|
||||
display: block;
|
||||
margin-bottom: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.recomended-actions_container .succes a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.recomended-actions_container .succes a.social {
|
||||
width: 49%;
|
||||
margin-bottom: 1em;
|
||||
padding-top: 4px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.recomended-actions_container .succes a.social span,
|
||||
.recomended-actions_container .succes a.ti-customizer-notify-wordpress span {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.recomended-actions_container .succes a.ti-customizer-notify-wordpress {
|
||||
padding-top: 4px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.dismiss-button-recommended-plugin {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
border-radius: 50%;
|
||||
color: #d54e21;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions .dismiss-button-recommended-plugin {
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions #temp_load {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
}
|
||||
|
||||
.rara-recommeded-actions #temp_load img {
|
||||
margin: 0 auto;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/* global wp */
|
||||
/* global customizer_notice_data */
|
||||
/* global console */
|
||||
(function (api) {
|
||||
|
||||
api.sectionConstructor['customizer-plugin-notice-section'] = api.Section.extend({
|
||||
|
||||
// No events for this type of section.
|
||||
attachEvents: function () {
|
||||
},
|
||||
|
||||
// Always make the section active.
|
||||
isContextuallyActive: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
})(wp.customize);
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
$('.dismiss-button-recommended-plugin').click(function () {
|
||||
var id = $(this).attr('id'),
|
||||
action = $(this).attr('data-action');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
data: {action: 'dismiss_recommended_plugins', id: id, todo: action},
|
||||
dataType: 'html',
|
||||
url: customizer_notice_data.ajaxurl,
|
||||
beforeSend: function () {
|
||||
$('#' + id).parent().append('<div id="temp_load" style="text-align:center"><img src="' + customizer_notice_data.base_path + '/images/spinner-2x.gif" /></div>');
|
||||
},
|
||||
success: function (data) {
|
||||
var container = $('#' + data).parent().parent();
|
||||
container.slideToggle().remove();
|
||||
|
||||
if( $('.recomended-actions_container > .rara-recommended-plugins').length === 0 ){
|
||||
$('.control-section-customizer-plugin-notice-section').remove();
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Remove activate button and replace with activation in progress button.
|
||||
$('body').on('DOMNodeInserted', '.activate-now', function () {
|
||||
var activateButton = $('.activate-now');
|
||||
if( activateButton.length ){
|
||||
var url = activateButton.attr('href');
|
||||
if( typeof url !== 'undefined' ){
|
||||
//Request plugin activation.
|
||||
$.ajax({
|
||||
beforeSend: function () {
|
||||
activateButton.replaceWith('<a class="button updating-message">' + customizer_notice_data.activating_string + '...</a>');
|
||||
},
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function () {
|
||||
//Reload the page.
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.activate-now').on('click', function(e){
|
||||
var activateButton = $(this);
|
||||
e.preventDefault();
|
||||
if (activateButton.length) {
|
||||
var url = activateButton.attr('href');
|
||||
if (typeof url !== 'undefined') {
|
||||
//Request plugin activation.
|
||||
$.ajax({
|
||||
beforeSend: function () {
|
||||
activateButton.replaceWith('<a class="button updating-message">' + customizer_notice_data.activating_string + '...</a>');
|
||||
},
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function () {
|
||||
//Reload the page.
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin install helper.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class Rara_Business_Plugin_Install_Helper
|
||||
*/
|
||||
class Rara_Business_Plugin_Install_Helper {
|
||||
/**
|
||||
* Instance of class.
|
||||
*
|
||||
* @var bool $instance instance variable.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Check if instance already exists.
|
||||
*
|
||||
* @return Rara_Business_Plugin_Install_Helper
|
||||
*/
|
||||
public static function instance() {
|
||||
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Rara_Business_Plugin_Install_Helper ) ) {
|
||||
self::$instance = new Rara_Business_Plugin_Install_Helper;
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate action button html.
|
||||
*
|
||||
* @param string $slug plugin slug.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_button_html( $slug ) {
|
||||
$button = '';
|
||||
$state = $this->check_plugin_state( $slug );
|
||||
if ( ! empty( $slug ) ) {
|
||||
|
||||
$button .= '<div class=" plugin-card-' . esc_attr( $slug ) . '" style="padding: 8px 0 5px;">';
|
||||
|
||||
switch ( $state ) {
|
||||
case 'install':
|
||||
$nonce = wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'install-plugin',
|
||||
'from' => 'import',
|
||||
'plugin' => $slug,
|
||||
),
|
||||
network_admin_url( 'update.php' )
|
||||
),
|
||||
'install-plugin_' . $slug
|
||||
);
|
||||
$button .= '<a data-slug="' . esc_attr( $slug ) . '" class="install-now ta-install-plugin button " href="' . esc_url( $nonce ) . '" data-name="' . esc_attr( $slug ) . '" aria-label="Install ' . esc_attr( $slug ) . '">' . __( 'Install and activate', 'rara-business' ) . '</a>';
|
||||
break;
|
||||
|
||||
case 'activate':
|
||||
$plugin_link_suffix = $slug . '/' . $slug . '.php';
|
||||
|
||||
$nonce = add_query_arg(
|
||||
array(
|
||||
'action' => 'activate',
|
||||
'plugin' => rawurlencode( $plugin_link_suffix ),
|
||||
'plugin_status' => 'all',
|
||||
'paged' => '1',
|
||||
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin_link_suffix ),
|
||||
), network_admin_url( 'plugins.php' )
|
||||
);
|
||||
|
||||
$button .= '<a data-slug="' . esc_attr( $slug ) . '" class="activate button button-primary" href="' . esc_url( $nonce ) . '" aria-label="Activate ' . esc_attr( $slug ) . '">' . __( 'Activate', 'rara-business' ) . '</a>';
|
||||
break;
|
||||
}// End switch().
|
||||
$button .= '</div>';
|
||||
}// End if().
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check plugin state.
|
||||
*
|
||||
* @param string $slug plugin slug.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function check_plugin_state( $slug ) {
|
||||
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug . '.php' ) || file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/index.php' ) ) {
|
||||
$needs = ( is_plugin_active( $slug . '/' . $slug . '.php' ) || is_plugin_active( $slug . '/index.php' ) ) ? 'deactivate' : 'activate';
|
||||
return $needs;
|
||||
} else {
|
||||
return 'install';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Function.
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
wp_enqueue_script( 'plugin-install' );
|
||||
wp_enqueue_script( 'updates' );
|
||||
wp_enqueue_script( 'rara-business-plugin-install-helper', get_template_directory_uri() . '/inc/customizer-plugin-recommend/plugin-install/js/plugin-install.js', array( 'jquery' ), RARA_BUSINESS_THEME_VERSION, true );
|
||||
wp_localize_script(
|
||||
'rara-business-plugin-install-helper', 'plugin_helper',
|
||||
array(
|
||||
'activating' => esc_html__( 'Activating ', 'rara-business' ),
|
||||
)
|
||||
);
|
||||
wp_localize_script(
|
||||
'rara-business-plugin-install-helper', 'pagenow',
|
||||
array( 'import' )
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/* global plugin_helper */
|
||||
jQuery(document).ready(function ($) {
|
||||
$('body').on('click', '.ta-install-plugin', function(){
|
||||
var slug = $(this).attr('data-slug');
|
||||
wp.updates.installPlugin({
|
||||
slug: slug
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//Remove activate button and replace with activation in progress button.
|
||||
$('body').on('DOMNodeInserted', '.activate', function () {
|
||||
var activateButton = $('.activate');
|
||||
if( activateButton.length ) {
|
||||
var url = activateButton.attr('href');
|
||||
if( typeof url !== 'undefined' ){
|
||||
//Request plugin activation.
|
||||
$.ajax({
|
||||
beforeSend: function () {
|
||||
activateButton.replaceWith('<a class="button updating-message">' + plugin_helper.activating + '...</a>');
|
||||
},
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function () {
|
||||
//Reload the page.
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.activate').on('click', function (e) {
|
||||
var activateButton = $(this);
|
||||
e.preventDefault();
|
||||
if( activateButton.length ){
|
||||
var url = activateButton.attr('href');
|
||||
if( typeof url !== 'undefined' ){
|
||||
//Request plugin activation.
|
||||
$.ajax({
|
||||
beforeSend: function () {
|
||||
activateButton.replaceWith('<a class="button updating-message">' + plugin_helper.activating + '...</a>');
|
||||
},
|
||||
async: true,
|
||||
type: 'GET',
|
||||
url: url,
|
||||
success: function () {
|
||||
//Reload the page.
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Customizer
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register' ) ) :
|
||||
/**
|
||||
* Add postMessage support for site title and description for the Theme Customizer.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
||||
*/
|
||||
function rara_business_customize_register( $wp_customize ) {
|
||||
$wp_customize->get_section( 'background_image' )->priority = 40;
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register' );
|
||||
|
||||
$rara_business_panels = array( 'frontpage', 'general', 'appearance' );
|
||||
$rara_business_sections = array( 'info', 'demo-content', 'site-identity', 'footer' );
|
||||
|
||||
$rara_business_sub_sections = array(
|
||||
'frontpage' => array( 'banner', 'portfolio', 'blog' ),
|
||||
'general' => array( 'header', 'seo', 'post-page','misc' ),
|
||||
);
|
||||
|
||||
foreach( $rara_business_panels as $p ){
|
||||
require get_template_directory() . '/inc/customizer/panels/' . $p . '.php';
|
||||
}
|
||||
|
||||
foreach( $rara_business_sections as $section ){
|
||||
require get_template_directory() . '/inc/customizer/sections/' . $section . '.php';
|
||||
}
|
||||
|
||||
foreach( $rara_business_sub_sections as $k => $v ){
|
||||
foreach( $v as $w ){
|
||||
require get_template_directory() . '/inc/customizer/panels/' . $k . '/' . $w . '.php';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_preview_js' ) ) :
|
||||
/**
|
||||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function rara_business_customize_preview_js() {
|
||||
wp_enqueue_script( 'rara-business-customizer', get_template_directory_uri() . '/js/build/customizer.js', array( 'customize-preview' ), '20151215', true );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_preview_init', 'rara_business_customize_preview_js' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_customizer_script' ) ) :
|
||||
/**
|
||||
* Customizer Scripts
|
||||
*/
|
||||
function rara_business_customizer_script(){
|
||||
$array = array(
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'flushit' => __( 'Successfully Flushed!','rara-business' ),
|
||||
'nonce' => wp_create_nonce('ajax-nonce')
|
||||
);
|
||||
wp_enqueue_style( 'rara-business-customize-controls', get_template_directory_uri() . '/inc/css/customize-controls.css', array(), false , 'screen' );
|
||||
wp_enqueue_script( 'rara-business-customize-controls', get_template_directory_uri() . '/inc/js/customize-controls.js', array( 'jquery', 'customize-controls' ), false, true );
|
||||
wp_localize_script( 'rara-business-customize-controls', 'rara_business_cdata', $array );
|
||||
|
||||
wp_localize_script( 'rara-business-repeater', 'rara_business_customize',
|
||||
array(
|
||||
'nonce' => wp_create_nonce( 'rara_business_customize_nonce' )
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_controls_enqueue_scripts', 'rara_business_customizer_script' );
|
||||
|
||||
/*
|
||||
* Notifications in customizer
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer-plugin-recommend/customizer-notice/class-customizer-notice.php';
|
||||
|
||||
require get_template_directory() . '/inc/customizer-plugin-recommend/plugin-install/class-plugin-install-helper.php';
|
||||
|
||||
$config_customizer = array(
|
||||
'recommended_plugins' => array(
|
||||
'raratheme-companion' => array(
|
||||
'recommended' => true,
|
||||
'description' => sprintf(
|
||||
/* translators: %s: plugin name */
|
||||
esc_html__( 'If you want to take full advantage of the features this theme has to offer, please install and activate %s plugin.', 'rara-business' ), '<strong>RaraTheme Companion</strong>'
|
||||
),
|
||||
),
|
||||
),
|
||||
'recommended_plugins_title' => esc_html__( 'Recommended Plugin', 'rara-business' ),
|
||||
'install_button_label' => esc_html__( 'Install and Activate', 'rara-business' ),
|
||||
'activate_button_label' => esc_html__( 'Activate', 'rara-business' ),
|
||||
'deactivate_button_label' => esc_html__( 'Deactivate', 'rara-business' ),
|
||||
);
|
||||
Rara_Business_Customizer_Notice::init( apply_filters( 'rara_business_customizer_notice_array', $config_customizer ) );
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Customizer Default Value.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
function rara_business_default_theme_options() {
|
||||
$default_options = array(
|
||||
|
||||
// Header section
|
||||
'ed_header_contact_details' => true,
|
||||
'header_phone' => '',
|
||||
'header_address' => '',
|
||||
'header_email' => '',
|
||||
'custom_link_icon' => 'fa fa-edit',
|
||||
'custom_link_label' => '',
|
||||
'custom_link' => '',
|
||||
|
||||
// Social media section
|
||||
'ed_header_social_links' => true,
|
||||
'header_social_links' => array(),
|
||||
|
||||
// Seo section
|
||||
'ed_post_update_date' => true,
|
||||
'ed_breadcrumb' => true,
|
||||
'home_text' => __( 'Home', 'rara-business' ),
|
||||
|
||||
// Post/Page section
|
||||
'page_sidebar_layout' => 'right-sidebar',
|
||||
'post_sidebar_layout' => 'right-sidebar',
|
||||
'ed_excerpt' => true,
|
||||
'excerpt_length' => '55',
|
||||
'read_more_text' => __( 'Read More', 'rara-business' ),
|
||||
'post_note_text' => '',
|
||||
'ed_author' => false,
|
||||
'ed_related' => true,
|
||||
'related_post_title' => __( 'You may also like...', 'rara-business' ),
|
||||
'ed_popular_posts' => true,
|
||||
'popular_post_title' => __( 'Popular Posts', 'rara-business' ),
|
||||
'ed_post_date_meta' => false,
|
||||
'ed_post_author_meta' => false,
|
||||
'ed_featured_image' => true,
|
||||
'ed_animation' => true,
|
||||
'ed_prefix_archive' => false,
|
||||
|
||||
// Banner section
|
||||
'ed_banner_section' => 'static_banner',
|
||||
'banner_title' => __( 'Perfectionist at Every Level', 'rara-business' ),
|
||||
'banner_description' => __( 'Believing in the possibility of attaining perfection.', 'rara-business' ),
|
||||
'banner_link_one_label' => __( 'Free Inquiry', 'rara-business' ),
|
||||
'banner_link_one_url' => '#',
|
||||
'banner_link_two_label' => __( 'View Services', 'rara-business' ),
|
||||
'banner_link_two_url' => '#',
|
||||
|
||||
// Portfolio section
|
||||
'ed_portfolio_section' => true,
|
||||
'portfolio_title' => __( 'Our Case Studies', 'rara-business' ),
|
||||
'portfolio_description' => __( 'It looks perfect on all major browsers, tablets and phones. The kind of product you are looking for.', 'rara-business' ),
|
||||
'portfolio_no_of_posts' => '10',
|
||||
|
||||
// Blog section
|
||||
'ed_blog_section' => true,
|
||||
'blog_title' => __( 'Our Blog', 'rara-business' ),
|
||||
'blog_description' => __( 'It looks perfect on all major browsers, tablets and phones. The kind of product you are looking for.', 'rara-business' ),
|
||||
);
|
||||
|
||||
$output = apply_filters( 'rara_business_default_theme_options', $default_options );
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Appearance Setting Panel
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_appearance_settings_panel' ) ) :
|
||||
/**
|
||||
* Add appearance settings panel
|
||||
*/
|
||||
function rara_business_customize_register_appearance_settings_panel( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_panel( 'appearance_settings_panel', array(
|
||||
'title' => __( 'Appearance Settings', 'rara-business' ),
|
||||
'priority' => 60,
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
|
||||
/** Typography */
|
||||
$wp_customize->add_section(
|
||||
'typography_settings',
|
||||
array(
|
||||
'title' => __( 'Typography', 'rara-business' ),
|
||||
'priority' => 70,
|
||||
'panel' => 'appearance_settings',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'ed_localgoogle_fonts',
|
||||
array(
|
||||
'default' => false,
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'ed_localgoogle_fonts',
|
||||
array(
|
||||
'label' => __( 'Load Google Fonts Locally', 'rara-business' ),
|
||||
'section' => 'typography_settings',
|
||||
'type' => 'checkbox',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'ed_preload_local_fonts',
|
||||
array(
|
||||
'default' => false,
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'ed_preload_local_fonts',
|
||||
array(
|
||||
'label' => __( 'Preload Local Fonts', 'rara-business' ),
|
||||
'section' => 'typography_settings',
|
||||
'type' => 'checkbox',
|
||||
'active_callback' => 'rara_business_flush_fonts_callback'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'flush_google_fonts',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'flush_google_fonts',
|
||||
array(
|
||||
'label' => __( 'Flush Local Fonts Cache', 'rara-business' ),
|
||||
'description' => __( 'Click the button to reset the local fonts cache.', 'rara-business' ),
|
||||
'type' => 'button',
|
||||
'settings' => array(),
|
||||
'section' => 'typography_settings',
|
||||
'input_attrs' => array(
|
||||
'value' => __( 'Flush Local Fonts Cache', 'rara-business' ),
|
||||
'class' => 'button button-primary flush-it',
|
||||
),
|
||||
'active_callback' => 'rara_business_flush_fonts_callback'
|
||||
)
|
||||
);
|
||||
|
||||
// Move default section to apperance settings panel
|
||||
$wp_customize->get_section( 'background_image' )->panel = 'appearance_settings_panel';
|
||||
$wp_customize->get_section( 'colors' )->panel = 'appearance_settings_panel';
|
||||
$wp_customize->get_section( 'typography_settings' )->panel = 'appearance_settings_panel';
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_appearance_settings_panel' );
|
||||
|
||||
function rara_business_flush_fonts_callback( $control ){
|
||||
$ed_localgoogle_fonts = $control->manager->get_setting( 'ed_localgoogle_fonts' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
if ( $control_id == 'flush_google_fonts' && $ed_localgoogle_fonts ) return true;
|
||||
if ( $control_id == 'ed_preload_local_fonts' && $ed_localgoogle_fonts ) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Front Page Panel
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_frontpage_panel' ) ) :
|
||||
/**
|
||||
* Add frontpage panel
|
||||
*/
|
||||
function rara_business_customize_register_frontpage_panel( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_panel( 'frontpage_panel', array(
|
||||
'title' => __( 'Frontpage Settings', 'rara-business' ),
|
||||
'priority' => 60,
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_frontpage_panel' );
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Banner Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_banner_section' ) ) :
|
||||
/**
|
||||
* Add banner section controls
|
||||
*/
|
||||
function rara_business_customize_register_banner_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
$wp_customize->get_section( 'header_image' )->panel = 'frontpage_panel';
|
||||
$wp_customize->get_section( 'header_image' )->title = __( 'Banner Section', 'rara-business' );
|
||||
$wp_customize->get_section( 'header_image' )->priority = 10;
|
||||
$wp_customize->get_control( 'header_image' )->active_callback = 'rara_business_banner_ac';
|
||||
$wp_customize->get_control( 'header_video' )->active_callback = 'rara_business_banner_ac';
|
||||
$wp_customize->get_control( 'external_header_video' )->active_callback = 'rara_business_banner_ac';
|
||||
$wp_customize->get_section( 'header_image' )->description = '';
|
||||
$wp_customize->get_setting( 'header_image' )->transport = 'refresh';
|
||||
$wp_customize->get_setting( 'header_video' )->transport = 'refresh';
|
||||
$wp_customize->get_setting( 'external_header_video' )->transport = 'refresh';
|
||||
|
||||
/** Banner Options */
|
||||
$wp_customize->add_setting(
|
||||
'ed_banner_section',
|
||||
array(
|
||||
'default' => $default_options['ed_banner_section'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_select'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Select_Control(
|
||||
$wp_customize,
|
||||
'ed_banner_section',
|
||||
array(
|
||||
'label' => __( 'Banner Options', 'rara-business' ),
|
||||
'description' => __( 'Choose banner as static image/video.', 'rara-business' ),
|
||||
'section' => 'header_image',
|
||||
'choices' => array(
|
||||
'no_banner' => __( 'Disable Banner Section', 'rara-business' ),
|
||||
'static_banner' => __( 'Static/Video Banner', 'rara-business' ),
|
||||
),
|
||||
'priority' => 5
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Banner title */
|
||||
$wp_customize->add_setting(
|
||||
'banner_title',
|
||||
array(
|
||||
'default' => $default_options['banner_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_title',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Banner Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// banner title selective refresh
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_title', array(
|
||||
'selector' => '.banner .text-holder h2.title',
|
||||
'render_callback' => 'rara_business_banner_title_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner description */
|
||||
$wp_customize->add_setting(
|
||||
'banner_description',
|
||||
array(
|
||||
'default' => $default_options['banner_description'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_description',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Banner Description', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Banner description selective refresh
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_description', array(
|
||||
'selector' => '.banner .text-holder p',
|
||||
'render_callback' => 'rara_business_banner_description_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner link one label */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_one_label',
|
||||
array(
|
||||
'default' => $default_options['banner_link_one_label'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_one_label',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link One Label', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for banner link one label
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_link_one_label', array(
|
||||
'selector' => '.banner .btn-holder a.btn-free-inquiry',
|
||||
'render_callback' => 'rara_business_banner_link_one_label_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner link one url */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_one_url',
|
||||
array(
|
||||
'default' => $default_options['banner_link_one_url'],
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_one_url',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link One Url', 'rara-business' ),
|
||||
'type' => 'url',
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Banner link two label */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_two_label',
|
||||
array(
|
||||
'default' => $default_options['banner_link_two_label'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_two_label',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link Two Label', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for banner link two label.
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_link_two_label', array(
|
||||
'selector' => '.banner .btn-holder a.btn-view-service',
|
||||
'render_callback' => 'rara_business_banner_link_two_label_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner link two url */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_two_url',
|
||||
array(
|
||||
'default' => $default_options['banner_link_two_url'],
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_two_url',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link Two Url', 'rara-business' ),
|
||||
'type' => 'url',
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_banner_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_banner_ac( $control ){
|
||||
$banner = $control->manager->get_setting( 'ed_banner_section' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// static banner controls
|
||||
if ( $control_id == 'header_image' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'header_video' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'external_header_video' && $banner == 'static_banner' ) return true;
|
||||
|
||||
// banner title and description controls
|
||||
if ( $control_id == 'banner_title' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_description' && $banner == 'static_banner' ) return true;
|
||||
|
||||
// Link button controls
|
||||
if ( $control_id == 'banner_link_one_label' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_link_one_url' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_link_two_label' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_link_two_url' && $banner == 'static_banner' ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Blog Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_blog_section' ) ) :
|
||||
/**
|
||||
* Add blog section controls
|
||||
*/
|
||||
function rara_business_customize_register_blog_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Blog Sectopm */
|
||||
$wp_customize->add_section(
|
||||
'blog_section',
|
||||
array(
|
||||
'title' => __( 'Blog Section', 'rara-business' ),
|
||||
'priority' => 77,
|
||||
'panel' => 'frontpage_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Blog Options */
|
||||
$wp_customize->add_setting(
|
||||
'ed_blog_section',
|
||||
array(
|
||||
'default' => $default_options['ed_blog_section'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_blog_section',
|
||||
array(
|
||||
'label' => __( 'Enable Blog Section', 'rara-business' ),
|
||||
'description' => __( 'Enable to show blog section.', 'rara-business' ),
|
||||
'section' => 'blog_section',
|
||||
'priority' => 5
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Blog title */
|
||||
$wp_customize->add_setting(
|
||||
'blog_title',
|
||||
array(
|
||||
'default' => $default_options['blog_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'blog_title',
|
||||
array(
|
||||
'section' => 'blog_section',
|
||||
'label' => __( 'Blog Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_blog_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for blog title.
|
||||
$wp_customize->selective_refresh->add_partial( 'blog_title', array(
|
||||
'selector' => '.blog-section .widget_text h2.widget-title',
|
||||
'render_callback' => 'rara_business_blog_title_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Blog description */
|
||||
$wp_customize->add_setting(
|
||||
'blog_description',
|
||||
array(
|
||||
'default' => $default_options['blog_description'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'blog_description',
|
||||
array(
|
||||
'section' => 'blog_section',
|
||||
'label' => __( 'Blog Description', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_blog_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for blog description.
|
||||
$wp_customize->selective_refresh->add_partial( 'blog_description', array(
|
||||
'selector' => '.blog-section .textwidget p',
|
||||
'render_callback' => 'rara_business_blog_description_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_blog_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_blog_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_blog_ac( $control ){
|
||||
$show_blog = $control->manager->get_setting( 'ed_blog_section' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// Blog title, description and number of posts controls
|
||||
if ( $control_id == 'blog_title' && $show_blog ) return true;
|
||||
if ( $control_id == 'blog_description' && $show_blog ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_portfolio_section' ) ) :
|
||||
/**
|
||||
* Add portfolio section controls
|
||||
*/
|
||||
function rara_business_customize_register_portfolio_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Portfolio Section */
|
||||
$wp_customize->add_section(
|
||||
'portfolio_section',
|
||||
array(
|
||||
'title' => __( 'Portfolio Section', 'rara-business' ),
|
||||
'priority' => 77,
|
||||
'panel' => 'frontpage_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Portfolio Options */
|
||||
$wp_customize->add_setting(
|
||||
'ed_portfolio_section',
|
||||
array(
|
||||
'default' => $default_options['ed_portfolio_section'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_portfolio_section',
|
||||
array(
|
||||
'label' => __( 'Enable Portfolio Section', 'rara-business' ),
|
||||
'description' => __( 'Enable to show portfolio section.', 'rara-business' ),
|
||||
'section' => 'portfolio_section',
|
||||
'priority' => 5
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( rara_business_is_rara_theme_companion_activated() ) {
|
||||
/** Portfolio title */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_title',
|
||||
array(
|
||||
'default' => $default_options['portfolio_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'portfolio_title',
|
||||
array(
|
||||
'section' => 'portfolio_section',
|
||||
'label' => __( 'Portfolio Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_portfolio_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for portfolio title.
|
||||
$wp_customize->selective_refresh->add_partial( 'portfolio_title', array(
|
||||
'selector' => '.portfolio .widget_text h2.widget-title',
|
||||
'render_callback' => 'rara_business_portfolio_title_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Portfolio description */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_description',
|
||||
array(
|
||||
'default' => $default_options['portfolio_description'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'portfolio_description',
|
||||
array(
|
||||
'section' => 'portfolio_section',
|
||||
'label' => __( 'Portfolio Description', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_portfolio_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for portfolio description.
|
||||
$wp_customize->selective_refresh->add_partial( 'portfolio_description', array(
|
||||
'selector' => '.portfolio .textwidget p',
|
||||
'render_callback' => 'rara_business_portfolio_description_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Number Of Portfolio Posts */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_no_of_posts',
|
||||
array(
|
||||
'default' => $default_options['portfolio_no_of_posts'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_select'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Select_Control(
|
||||
$wp_customize,
|
||||
'portfolio_no_of_posts',
|
||||
array(
|
||||
'label' => __( 'Number of Posts', 'rara-business' ),
|
||||
'description' => __( 'Choose number of portfolio posts to be displayed.', 'rara-business' ),
|
||||
'section' => 'portfolio_section',
|
||||
'choices' => array(
|
||||
'5' => __( '5', 'rara-business' ),
|
||||
'10' => __( '10', 'rara-business' ),
|
||||
),
|
||||
'active_callback' => 'rara_business_portfolio_ac'
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
/** Activate RaraTheme Companion Plugin Note */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_note',
|
||||
array(
|
||||
'sanitize_callback' => 'wp_kses_post'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Note_Control(
|
||||
$wp_customize,
|
||||
'portfolio_note',
|
||||
array(
|
||||
'section' => 'portfolio_section',
|
||||
/* translators: 1: link start, 2: link close */
|
||||
'description' => sprintf( __( 'Please install and activate the recommended plugin %1$sRaraTheme Companion%2$s.', 'rara-business' ), '<a href="' . esc_url( admin_url( 'themes.php?page=tgmpa-install-plugins' ) ) . '" target="_blank">', '</a>' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_portfolio_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_portfolio_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_portfolio_ac( $control ){
|
||||
$show_portfolio = $control->manager->get_setting( 'ed_portfolio_section' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// Portfolio title, description and number of posts controls
|
||||
if ( $control_id == 'portfolio_title' && $show_portfolio ) return true;
|
||||
if ( $control_id == 'portfolio_description' && $show_portfolio ) return true;
|
||||
if ( $control_id == 'portfolio_no_of_posts' && $show_portfolio ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* General Setting Panel
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_general_settings_panel' ) ) :
|
||||
/**
|
||||
* Add general settings panel
|
||||
*/
|
||||
function rara_business_customize_register_general_settings_panel( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_panel( 'general_settings_panel', array(
|
||||
'title' => __( 'General Settings', 'rara-business' ),
|
||||
'priority' => 60,
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_general_settings_panel' );
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/**
|
||||
* Header Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_header_section' ) ) :
|
||||
/**
|
||||
* Add header section controls
|
||||
*/
|
||||
function rara_business_customize_register_header_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Header Section */
|
||||
$wp_customize->add_section(
|
||||
'header_section',
|
||||
array(
|
||||
'title' => __( 'Header Section', 'rara-business' ),
|
||||
'priority' => 10,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable header top section */
|
||||
$wp_customize->add_setting(
|
||||
'ed_header_contact_details',
|
||||
array(
|
||||
'default' => $default_options['ed_header_contact_details'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_header_contact_details',
|
||||
array(
|
||||
'section' => 'header_section',
|
||||
'label' => __( 'Enable Header Contact Details', 'rara-business' ),
|
||||
'description' => __( 'Enable to show contact details in header top section.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Phone number */
|
||||
$wp_customize->add_setting(
|
||||
'header_phone',
|
||||
array(
|
||||
'default' => $default_options['header_phone'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'header_phone', array(
|
||||
'selector' => '.header-t .phone a.tel-link',
|
||||
'render_callback' => 'rara_business_header_phone_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'header_phone',
|
||||
array(
|
||||
'label' => __( 'Phone Number', 'rara-business' ),
|
||||
'description' => __( 'Add phone no. in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
'active_callback' => 'rara_business_header_top_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Address */
|
||||
$wp_customize->add_setting(
|
||||
'header_address',
|
||||
array(
|
||||
'default' => $default_options['header_address'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'header_address', array(
|
||||
'selector' => '.header-t .address address',
|
||||
'render_callback' => 'rara_business_header_address_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'header_address',
|
||||
array(
|
||||
'label' => __( 'Address', 'rara-business' ),
|
||||
'description' => __( 'Add address in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
'active_callback' => 'rara_business_header_top_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Email */
|
||||
$wp_customize->add_setting(
|
||||
'header_email',
|
||||
array(
|
||||
'default' => $default_options['header_email'],
|
||||
'sanitize_callback' => 'sanitize_email',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'header_email', array(
|
||||
'selector' => '.header-t .email a.email-link',
|
||||
'render_callback' => 'rara_business_header_email_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'header_email',
|
||||
array(
|
||||
'label' => __( 'Email', 'rara-business' ),
|
||||
'description' => __( 'Add email in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
'active_callback' => 'rara_business_header_top_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable Social Links */
|
||||
$wp_customize->add_setting(
|
||||
'ed_header_social_links',
|
||||
array(
|
||||
'default' => $default_options['ed_header_social_links'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_header_social_links',
|
||||
array(
|
||||
'section' => 'header_section',
|
||||
'label' => __( 'Enable Social Links', 'rara-business' ),
|
||||
'description' => __( 'Enable to show social links at header.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
new Rara_Business_Repeater_Setting(
|
||||
$wp_customize,
|
||||
'header_social_links',
|
||||
array(
|
||||
'default' => $default_options['header_social_links'],
|
||||
'sanitize_callback' => array( 'Rara_Business_Repeater_Setting', 'sanitize_repeater_setting' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Control_Repeater(
|
||||
$wp_customize,
|
||||
'header_social_links',
|
||||
array(
|
||||
'section' => 'header_section',
|
||||
'label' => __( 'Social Links', 'rara-business' ),
|
||||
'fields' => array(
|
||||
'font' => array(
|
||||
'type' => 'font',
|
||||
'label' => __( 'Font Awesome Icon', 'rara-business' ),
|
||||
'description' => __( 'Example: fa-bell', 'rara-business' ),
|
||||
),
|
||||
'link' => array(
|
||||
'type' => 'url',
|
||||
'label' => __( 'Link', 'rara-business' ),
|
||||
'description' => __( 'Example: http://facebook.com', 'rara-business' ),
|
||||
)
|
||||
),
|
||||
'row_label' => array(
|
||||
'type' => 'field',
|
||||
'value' => __( 'links', 'rara-business' ),
|
||||
'field' => 'link'
|
||||
),
|
||||
'choices' => array(
|
||||
'limit' => 10
|
||||
),
|
||||
'active_callback' => 'rara_business_header_top_section_ac',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Custom Link Icon */
|
||||
$wp_customize->add_setting(
|
||||
'custom_link_icon',
|
||||
array(
|
||||
'default' => $default_options['custom_link_icon'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'custom_link_icon',
|
||||
array(
|
||||
'type' => 'font',
|
||||
'label' => __( 'Custom Link Icon', 'rara-business' ),
|
||||
'description' => __( 'Insert Icon eg. fa fa-edit.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
)
|
||||
);
|
||||
|
||||
/** Custom Link label */
|
||||
$wp_customize->add_setting(
|
||||
'custom_link_label',
|
||||
array(
|
||||
'default' => $default_options['custom_link_label'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'custom_link_label', array(
|
||||
'selector' => '.main-header .right .btn-buy',
|
||||
'render_callback' => 'rara_business_header_custom_link_label_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'custom_link_label',
|
||||
array(
|
||||
'label' => __( 'Custom Link Label', 'rara-business' ),
|
||||
'description' => __( 'Add cutom link button label in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
)
|
||||
);
|
||||
|
||||
/** Custom Link */
|
||||
$wp_customize->add_setting(
|
||||
'custom_link',
|
||||
array(
|
||||
'default' => $default_options['custom_link'],
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'custom_link',
|
||||
array(
|
||||
'label' => __( 'Custom link', 'rara-business' ),
|
||||
'description' => __( 'Add custom link in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'url',
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_header_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_top_section_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_header_top_section_ac( $control ){
|
||||
$ed_header_top = $control->manager->get_setting( 'ed_header_contact_details' )->value();
|
||||
$social_media_control = $control->manager->get_setting( 'ed_header_social_links' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// Phone number, Address, Email and Custom Link controls
|
||||
if ( $control_id == 'header_phone' && $ed_header_top ) return true;
|
||||
if ( $control_id == 'header_address' && $ed_header_top ) return true;
|
||||
if ( $control_id == 'header_email' && $ed_header_top ) return true;
|
||||
if ( $control_id == 'header_social_links' && $social_media_control ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Misc Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_misc_section' ) ) :
|
||||
/**
|
||||
* Add social media section controls
|
||||
*/
|
||||
function rara_business_customize_register_misc_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Misc Settings */
|
||||
$wp_customize->add_section(
|
||||
'misc_settings',
|
||||
array(
|
||||
'title' => __( 'Misc Settings', 'rara-business' ),
|
||||
'priority' => 50,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Show Animation */
|
||||
$wp_customize->add_setting(
|
||||
'ed_animation',
|
||||
array(
|
||||
'default' => $default_options['ed_animation'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_animation',
|
||||
array(
|
||||
'section' => 'misc_settings',
|
||||
'label' => __( 'Enable Animation', 'rara-business' ),
|
||||
'description' => __( 'Enable/Disable Animation on the theme', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Misc Settings Ends */
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_misc_section' );
|
||||
@@ -0,0 +1,384 @@
|
||||
<?php
|
||||
/**
|
||||
* Post and Page Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_post_page_section' ) ) :
|
||||
/**
|
||||
* Add social media section controls
|
||||
*/
|
||||
function rara_business_customize_register_post_page_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Posts(Blog) & Pages Settings */
|
||||
$wp_customize->add_section(
|
||||
'post_page_settings',
|
||||
array(
|
||||
'title' => __( 'Posts(Blog) & Pages Settings', 'rara-business' ),
|
||||
'priority' => 40,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Page Sidebar layout */
|
||||
$wp_customize->add_setting(
|
||||
'page_sidebar_layout',
|
||||
array(
|
||||
'default' => $default_options['page_sidebar_layout'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_radio'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Radio_Image_Control(
|
||||
$wp_customize,
|
||||
'page_sidebar_layout',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Page Sidebar Layout', 'rara-business' ),
|
||||
'description' => __( 'This is the general sidebar layout for pages. You can override the sidebar layout for individual page in repective page.', 'rara-business' ),
|
||||
'choices' => array(
|
||||
'no-sidebar' => get_template_directory_uri() . '/images/no-sidebar.png',
|
||||
'left-sidebar' => get_template_directory_uri() . '/images/left-sidebar.png',
|
||||
'right-sidebar' => get_template_directory_uri() . '/images/right-sidebar.png',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Post Sidebar layout */
|
||||
$wp_customize->add_setting(
|
||||
'post_sidebar_layout',
|
||||
array(
|
||||
'default' => $default_options['post_sidebar_layout'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_radio'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Radio_Image_Control(
|
||||
$wp_customize,
|
||||
'post_sidebar_layout',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Post Sidebar Layout', 'rara-business' ),
|
||||
'description' => __( 'This is the general sidebar layout for posts. You can override the sidebar layout for individual post in repective post.', 'rara-business' ),
|
||||
'choices' => array(
|
||||
'no-sidebar' => get_template_directory_uri() . '/images/no-sidebar.png',
|
||||
'left-sidebar' => get_template_directory_uri() . '/images/left-sidebar.png',
|
||||
'right-sidebar' => get_template_directory_uri() . '/images/right-sidebar.png',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Blog Excerpt */
|
||||
$wp_customize->add_setting(
|
||||
'ed_excerpt',
|
||||
array(
|
||||
'default' => $default_options['ed_excerpt'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_excerpt',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Enable Blog Excerpt', 'rara-business' ),
|
||||
'description' => __( 'Enable to show excerpt or disable to show full post content.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Excerpt Length */
|
||||
$wp_customize->add_setting(
|
||||
'excerpt_length',
|
||||
array(
|
||||
'default' => $default_options['excerpt_length'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_number_absint'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Slider_Control(
|
||||
$wp_customize,
|
||||
'excerpt_length',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Excerpt Length', 'rara-business' ),
|
||||
'description' => __( 'Automatically generated excerpt length (in words).', 'rara-business' ),
|
||||
'choices' => array(
|
||||
'min' => 10,
|
||||
'max' => 100,
|
||||
'step' => 5,
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Read More Text */
|
||||
$wp_customize->add_setting(
|
||||
'read_more_text',
|
||||
array(
|
||||
'default' => $default_options['read_more_text'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'read_more_text',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Read More Text', 'rara-business' ),
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'read_more_text', array(
|
||||
'selector' => '.entry-footer a.btn-readmore',
|
||||
'render_callback' => 'rara_business_readmore_label_selective_refresh',
|
||||
) );
|
||||
|
||||
/** Hide Posted Date */
|
||||
$wp_customize->add_setting(
|
||||
'ed_post_date_meta',
|
||||
array(
|
||||
'default' => $default_options['ed_post_date_meta'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_post_date_meta',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Posted Date Meta', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide posted date.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Hide Posted Date */
|
||||
$wp_customize->add_setting(
|
||||
'ed_post_author_meta',
|
||||
array(
|
||||
'default' => $default_options['ed_post_author_meta'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_post_author_meta',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Author Meta', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide author meta.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Prefix Archive Page */
|
||||
$wp_customize->add_setting(
|
||||
'ed_prefix_archive',
|
||||
array(
|
||||
'default' => $default_options['ed_prefix_archive'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_prefix_archive',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Prefix in Archive Page', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide prefix in archive page.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Note */
|
||||
$wp_customize->add_setting(
|
||||
'post_note_text',
|
||||
array(
|
||||
'default' => $default_options['post_note_text'],
|
||||
'sanitize_callback' => 'wp_kses_post'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Note_Control(
|
||||
$wp_customize,
|
||||
'post_note_text',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'description' => __( '<hr/>These options affect your individual posts.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Hide Author */
|
||||
$wp_customize->add_setting(
|
||||
'ed_author',
|
||||
array(
|
||||
'default' => $default_options['ed_author'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_author',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Author', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide author section.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Show Related Posts */
|
||||
$wp_customize->add_setting(
|
||||
'ed_related',
|
||||
array(
|
||||
'default' => $default_options['ed_related'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_related',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Show Related Posts', 'rara-business' ),
|
||||
'description' => __( 'Enable to show related posts in single page.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Related Posts section title */
|
||||
$wp_customize->add_setting(
|
||||
'related_post_title',
|
||||
array(
|
||||
'default' => $default_options['related_post_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'related_post_title',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Related Posts Section Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_page_post_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'related_post_title', array(
|
||||
'selector' => '.related-post h2.section-title',
|
||||
'render_callback' => 'rara_business_related_post_section_title_selective_refresh',
|
||||
) );
|
||||
|
||||
|
||||
/** Show Popular Posts */
|
||||
$wp_customize->add_setting(
|
||||
'ed_popular_posts',
|
||||
array(
|
||||
'default' => $default_options['ed_popular_posts'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_popular_posts',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Show Popular Posts', 'rara-business' ),
|
||||
'description' => __( 'Enable to show popular posts in single page.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Popular Posts section title */
|
||||
$wp_customize->add_setting(
|
||||
'popular_post_title',
|
||||
array(
|
||||
'default' => $default_options['popular_post_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'popular_post_title',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Popular Posts Section Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_page_post_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'popular_post_title', array(
|
||||
'selector' => '.popular-post h2.section-title',
|
||||
'render_callback' => 'rara_business_popular_post_section_title_selective_refresh',
|
||||
) );
|
||||
|
||||
/** Show Featured Image */
|
||||
$wp_customize->add_setting(
|
||||
'ed_featured_image',
|
||||
array(
|
||||
'default' => $default_options['ed_featured_image'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_featured_image',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Show Featured Image', 'rara-business' ),
|
||||
'description' => __( 'Enable to show featured image in post detail (single page).', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Posts(Blog) & Pages Settings Ends */
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_post_page_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_page_post_section_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_page_post_section_ac( $control ) {
|
||||
$ed_related_post = $control->manager->get_setting( 'ed_related' )->value();
|
||||
$ed_popular_post = $control->manager->get_setting( 'ed_popular_posts' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
if ( $control_id == 'related_post_title' && $ed_related_post ) return true;
|
||||
if ( $control_id == 'popular_post_title' && $ed_popular_post ) return true;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* SEO Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_seo_section' ) ) :
|
||||
/**
|
||||
* Add seo section controls
|
||||
*/
|
||||
function rara_business_customize_register_seo_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** SEO Settings */
|
||||
$wp_customize->add_section(
|
||||
'seo_settings',
|
||||
array(
|
||||
'title' => __( 'SEO Settings', 'rara-business' ),
|
||||
'priority' => 30,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable updated date */
|
||||
$wp_customize->add_setting(
|
||||
'ed_post_update_date',
|
||||
array(
|
||||
'default' => $default_options['ed_post_update_date'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_post_update_date',
|
||||
array(
|
||||
'section' => 'seo_settings',
|
||||
'label' => __( 'Enable Last Update Post Date', 'rara-business' ),
|
||||
'description' => __( 'Enable to show last updated post date on listing as well as in single post.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable Breadcrumb */
|
||||
$wp_customize->add_setting(
|
||||
'ed_breadcrumb',
|
||||
array(
|
||||
'default' => $default_options['ed_breadcrumb'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_breadcrumb',
|
||||
array(
|
||||
'section' => 'seo_settings',
|
||||
'label' => __( 'Enable Breadcrumb', 'rara-business' ),
|
||||
'description' => __( 'Enable to show breadcrumb in inner pages.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Breadcrumb Home Text */
|
||||
$wp_customize->add_setting(
|
||||
'home_text',
|
||||
array(
|
||||
'default' => $default_options['home_text'],
|
||||
'sanitize_callback' => 'sanitize_text_field'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'home_text',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'seo_settings',
|
||||
'label' => __( 'Breadcrumb Home Text', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_breadcrumb_ac',
|
||||
)
|
||||
);
|
||||
|
||||
/** SEO Settings Ends */
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_seo_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_breadcrumb_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_breadcrumb_ac( $control ) {
|
||||
$breadcrumb_control = $control->manager->get_setting( 'ed_breadcrumb' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
if ( $control_id == 'home_text' && $breadcrumb_control ) return true;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Sanitization Functions
|
||||
*
|
||||
* @link https://github.com/WPTRT/code-examples/blob/master/customizer/sanitization-callbacks.php
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
|
||||
function rara_business_sanitize_checkbox( $checked ){
|
||||
// Boolean check.
|
||||
return ( ( isset( $checked ) && true == $checked ) ? true : false );
|
||||
}
|
||||
|
||||
function rara_business_sanitize_select( $value ){
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
foreach ( $value as $key => $subvalue ) {
|
||||
$value[ $key ] = sanitize_text_field( $subvalue );
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
return sanitize_text_field( $value );
|
||||
|
||||
}
|
||||
|
||||
function rara_business_sanitize_radio( $input, $setting ) {
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
|
||||
function rara_business_sanitize_number_absint( $number, $setting ) {
|
||||
// Ensure $number is an absolute integer (whole number, zero or greater).
|
||||
$number = absint( $number );
|
||||
|
||||
// If the input is an absolute integer, return it; otherwise, return the default
|
||||
return ( $number ? $number : $setting->default );
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Demo Content
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customizer_demo_content' ) ) :
|
||||
/**
|
||||
* Add demo content info
|
||||
*/
|
||||
function rara_business_customizer_demo_content( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'demo_content_section' , array(
|
||||
'title' => __( 'Demo Content Import' , 'rara-business' ),
|
||||
'priority' => 7,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'demo_content_instruction',
|
||||
array(
|
||||
'sanitize_callback' => 'wp_kses_post'
|
||||
)
|
||||
);
|
||||
|
||||
/* translators: 1: string, 2: url, 3: string */
|
||||
$demo_content_description = sprintf( '%1$s<a class="documentation" href="%2$s" target="_blank">%3$s</a>', esc_html__( 'Rara Business comes with demo content import feature. You can import the demo content with just one click. For step-by-step video tutorial, ', 'rara-business' ), esc_url( 'https://rarathemes.com/blog/import-demo-content-rara-themes/' ), esc_html__( 'Click here', 'rara-business' ) );
|
||||
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Note_Control(
|
||||
$wp_customize,
|
||||
'demo_content_instruction',
|
||||
array(
|
||||
'section' => 'demo_content_section',
|
||||
'description' => $demo_content_description
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$theme_demo_content_desc = '';
|
||||
|
||||
if( ! class_exists( 'RDDI_init' ) ) {
|
||||
$theme_demo_content_desc .= '<span class="sticky_info_row"><label class="row-element">' . __( 'Plugin required', 'rara-business' ) . ': </label><a href="' . esc_url( 'https://wordpress.org/plugins/rara-one-click-demo-import/' ) . '" target="_blank">' . __( 'Rara One Click Demo Import', 'rara-business' ) . '</a></span><br />';
|
||||
}
|
||||
|
||||
$theme_demo_content_desc .= '<span class="sticky_info_row download-link"><label class="row-element">' . __( 'Download Demo Content', 'rara-business' ) . ': </label><a href="' . esc_url( 'https://docs.rarathemes.com/docs/rara-business/theme-installation-activation/how-to-import-demo-content/' ) . '" target="_blank">' . __( 'Click here', 'rara-business' ) . '</a></span><br />';
|
||||
|
||||
$wp_customize->add_setting( 'theme_demo_content_info',array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
));
|
||||
|
||||
// Demo content
|
||||
$wp_customize->add_control( new Rara_Business_Note_Control( $wp_customize ,'theme_demo_content_info',array(
|
||||
'section' => 'demo_content_section',
|
||||
'description' => $theme_demo_content_desc
|
||||
)));
|
||||
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customizer_demo_content' );
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Footer Setting
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
function rara_business_customize_register_footer( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section(
|
||||
'rara_business_footer_settings',
|
||||
array(
|
||||
'title' => __( 'Footer Settings', 'rara-business' ),
|
||||
'priority' => 199,
|
||||
'capability' => 'edit_theme_options',
|
||||
)
|
||||
);
|
||||
|
||||
/** Footer Copyright */
|
||||
$wp_customize->add_setting(
|
||||
'footer_copyright',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'footer_copyright',
|
||||
array(
|
||||
'label' => __( 'Footer Copyright Text', 'rara-business' ),
|
||||
'section' => 'rara_business_footer_settings',
|
||||
'type' => 'textarea',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'footer_copyright', array(
|
||||
'selector' => '.site-footer .footer-b span.copyright',
|
||||
'render_callback' => 'rara_business_get_footer_copyright',
|
||||
) );
|
||||
|
||||
}
|
||||
add_action( 'customize_register', 'rara_business_customize_register_footer' );
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Info
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customizer_theme_info' ) ) :
|
||||
/**
|
||||
* Add theme info
|
||||
*/
|
||||
function rara_business_customizer_theme_info( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'theme_info_section', array(
|
||||
'title' => __( 'Demo & Documentation' , 'rara-business' ),
|
||||
'priority' => 6,
|
||||
) );
|
||||
|
||||
/** Important Links */
|
||||
$wp_customize->add_setting( 'theme_info_setting',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$theme_info = '<p>';
|
||||
|
||||
/* translators: 1: string, 2: preview url, 3: string */
|
||||
$theme_info .= sprintf( '%1$s<a href="%2$s" target="_blank">%3$s</a>', esc_html__( 'Demo Link : ', 'rara-business' ), esc_url( 'https://rarathemesdemo.com/' . RARA_BUSINESS_THEME_TEXTDOMAIN . '/'), esc_html__( 'Click here.', 'rara-business' ) );
|
||||
|
||||
$theme_info .= '</p><p>';
|
||||
|
||||
/* translators: 1: string, 2: documentation url, 3: string */
|
||||
$theme_info .= sprintf( '%1$s<a href="%2$s" target="_blank">%3$s</a>', esc_html__( 'Documentation Link : ', 'rara-business' ), esc_url( 'https://docs.rarathemes.com/docs/rara-business/' ), esc_html__( 'Click here.', 'rara-business' ) );
|
||||
|
||||
$theme_info .= '</p>';
|
||||
|
||||
$wp_customize->add_control( new Rara_Business_Note_Control( $wp_customize,
|
||||
'theme_info_setting',
|
||||
array(
|
||||
'section' => 'theme_info_section',
|
||||
'description' => $theme_info
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customizer_theme_info' );
|
||||
|
||||
if( class_exists( 'WP_Customize_Section' ) ) :
|
||||
/**
|
||||
* Adding Go to Pro Section in Customizer
|
||||
* https://github.com/justintadlock/trt-customizer-pro
|
||||
*/
|
||||
class Rara_Business_Customize_Section_Pro extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'pro-section';
|
||||
|
||||
/**
|
||||
* Custom button text to output.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_text = '';
|
||||
|
||||
/**
|
||||
* Custom pro button URL.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_url = '';
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
|
||||
$json['pro_text'] = $this->pro_text;
|
||||
$json['pro_url'] = esc_url( $this->pro_url );
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the Underscore.js template.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function render_template() { ?>
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
<h3 class="accordion-section-title">
|
||||
{{ data.title }}
|
||||
<# if ( data.pro_text && data.pro_url ) { #>
|
||||
<a href="{{ data.pro_url }}" class="button button-secondary alignright" target="_blank">{{ data.pro_text }}</a>
|
||||
<# } #>
|
||||
</h3>
|
||||
</li>
|
||||
<?php }
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'customize_register', 'rara_business_page_sections_pro' );
|
||||
|
||||
function rara_business_page_sections_pro( $manager ) {
|
||||
// Register custom section types.
|
||||
$manager->register_section_type( 'Rara_Business_Customize_Section_Pro' );
|
||||
|
||||
// Register sections.
|
||||
$manager->add_section(
|
||||
new Rara_Business_Customize_Section_Pro(
|
||||
$manager,
|
||||
'rara_business_view_pro',
|
||||
array(
|
||||
'title' => esc_html__( 'Pro Available', 'rara-business' ),
|
||||
'priority' => 5,
|
||||
'pro_text' => esc_html__( 'VIEW PRO THEME', 'rara-business' ),
|
||||
'pro_url' => 'https://rarathemes.com/wordpress-themes/rara-business-pro/'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Site Identitiy Customizer section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
if ( ! function_exists( 'rara_business_customize_register_site_identity_section' ) ) :
|
||||
/**
|
||||
* Add custom site identity controls
|
||||
*/
|
||||
function rara_business_customize_register_site_identity_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Add postMessage support for site title and description */
|
||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
|
||||
|
||||
// Selective refresh for blogname
|
||||
$wp_customize->selective_refresh->add_partial( 'blogname', array(
|
||||
'selector' => '.site-title a',
|
||||
'render_callback' => 'rara_business_customize_partial_blogname',
|
||||
) );
|
||||
|
||||
// Selective refresh for blogdescription
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '.site-description',
|
||||
'render_callback' => 'rara_business_customize_partial_blogdescription',
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_site_identity_section' );
|
||||
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Customizer selective refresh functions.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_partial_blogname' ) ) :
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_customize_partial_blogname() {
|
||||
$blog_name = get_bloginfo( 'name' );
|
||||
|
||||
if ( $blog_name ){
|
||||
return esc_html( $blog_name );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_partial_blogdescription' ) ) :
|
||||
/**
|
||||
* Render the site description for the selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_customize_partial_blogdescription() {
|
||||
$blog_description = get_bloginfo( 'description' );
|
||||
|
||||
if ( $blog_description ){
|
||||
return esc_html( $blog_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner title selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_title = get_theme_mod( 'banner_title', $default_options['banner_title'] );
|
||||
|
||||
if ( $banner_title ){
|
||||
return esc_html( $banner_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_description_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner description selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_description_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_description = get_theme_mod( 'banner_description', $default_options['banner_description'] );
|
||||
|
||||
if ( $banner_description ){
|
||||
return esc_html( $banner_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_link_one_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner link one label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_link_one_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_link_one_label = get_theme_mod( 'banner_link_one_label', $default_options['banner_link_one_label'] );
|
||||
|
||||
if ( $banner_link_one_label ){
|
||||
return esc_html( $banner_link_one_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_link_two_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner link two label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_link_two_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_link_two_label = get_theme_mod( 'banner_link_two_label', $default_options['banner_link_two_label'] );
|
||||
|
||||
if ( $banner_link_two_label ){
|
||||
return esc_html( $banner_link_two_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_portfolio_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render portfolio title selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_portfolio_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$portfolio_title = get_theme_mod( 'portfolio_title', $default_options['portfolio_title'] );
|
||||
|
||||
if ( $portfolio_title ){
|
||||
return esc_html( $portfolio_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_portfolio_description_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render portfolio description selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_portfolio_description_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$portfolio_description = get_theme_mod( 'portfolio_description', $default_options['portfolio_description'] );
|
||||
|
||||
if ( $portfolio_description ){
|
||||
return esc_html( $portfolio_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_blog_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render blog title selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_blog_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$blog_title = get_theme_mod( 'blog_title', $default_options['blog_title'] );
|
||||
|
||||
if ( $blog_title ){
|
||||
return esc_html( $blog_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_blog_description_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render blog description selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_blog_description_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$blog_description = get_theme_mod( 'blog_description', $default_options['blog_description'] );
|
||||
|
||||
if ( $blog_description ){
|
||||
return esc_html( $blog_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_phone_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render header phone number selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_phone_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$phone_number = get_theme_mod( 'header_phone', $default_options['header_phone'] );
|
||||
|
||||
if ( $phone_number ){
|
||||
return esc_html( $phone_number );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_address_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render header address number selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_address_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$address = get_theme_mod( 'header_address', $default_options['header_address'] );
|
||||
|
||||
if ( $address ){
|
||||
return esc_html( $address );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_email_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render header email number selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_email_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$email = get_theme_mod( 'header_email', $default_options['header_email'] );
|
||||
|
||||
if ( $email ){
|
||||
return esc_html( $email );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_custom_link_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render custom link label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_custom_link_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$custom_link_label = get_theme_mod( 'custom_link_label', $default_options['custom_link_label'] );
|
||||
|
||||
if ( $custom_link_label ){
|
||||
return esc_html( $custom_link_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_readmore_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render readmore label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_readmore_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$readmore_label = get_theme_mod( 'read_more_text', $default_options['read_more_text'] );
|
||||
|
||||
if ( $readmore_label ){
|
||||
return esc_html( $readmore_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_related_post_section_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render related post section title for selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_related_post_section_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$related_post_title = get_theme_mod( 'related_post_title', $default_options['related_post_title'] );
|
||||
|
||||
if ( $related_post_title ){
|
||||
return esc_html( $related_post_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_popular_post_section_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render popular post section title for selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_popular_post_section_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$popular_post_title = get_theme_mod( 'popular_post_title', $default_options['popular_post_title'] );
|
||||
|
||||
if ( $popular_post_title ){
|
||||
return esc_html( $popular_post_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
if( ! function_exists( 'rara_business_get_footer_copyright' ) ) :
|
||||
/**
|
||||
* Footer Copyright
|
||||
*/
|
||||
function rara_business_get_footer_copyright(){
|
||||
$copyright = get_theme_mod( 'footer_copyright' );
|
||||
echo '<span class="copyright">';
|
||||
if( $copyright ){
|
||||
echo wp_kses_post( $copyright );
|
||||
}else{
|
||||
esc_html_e( 'Copyright © ', 'rara-business' );
|
||||
echo date_i18n( esc_html__( 'Y', 'rara-business' ) );
|
||||
echo ' <a href="' . esc_url( home_url( '/' ) ) . '">' . esc_html( get_bloginfo( 'name' ) ) . '</a>. ';
|
||||
}
|
||||
echo '</span>';
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* New React Dashboard page
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
/**
|
||||
* Init Admin Menu.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rara_business_dashboard_menu() {
|
||||
add_theme_page(
|
||||
RARA_BUSINESS_THEME_NAME,
|
||||
RARA_BUSINESS_THEME_NAME,
|
||||
'manage_options',
|
||||
'rara-business-dashboard',
|
||||
'rara_business_dashboard_page'
|
||||
);
|
||||
}
|
||||
add_action( 'admin_menu', 'rara_business_dashboard_menu' );
|
||||
|
||||
/**
|
||||
* Callback function for React Dashboard Admin Page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rara_business_dashboard_page() { ?>
|
||||
<div id="cw-dashboard" class="cw-dashboard"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles for admin scripts.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function rara_business_dashboard_scripts() {
|
||||
|
||||
$admin_page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : null;
|
||||
|
||||
if( $admin_page === 'rara-business-dashboard' ){
|
||||
$dependencies_file_path = get_template_directory() . '/build/dashboard.asset.php';
|
||||
if ( file_exists( $dependencies_file_path ) ) {
|
||||
$dashboard_assets = require $dependencies_file_path;
|
||||
$js_dependencies = ( ! empty( $dashboard_assets['dependencies'] ) ) ? $dashboard_assets['dependencies'] : [];
|
||||
$version = ( ! empty( $dashboard_assets['version'] ) ) ? $dashboard_assets['version'] : '2.0.0';
|
||||
$js_dependencies[] = 'updates';
|
||||
|
||||
wp_enqueue_script(
|
||||
'rara-business-react-dashboard',
|
||||
get_template_directory_uri() . '/build/dashboard.js',
|
||||
$js_dependencies,
|
||||
$version,
|
||||
true
|
||||
);
|
||||
|
||||
// Add Translation support for Dashboard
|
||||
wp_set_script_translations( 'rara-business-react-dashboard', 'rara-business' );
|
||||
|
||||
$arrayargs = [
|
||||
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
||||
'blog_name' => RARA_BUSINESS_THEME_NAME,
|
||||
'theme_version' => RARA_BUSINESS_THEME_VERSION,
|
||||
'inactivePlugins' => rara_business_get_inactive_plugins(),
|
||||
'activePlugins' => rara_business_get_active_plugins(),
|
||||
'review' => esc_url('https://wordpress.org/support/theme/rara-business/reviews/'),
|
||||
'docmentation' => esc_url('https://docs.rarathemes.com/docs/rara-business/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=docs'),
|
||||
'support' => esc_url('https://rarathemes.com/support-ticket/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=support'),
|
||||
'videotutorial' => esc_url('https://www.youtube.com/@rarathemes'),
|
||||
'get_pro' => esc_url('https://rarathemes.com/wordpress-themes/rara-business-pro/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=upgrade_to_pro'),
|
||||
'website' => esc_url('https://rarathemes.com/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=website_visit'),
|
||||
'theme_club_upgrade' => esc_url('https://rarathemes.com/theme-club/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=theme_club'),
|
||||
'sales_funnel' => esc_url('https://rarathemes.com/sales-funnel/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=sales_funnel'),
|
||||
'custom_fonts' => esc_url('https://rarathemes.com/wordpress-themes/wp-custom-fonts/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=wp_custom_fonts'),
|
||||
'vip_site_care' => esc_url('https://rarathemes.com/vip-sitecare/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=vip_sitecare'),
|
||||
'theme_install' => esc_url('https://rarathemes.com/wordpress-themes/theme-installation-and-setup/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=theme_install'),
|
||||
'plugin_setup' => esc_url('https://rarathemes.com/wordpress-themes/must-have-plugins/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=plugin_setup'),
|
||||
'seo_setup' => esc_url('https://rarathemes.com/wordpress-themes/must-have-seo-setup/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=seo_setup'),
|
||||
'gdpr_setup' => esc_url('https://rarathemes.com/wordpress-themes/gdpr-compliance/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=gdpr_setup'),
|
||||
'vip_support' => esc_url('https://rarathemes.com/wordpress-themes/vip-support/?utm_source=rara_business&utm_medium=dashboard&utm_campaign=vip_support'),
|
||||
'customizer_url' => esc_url( admin_url( 'customize.php' ) ),
|
||||
'custom_logo' => esc_url( admin_url( 'customize.php?autofocus[control]=custom_logo' ) ),
|
||||
'colors' => esc_url( admin_url( 'customize.php?autofocus[section]=colors' ) ),
|
||||
'typography' => esc_url(admin_url('customize.php?autofocus[section]=typography_settings')),
|
||||
'general' => esc_url( admin_url( 'customize.php?autofocus[panel]=general_settings_panel' ) ),
|
||||
'frontpage' => esc_url( admin_url( 'customize.php?autofocus[panel]=frontpage_panel' ) ),
|
||||
'footer' => esc_url( admin_url( 'customize.php?autofocus[section]=rara_business_footer_settings' ) ),
|
||||
];
|
||||
|
||||
wp_localize_script( 'rara-business-react-dashboard','cw_dashboard',$arrayargs );
|
||||
}
|
||||
wp_enqueue_style( 'rara-business-react-dashboard', get_template_directory_uri() . '/build/dashboard.css' );
|
||||
}
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'rara_business_dashboard_scripts' );
|
||||
|
||||
/**
|
||||
* Get the inactive plugins.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function rara_business_get_inactive_plugins() {
|
||||
if (!current_user_can('install_plugins') && !current_user_can('activate_plugins')) {
|
||||
return new \WP_Error( 'rest_forbidden', esc_html__( 'Sorry, you are not allowed to do that.', 'rara-business' ), array( 'status' => 403 ) );
|
||||
}
|
||||
|
||||
// Get the list of all installed plugins
|
||||
$all_plugins = get_plugins();
|
||||
|
||||
// Fetch the row from the options table containing active plugins
|
||||
$active_plugins_option = get_option('active_plugins');
|
||||
|
||||
// Unserialize the active plugins data
|
||||
$active_plugins = is_array($active_plugins_option) ? $active_plugins_option : [];
|
||||
|
||||
// Get the slugs of active plugins
|
||||
$active_plugin_slugs = array_map(function($plugin) {
|
||||
return plugin_basename($plugin);
|
||||
}, $active_plugins);
|
||||
|
||||
// Get the slugs of inactive plugins
|
||||
$inactive_plugin_slugs = array_diff(array_keys($all_plugins), $active_plugin_slugs);
|
||||
|
||||
// Get the details of inactive plugins
|
||||
$inactive_plugins = array_intersect_key($all_plugins, array_flip($inactive_plugin_slugs));
|
||||
|
||||
// Initialize an empty array to hold the modified inactive plugins
|
||||
$modified_inactive_plugins = array();
|
||||
// Iterate over each inactive plugin
|
||||
foreach ($inactive_plugins as $key => $plugin_data) {
|
||||
$extract = explode( '/', $key );
|
||||
// Extract the necessary information
|
||||
$name = $plugin_data['Name'];
|
||||
$slug = $extract[0];
|
||||
|
||||
// Add the plugin to the modified array
|
||||
$modified_inactive_plugins[] = array(
|
||||
'name' => esc_html($name),
|
||||
'slug' => sanitize_title($slug),
|
||||
'url' => rara_business_get_activation_url($slug)
|
||||
);
|
||||
}
|
||||
|
||||
// Return the modified array
|
||||
return $modified_inactive_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the activation URL for a plugin.
|
||||
*
|
||||
* @param string $plugin_slug The plugin slug.
|
||||
*
|
||||
* @return string|bool The activation URL if the plugin exists, false otherwise.
|
||||
*/
|
||||
function rara_business_get_activation_url($plugin_slug) {
|
||||
if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
|
||||
$plugins = get_plugins( '/' . $plugin_slug );
|
||||
if ( ! empty( $plugins ) ) {
|
||||
$keys = array_keys( $plugins );
|
||||
$plugin_file = $plugin_slug . '/' . $keys[0];
|
||||
$url = wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'action' => 'activate',
|
||||
'plugin' => $plugin_file,
|
||||
),
|
||||
admin_url( 'plugins.php' )
|
||||
),
|
||||
'activate-plugin_' . $plugin_file
|
||||
);
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active plugins.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function rara_business_get_active_plugins() {
|
||||
$active_plugins = get_plugins();
|
||||
$plugins = array();
|
||||
|
||||
foreach ($active_plugins as $key => $plugin) {
|
||||
if ( is_plugin_active( $key ) ) {
|
||||
$extract = explode( '/', $key );
|
||||
$path = ABSPATH . 'wp-content/plugins/' . $key;
|
||||
$plugin_data = get_plugin_data($path);
|
||||
$plugins[] = array(
|
||||
'name' => esc_html($plugin_data['Name']),
|
||||
'slug' => sanitize_title($extract[0]),
|
||||
'version' => esc_html($plugin_data['Version']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
@@ -0,0 +1,789 @@
|
||||
<?php
|
||||
/**
|
||||
* Custom template tags for this theme
|
||||
*
|
||||
* Eventually, some of the functionality here could be replaced by core features.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_posted_on' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current post-date/time.
|
||||
*/
|
||||
function rara_business_posted_on() {
|
||||
$default_options = rara_business_default_theme_options(); // Get default theme options
|
||||
$post_updated_date = get_theme_mod( 'ed_post_update_date', $default_options['ed_post_update_date'] );
|
||||
$hide_date = get_theme_mod( 'ed_post_date_meta', $default_options['ed_post_date_meta'] );
|
||||
$hide_author = get_theme_mod( 'ed_post_author_meta', $default_options['ed_post_author_meta'] );
|
||||
$on = '';
|
||||
|
||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||
if( $post_updated_date ){
|
||||
$time_string = '<time class="entry-date published updated" datetime="%3$s" itemprop="dateModified">%4$s</time></time><time class="updated" datetime="%1$s" itemprop="datePublished">%2$s</time>';
|
||||
$on = __( 'Updated on ', 'rara-business' );
|
||||
}else{
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time><time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
|
||||
}
|
||||
}else{
|
||||
$time_string = '<time class="entry-date published updated" datetime="%1$s" itemprop="datePublished">%2$s</time><time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
|
||||
}
|
||||
|
||||
$time_string = sprintf( $time_string,
|
||||
esc_attr( get_the_date( 'c' ) ),
|
||||
esc_html( get_the_date() ),
|
||||
esc_attr( get_the_modified_date( 'c' ) ),
|
||||
esc_html( get_the_modified_date() )
|
||||
);
|
||||
|
||||
if ( ! $hide_author && ! $hide_date ) {
|
||||
$separator = '<span class="separator">/</span>';
|
||||
} else {
|
||||
$separator = '';
|
||||
}
|
||||
|
||||
$posted_on = sprintf( '%1$s %2$s', esc_html( $on ), '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||
);
|
||||
|
||||
echo '<span class="posted-on">'. $posted_on .'</span>'. $separator; // WPCS: XSS OK.
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_posted_by' ) ) :
|
||||
/**
|
||||
* Prints HTML with meta information for the current author
|
||||
*/
|
||||
function rara_business_posted_by(){
|
||||
$default_options = rara_business_default_theme_options(); // Get default theme options
|
||||
$hide_date = get_theme_mod( 'ed_post_date_meta', $default_options['ed_post_date_meta'] );
|
||||
$hide_author = get_theme_mod( 'ed_post_author_meta', $default_options['ed_post_author_meta'] );
|
||||
|
||||
$byline = '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" itemprop="url"><span itemprop="name">' . esc_html( get_the_author() ) . '</span></a></span>';
|
||||
|
||||
echo '<span class="byline" itemprop="author" itemscope itemtype="https://schema.org/Person"> ' . $byline . '</span>';
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_categories' ) ) :
|
||||
/**
|
||||
* Categories
|
||||
*/
|
||||
function rara_business_categories(){
|
||||
// Hide category and tag text for pages.
|
||||
if ( 'post' === get_post_type() ) {
|
||||
$categories_list = get_the_category_list( ' ' );
|
||||
if ( $categories_list ) {
|
||||
echo '<div class="categories">' . $categories_list . '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_tags' ) ) :
|
||||
/**
|
||||
* Tags
|
||||
*/
|
||||
function rara_business_tags(){
|
||||
// Hide category and tag text for pages.
|
||||
if ( 'post' === get_post_type() ) {
|
||||
$tags_list = get_the_tag_list( '', ' ' );
|
||||
if ( $tags_list ) {
|
||||
echo '<div class="tag">' . $tags_list . '</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_theme_comment' ) ) :
|
||||
/**
|
||||
* Callback function for Comment List *
|
||||
*
|
||||
* @link https://codex.wordpress.org/Function_Reference/wp_list_comments
|
||||
*/
|
||||
function rara_business_theme_comment( $comment, $args, $depth ){
|
||||
if ( 'div' == $args['style'] ) {
|
||||
$tag = 'div';
|
||||
$add_below = 'comment';
|
||||
} else {
|
||||
$tag = 'li';
|
||||
$add_below = 'div-comment';
|
||||
}
|
||||
?>
|
||||
<<?php echo $tag ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ) ?> id="comment-<?php comment_ID() ?>">
|
||||
|
||||
<?php if ( 'div' != $args['style'] ) : ?>
|
||||
<div id="div-comment-<?php comment_ID() ?>" class="comment-body" itemscope itemtype="https://schema.org/UserComments">
|
||||
<?php endif; ?>
|
||||
|
||||
<footer class="comment-meta">
|
||||
<div class="comment-author vcard">
|
||||
<?php if ( $args['avatar_size'] != 0 ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
|
||||
</div><!-- .comment-author vcard -->
|
||||
</footer>
|
||||
|
||||
<div class="text-holder">
|
||||
<div class="top">
|
||||
<div class="left">
|
||||
<?php if ( $comment->comment_approved == '0' ) : ?>
|
||||
<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'rara-business' ); ?></em>
|
||||
<br />
|
||||
<?php endif;
|
||||
/* translators: %s: author link */
|
||||
printf( __( '<b class="fn" itemprop="creator" itemscope itemtype="https://schema.org/Person">%s</b> <span class="says">says:</span>', 'rara-business' ), get_comment_author_link() );
|
||||
?>
|
||||
<div class="comment-metadata commentmetadata">
|
||||
<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ); ?>">
|
||||
<time itemprop="commentTime" datetime="<?php echo esc_attr( get_gmt_from_date( get_comment_date() . get_comment_time(), 'Y-m-d H:i:s' ) ); ?>">
|
||||
<?php
|
||||
/* translators: 1: comment date, 2: comment time */
|
||||
printf( esc_html__( '%1$s at %2$s', 'rara-business' ), get_comment_date(), get_comment_time() ); ?>
|
||||
</time>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="reply">
|
||||
<?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment-content" itemprop="commentText"><?php comment_text(); ?></div>
|
||||
</div><!-- .text-holder -->
|
||||
|
||||
<?php if ( 'div' != $args['style'] ) : ?>
|
||||
</div><!-- .comment-body -->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_social_links' ) ) :
|
||||
/**
|
||||
* Prints social links in header
|
||||
*/
|
||||
function rara_business_social_links( $ed_social = false , $social_links = array() ){
|
||||
if( $ed_social && $social_links ){
|
||||
echo '<ul class="social-networks">';
|
||||
foreach( $social_links as $link ){
|
||||
if( $link['link'] && $link['font'] ) echo '<li><a href="' . esc_url( $link['link'] ) . '" target="_blank" rel="nofollow"><i class="' . esc_attr( $link['font'] ) . '"></i></a></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_site_branding' ) ) :
|
||||
/**
|
||||
* Site Branding
|
||||
*/
|
||||
function rara_business_site_branding(){
|
||||
$display_header_text = get_theme_mod( 'header_text', 1 );
|
||||
$site_title = get_bloginfo( 'name', 'display' );
|
||||
$description = get_bloginfo( 'description', 'display' );
|
||||
|
||||
if( ( function_exists( 'has_custom_logo' ) && has_custom_logo() ) && $display_header_text && ( ! empty( $site_title ) || ! empty( $description ) ) ){
|
||||
$branding_class = 'logo-with-site-identity';
|
||||
} else {
|
||||
$branding_class = '';
|
||||
} ?>
|
||||
<div class="site-branding <?php echo esc_attr( $branding_class ); ?>" itemscope itemtype="https://schema.org/Organization">
|
||||
<?php
|
||||
if( function_exists( 'has_custom_logo' ) && has_custom_logo() ) the_custom_logo();
|
||||
|
||||
echo '<div class="text-logo">';
|
||||
if( is_front_page() ){ ?>
|
||||
<h1 class="site-title" itemprop="name"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" itemprop="url"><?php bloginfo( 'name' ); ?></a></h1>
|
||||
<?php } else { ?>
|
||||
<p class="site-title" itemprop="name"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" itemprop="url"><?php bloginfo( 'name' ); ?></a></p>
|
||||
<?php }
|
||||
|
||||
if ( $description || is_customize_preview() ){ ?>
|
||||
<p class="site-description" itemprop="description"><?php echo esc_html( $description ); ?></p>
|
||||
<?php }
|
||||
echo '</div><!-- .text-logo -->';
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_header_navigation' ) ) :
|
||||
/**
|
||||
* Navigation
|
||||
*/
|
||||
function rara_business_header_navigation(){
|
||||
?>
|
||||
<nav id="site-navigation" class="main-navigation" itemscope itemtype="https://schema.org/SiteNavigationElement">
|
||||
<?php
|
||||
wp_nav_menu( array(
|
||||
'theme_location' => 'primary',
|
||||
'menu_id' => 'primary-menu',
|
||||
'fallback_cb' => 'rara_business_primary_menu_fallback',
|
||||
) );
|
||||
?>
|
||||
</nav><!-- #site-navigation -->
|
||||
<?php
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_mobile_header' ) ) :
|
||||
/**
|
||||
* Mobile header
|
||||
*/
|
||||
function rara_business_mobile_header(){
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$phone = get_theme_mod( 'header_phone', $default_options['header_phone'] );
|
||||
$address = get_theme_mod( 'header_address', $default_options['header_address'] );
|
||||
$email = get_theme_mod( 'header_email', $default_options['header_email'] );
|
||||
$icon = get_theme_mod( 'custom_link_icon', $default_options['custom_link_icon'] );
|
||||
$label = get_theme_mod( 'custom_link_label', $default_options['custom_link_label'] );
|
||||
$ed_header_social = get_theme_mod( 'ed_header_social_links', $default_options['ed_header_social_links'] );
|
||||
$social_links = get_theme_mod( 'header_social_links', $default_options['header_social_links'] );
|
||||
$link = get_theme_mod( 'custom_link', $default_options['custom_link'] );
|
||||
?>
|
||||
<div class="responsive-menu-holder">
|
||||
<div class="container">
|
||||
<nav id="mobile-site-navigation" class="main-navigation mobile-navigation">
|
||||
<div class="primary-menu-list main-menu-modal cover-modal" data-modal-target-string=".main-menu-modal">
|
||||
<button class="close close-main-nav-toggle" data-toggle-target=".main-menu-modal" data-toggle-body-class="showing-main-menu-modal" aria-expanded="false" data-set-focus=".main-menu-modal"><i class="fas fa-times"></i></button>
|
||||
<div class= "social-networks-holder">
|
||||
<div class="container">
|
||||
<?php rara_business_social_links( $ed_header_social, $social_links ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mobile-menu" aria-label="<?php esc_attr_e( 'Mobile', 'rara-business' ); ?>">
|
||||
<?php
|
||||
wp_nav_menu( array(
|
||||
'theme_location' => 'primary',
|
||||
'menu_id' => 'mobile-primary-menu',
|
||||
'menu_class' => 'nav-menu main-menu-modal',
|
||||
'container' => false,
|
||||
'fallback_cb' => 'rara_business_primary_menu_fallback',
|
||||
) );
|
||||
if( $link && $label ) rara_business_custom_link( $icon, $link, $label );
|
||||
|
||||
if( $phone || $address || $email ){ ?>
|
||||
<div class="contact-info">
|
||||
<?php
|
||||
if( $phone ) rara_business_header_phone( $phone );
|
||||
if( $address ) rara_business_header_address( $address );
|
||||
if( $email ) rara_business_header_email( $email );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</nav><!-- #mobile-site-navigation -->
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_header_phone' ) ) :
|
||||
/**
|
||||
* Phone
|
||||
*/
|
||||
function rara_business_header_phone( $phone ){ ?>
|
||||
<div class="phone">
|
||||
<i class="fa fa-mobile-phone"></i>
|
||||
<a href="<?php echo esc_url( 'tel:' . preg_replace( '/[^\d+]/', '', $phone ) ); ?>" class="tel-link"><?php echo esc_html( $phone ); ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_header_address' ) ) :
|
||||
/**
|
||||
* Address
|
||||
*/
|
||||
function rara_business_header_address( $address ){ ?>
|
||||
<div class="address" itemscope itemtype="https://schema.org/PostalAddress">
|
||||
<i class="fa fa-map-marker"></i>
|
||||
<address><?php echo esc_html( $address ); ?></address>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_header_email' ) ) :
|
||||
/**
|
||||
* Email
|
||||
*/
|
||||
function rara_business_header_email( $email ){ ?>
|
||||
<div class="email">
|
||||
<i class="fa fa-envelope-o"></i>
|
||||
<a href="<?php echo esc_url( 'mailto:' . sanitize_email( $email ) ); ?>" class="email-link"><?php echo esc_html( $email ); ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_custom_link' ) ) :
|
||||
/**
|
||||
* Additional Link in menu
|
||||
*/
|
||||
function rara_business_custom_link( $icon, $link, $label ){
|
||||
if( ! empty( $icon ) ){
|
||||
echo '<a href="' . esc_url( $link ) . '" class="btn-buy custom_label"><i class="'. esc_attr( $icon ) .'"></i>' . esc_html( $label ) . '</a>';
|
||||
} else {
|
||||
echo '<a href="' . esc_url( $link ) . '" class="btn-buy">' . esc_html( $label ) . '</a>';
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_primary_menu_fallback' ) ) :
|
||||
/**
|
||||
* Primary Menu Fallback
|
||||
*/
|
||||
function rara_business_primary_menu_fallback(){
|
||||
if( current_user_can( 'manage_options' ) ){
|
||||
echo '<ul id="primary-menu" class="menu">';
|
||||
echo '<li><a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '">' . esc_html__( 'Click here to add a menu', 'rara-business' ) . '</a></li>';
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_get_home_sections' ) ) :
|
||||
/**
|
||||
* Returns Home Sections
|
||||
*/
|
||||
function rara_business_get_home_sections(){
|
||||
$sections = array(
|
||||
'services' => array( 'sidebar' => 'services' ),
|
||||
'about' => array( 'sidebar' => 'about' ),
|
||||
'choose-us' => array( 'sidebar' => 'choose-us' ),
|
||||
'team' => array( 'sidebar' => 'team' ),
|
||||
'testimonial' => array( 'sidebar' => 'testimonial' ),
|
||||
'stats' => array( 'sidebar' => 'stats' ),
|
||||
'portfolio' => array( 'section' => 'portfolio' ),
|
||||
'blog' => array( 'section' => 'blog' ),
|
||||
'cta' => array( 'sidebar' => 'cta' ),
|
||||
'faq' => array( 'sidebar' => 'faq' ),
|
||||
'client' => array( 'sidebar' => 'client' )
|
||||
);
|
||||
|
||||
$enabled_section = array();
|
||||
|
||||
foreach( $sections as $k => $v ){
|
||||
if( array_key_exists( 'sidebar', $v ) ){
|
||||
if( is_active_sidebar( $v['sidebar'] ) ) array_push( $enabled_section, $v['sidebar'] );
|
||||
}else{
|
||||
if( get_theme_mod( 'ed_' . $v['section'] . '_section', true ) ) array_push( $enabled_section, $v['section'] );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'rara_business_home_sections', $enabled_section );
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_get_portfolio_buttons' ) ) :
|
||||
/**
|
||||
* Query for Portfolio Buttons
|
||||
*/
|
||||
function rara_business_get_portfolio_buttons( $no_of_portfolio, $home = false ){
|
||||
if( taxonomy_exists( 'rara_portfolio_categories' ) ){
|
||||
if( $home ){
|
||||
$s = '';
|
||||
$i = 0;
|
||||
$portfolio_posts = get_posts( array( 'post_type' => 'rara-portfolio', 'post_status' => 'publish', 'posts_per_page' => $no_of_portfolio ) );
|
||||
foreach( $portfolio_posts as $portfolio ){
|
||||
$terms = get_the_terms( $portfolio->ID, 'rara_portfolio_categories' );
|
||||
if( $terms ){
|
||||
foreach( $terms as $term ){
|
||||
$i++;
|
||||
$s .= $term->term_id;
|
||||
$s .= ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
$term_ids = explode( ', ', $s );
|
||||
$term_ids = array_diff( array_unique( $term_ids ), array('') );
|
||||
wp_reset_postdata();//Reseting get_posts
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'taxonomy' => 'rara_portfolio_categories',
|
||||
'orderby' => 'name',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
$terms = get_terms( $args );
|
||||
if( $terms ){
|
||||
?>
|
||||
<div class="button-group filter-button-group">
|
||||
<button data-filter="*" class="button is-checked"><?php echo esc_html_e( 'All', 'rara-business' ); ?></button><!-- This is HACK for reducing space between inline block elements.
|
||||
--><?php
|
||||
foreach( $terms as $t ){
|
||||
if( $home ){
|
||||
if( in_array( $t->term_id, $term_ids ) )
|
||||
echo '<button class="button" data-filter=".' . esc_attr( $t->slug ) . '">' . esc_html( $t->name ) . '</button>';
|
||||
}else{
|
||||
echo '<button class="button" data-filter=".' . esc_attr( $t->slug ) . '">' . esc_html( $t->name ) . '</button>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_get_portfolios' ) ) :
|
||||
/**
|
||||
* Query for portfolios
|
||||
*/
|
||||
function rara_business_get_portfolios( $no_of_portfolio = -1 ){
|
||||
$portfolio_qry = new WP_Query( array( 'post_type' => 'rara-portfolio', 'post_status' => 'publish', 'posts_per_page' => $no_of_portfolio ) );
|
||||
if( taxonomy_exists( 'rara_portfolio_categories' ) && $portfolio_qry->have_posts() ){ ?>
|
||||
|
||||
<div class="filter-grid">
|
||||
<?php
|
||||
while( $portfolio_qry->have_posts() ){
|
||||
$portfolio_qry->the_post();
|
||||
$terms = get_the_terms( get_the_ID(), 'rara_portfolio_categories' );
|
||||
$s = '';
|
||||
$n = '';
|
||||
$i = 0;
|
||||
if( $terms ){
|
||||
foreach( $terms as $t ){
|
||||
$i++;
|
||||
$s .= $t->slug;
|
||||
$n .= '#'.$t->name;
|
||||
if( count( $terms ) > $i ){
|
||||
$s .= ' ';
|
||||
$n .= ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if( has_post_thumbnail() ){ ?>
|
||||
<div class="element-item <?php echo esc_attr( $s );?>">
|
||||
<div class="img-holder">
|
||||
<a href="<?php the_permalink(); ?>">
|
||||
<?php the_post_thumbnail( 'rara-business-portfolio' ); ?>
|
||||
</a>
|
||||
<div class="text-holder">
|
||||
<div class="text">
|
||||
<?php
|
||||
the_title( '<h3 class="title">', '</h3>' );
|
||||
if( $n ) echo '<p>'. esc_html( $n ) .'</p>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</div><!-- .filter-grid -->
|
||||
<?php
|
||||
wp_reset_postdata();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
/**
|
||||
* Query WooCommerce activation
|
||||
*/
|
||||
function rara_business_is_woocommerce_activated() {
|
||||
return class_exists( 'woocommerce' ) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query Rara theme companion activation
|
||||
*/
|
||||
function rara_business_is_rara_theme_companion_activated() {
|
||||
return class_exists( 'Raratheme_Companion_Public' ) ? true : false;
|
||||
}
|
||||
|
||||
if( ! function_exists( 'rara_business_get_svg' ) ) :
|
||||
/**
|
||||
* Return SVG markup.
|
||||
*
|
||||
* @param array $args {
|
||||
* Parameters needed to display an SVG.
|
||||
*
|
||||
* @type string $icon Required SVG icon filename.
|
||||
* @type string $title Optional SVG title.
|
||||
* @type string $desc Optional SVG description.
|
||||
* }
|
||||
* @return string SVG markup.
|
||||
*/
|
||||
function rara_business_get_svg( $args = array() ) {
|
||||
// Make sure $args are an array.
|
||||
if ( empty( $args ) ) {
|
||||
return __( 'Please define default parameters in the form of an array.', 'rara-business' );
|
||||
}
|
||||
|
||||
// Define an icon.
|
||||
if ( false === array_key_exists( 'icon', $args ) ) {
|
||||
return __( 'Please define an SVG icon filename.', 'rara-business' );
|
||||
}
|
||||
|
||||
// Set defaults.
|
||||
$defaults = array(
|
||||
'icon' => '',
|
||||
'title' => '',
|
||||
'desc' => '',
|
||||
'fallback' => false,
|
||||
);
|
||||
|
||||
// Parse args.
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
// Set aria hidden.
|
||||
$aria_hidden = ' aria-hidden="true"';
|
||||
|
||||
// Set ARIA.
|
||||
$aria_labelledby = '';
|
||||
|
||||
/*
|
||||
* Restaurant and Cafe Pro doesn't use the SVG title or description attributes; non-decorative icons are described with .screen-reader-text.
|
||||
*
|
||||
* However, child themes can use the title and description to add information to non-decorative SVG icons to improve accessibility.
|
||||
*
|
||||
* Example 1 with title: <?php echo rara_business_get_svg( array( 'icon' => 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ) ) ); ?>
|
||||
*
|
||||
* Example 2 with title and description: <?php echo rara_business_get_svg( array( 'icon' => 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ), 'desc' => __( 'This is the description', 'textdomain' ) ) ); ?>
|
||||
*
|
||||
* See https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/.
|
||||
*/
|
||||
if ( $args['title'] ) {
|
||||
$aria_hidden = '';
|
||||
$unique_id = uniqid();
|
||||
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"';
|
||||
|
||||
if ( $args['desc'] ) {
|
||||
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"';
|
||||
}
|
||||
}
|
||||
|
||||
// Begin SVG markup.
|
||||
$svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . $aria_labelledby . ' role="img">';
|
||||
|
||||
// Display the title.
|
||||
if ( $args['title'] ) {
|
||||
$svg .= '<title id="title-' . $unique_id . '">' . esc_html( $args['title'] ) . '</title>';
|
||||
|
||||
// Display the desc only if the title is already set.
|
||||
if ( $args['desc'] ) {
|
||||
$svg .= '<desc id="desc-' . $unique_id . '">' . esc_html( $args['desc'] ) . '</desc>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the icon.
|
||||
*
|
||||
* The whitespace around `<use>` is intentional - it is a work around to a keyboard navigation bug in Safari 10.
|
||||
*
|
||||
* See https://core.trac.wordpress.org/ticket/38387.
|
||||
*/
|
||||
$svg .= ' <use href="#icon-' . esc_attr( $args['icon'] ) . '" xlink:href="#icon-' . esc_attr( $args['icon'] ) . '"></use> ';
|
||||
|
||||
// Add some markup to use as a fallback for browsers that do not support SVGs.
|
||||
if ( $args['fallback'] ) {
|
||||
$svg .= '<span class="svg-fallback icon-' . esc_attr( $args['icon'] ) . '"></span>';
|
||||
}
|
||||
|
||||
$svg .= '</svg>';
|
||||
|
||||
return $svg;
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_sidebar_layout' ) ) :
|
||||
/**
|
||||
* Return sidebar layouts for pages/posts
|
||||
*/
|
||||
function rara_business_sidebar_layout(){
|
||||
global $post;
|
||||
$return = false;
|
||||
$page_layout = get_theme_mod( 'page_sidebar_layout', 'right-sidebar' ); //Default Layout Style for Pages
|
||||
$post_layout = get_theme_mod( 'post_sidebar_layout', 'right-sidebar' ); //Default Layout Style for Posts
|
||||
|
||||
if( is_singular( array( 'page', 'post' ) ) ){
|
||||
if( get_post_meta( $post->ID, 'sidebar_layout', true ) ){
|
||||
$sidebar_layout = get_post_meta( $post->ID, 'sidebar_layout', true );
|
||||
}else{
|
||||
$sidebar_layout = 'default-sidebar';
|
||||
}
|
||||
|
||||
if( is_page() ){
|
||||
if( is_page_template( 'templates/portfolio.php' ) ){
|
||||
$return = '';
|
||||
}elseif( is_active_sidebar( 'sidebar' ) ){
|
||||
if( $sidebar_layout == 'no-sidebar' ){
|
||||
$return = 'full-width';
|
||||
}elseif( ( $sidebar_layout == 'default-sidebar' && $page_layout == 'right-sidebar' ) || ( $sidebar_layout == 'right-sidebar' ) ){
|
||||
$return = 'rightsidebar';
|
||||
}elseif( ( $sidebar_layout == 'default-sidebar' && $page_layout == 'left-sidebar' ) || ( $sidebar_layout == 'left-sidebar' ) ){
|
||||
$return = 'leftsidebar';
|
||||
}elseif( $sidebar_layout == 'default-sidebar' && $page_layout == 'no-sidebar' ){
|
||||
$return = 'full-width';
|
||||
}
|
||||
}else{
|
||||
$return = 'full-width';
|
||||
}
|
||||
}elseif( is_single() ){
|
||||
if( is_active_sidebar( 'sidebar' ) ){
|
||||
if( $sidebar_layout == 'no-sidebar' ){
|
||||
$return = 'full-width';
|
||||
}elseif( ( $sidebar_layout == 'default-sidebar' && $post_layout == 'right-sidebar' ) || ( $sidebar_layout == 'right-sidebar' ) ){
|
||||
$return = 'rightsidebar';
|
||||
}elseif( ( $sidebar_layout == 'default-sidebar' && $post_layout == 'left-sidebar' ) || ( $sidebar_layout == 'left-sidebar' ) ){
|
||||
$return = 'leftsidebar';
|
||||
}elseif( $sidebar_layout == 'default-sidebar' && $post_layout == 'no-sidebar' ){
|
||||
$return = 'full-width';
|
||||
}
|
||||
}else{
|
||||
$return = 'full-width';
|
||||
}
|
||||
}
|
||||
}elseif( is_tax( 'rara_portfolio_categories' ) ){
|
||||
$return = 'page-template-portfolio';
|
||||
}elseif( is_singular( 'rara-portfolio' ) ){
|
||||
$return = 'full-width';
|
||||
}elseif( rara_business_is_woocommerce_activated() && is_post_type_archive( 'product' ) ){
|
||||
if( is_active_sidebar( 'shop-sidebar' ) ){
|
||||
$return = 'rightsidebar';
|
||||
}else{
|
||||
$return = 'full-width';
|
||||
}
|
||||
}else{
|
||||
if( is_active_sidebar( 'sidebar' ) ){
|
||||
$return = 'rightsidebar';
|
||||
}else{
|
||||
$return = 'full-width';
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_escape_text_tags' ) ) :
|
||||
/**
|
||||
* Remove new line tags from string
|
||||
*
|
||||
* @param $text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function rara_business_escape_text_tags( $text ) {
|
||||
return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) );
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_fonts_url' ) ) :
|
||||
/**
|
||||
* Register custom fonts.
|
||||
*/
|
||||
function rara_business_fonts_url() {
|
||||
$fonts_url = '';
|
||||
|
||||
/*
|
||||
* Translators: If there are characters in your language that are not
|
||||
* supported by Lato fonts, translate this to 'off'. Do not translate
|
||||
* into your own language.
|
||||
*/
|
||||
$lato_font = _x( 'on', 'Lato font: on or off', 'rara-business' );
|
||||
|
||||
/*
|
||||
* Translators: If there are characters in your language that are not
|
||||
* supported by Montserrat fonts, translate this to 'off'. Do not translate
|
||||
* into your own language.
|
||||
*/
|
||||
$montserrat_font = _x( 'on', 'Montserrat font: on or off', 'rara-business' );
|
||||
|
||||
if ( 'off' !== $lato_font || 'off' !== $montserrat_font ) {
|
||||
$font_families = array();
|
||||
|
||||
if ( 'off' !== $lato_font ) {
|
||||
$font_families[] = 'Lato:100,100i,300,300i,400,400i,700,700i,900,900i';
|
||||
|
||||
}
|
||||
|
||||
if ( 'off' !== $montserrat_font ) {
|
||||
$font_families[] = 'Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
|
||||
|
||||
}
|
||||
|
||||
$query_args = array(
|
||||
'family' => urlencode( implode( '|', $font_families ) ),
|
||||
'subset' => urlencode( 'latin,latin-ext' ),
|
||||
'display' => urlencode( 'fallback' ),
|
||||
);
|
||||
|
||||
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
|
||||
}
|
||||
|
||||
return esc_url( $fonts_url );
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'wp_body_open' ) ) :
|
||||
/**
|
||||
* Fire the wp_body_open action.
|
||||
*
|
||||
* Added for backwards compatibility to support pre 5.2.0 WordPress versions.
|
||||
*
|
||||
*/
|
||||
function wp_body_open() {
|
||||
/**
|
||||
* Triggered after the opening <body> tag.
|
||||
*
|
||||
*/
|
||||
do_action( 'wp_body_open' );
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_load_preload_local_fonts') ) :
|
||||
/**
|
||||
* Get the file preloads.
|
||||
*
|
||||
* @param string $url The URL of the remote webfont.
|
||||
* @param string $format The font-format. If you need to support IE, change this to "woff".
|
||||
*/
|
||||
function rara_business_load_preload_local_fonts( $url, $format = 'woff2' ) {
|
||||
|
||||
// Check if cached font files data preset present or not. Basically avoiding 'rara_business_WebFont_Loader' class rendering.
|
||||
$local_font_files = get_site_option( 'rara_business_local_font_files', false );
|
||||
|
||||
if ( is_array( $local_font_files ) && ! empty( $local_font_files ) ) {
|
||||
$font_format = apply_filters( 'rara_business_local_google_fonts_format', $format );
|
||||
foreach ( $local_font_files as $key => $local_font ) {
|
||||
if ( $local_font ) {
|
||||
echo '<link rel="preload" href="' . esc_url( $local_font ) . '" as="font" type="font/' . esc_attr( $font_format ) . '" crossorigin>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Now preload font data after processing it, as we didn't get stored data.
|
||||
$font = rara_business_webfont_loader_instance( $url );
|
||||
$font->set_font_format( $format );
|
||||
$font->preload_local_fonts();
|
||||
}
|
||||
endif;
|
||||
|
||||
if( ! function_exists( 'rara_business_flush_local_google_fonts' ) ){
|
||||
/**
|
||||
* Ajax Callback for flushing the local font
|
||||
*/
|
||||
function rara_business_flush_local_google_fonts() {
|
||||
$WebFontLoader = new Rara_Business_WebFont_Loader();
|
||||
//deleting the fonts folder using ajax
|
||||
$WebFontLoader->delete_fonts_folder();
|
||||
die();
|
||||
}
|
||||
}
|
||||
add_action( 'wp_ajax_flush_local_google_fonts', 'rara_business_flush_local_google_fonts' );
|
||||
add_action( 'wp_ajax_nopriv_flush_local_google_fonts', 'rara_business_flush_local_google_fonts' );
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
function check_page_templates(){
|
||||
$('.inside #page_template').each(function(i,e){
|
||||
if( $(this).val() === "templates/portfolio.php" ){
|
||||
$('#rara_business_sidebar_layout').hide();
|
||||
}else{
|
||||
$('#rara_business_sidebar_layout').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
$('.inside #page_template').on( 'change', check_page_templates );
|
||||
|
||||
// Hide metabox options when static front page is set
|
||||
if( rb_show_metabox.hide_metabox == '1' ){
|
||||
$('#rara_business_sidebar_layout').hide();
|
||||
}
|
||||
} )
|
||||
@@ -0,0 +1,128 @@
|
||||
( function( api ) {
|
||||
|
||||
// Extends our custom "example-1" section.
|
||||
api.sectionConstructor['pro-section'] = api.Section.extend( {
|
||||
|
||||
// No events for this type of section.
|
||||
attachEvents: function () {},
|
||||
|
||||
// Always make the section active.
|
||||
isContextuallyActive: function () {
|
||||
return true;
|
||||
}
|
||||
} );
|
||||
|
||||
} )( wp.customize );
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
/* Move widgets to their respective sections */
|
||||
wp.customize.section( 'sidebar-widgets-services' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-services' ).priority( '50' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-about' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-about' ).priority( '55' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-choose-us' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-choose-us' ).priority( '60' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-team' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-team' ).priority( '65' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-testimonial' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-testimonial' ).priority( '70' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-stats' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-stats' ).priority( '75' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-cta' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-cta' ).priority( '80' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-faq' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-faq' ).priority( '85' );
|
||||
|
||||
wp.customize.section( 'sidebar-widgets-client' ).panel( 'frontpage_panel' );
|
||||
wp.customize.section( 'sidebar-widgets-client' ).priority( '90' );
|
||||
|
||||
// Scroll to section
|
||||
$('body').on('click', '#sub-accordion-panel-frontpage_panel .control-subsection .accordion-section-title', function(event) {
|
||||
var section_id = $(this).parent('.control-subsection').attr('id');
|
||||
scrollToSection( section_id );
|
||||
});
|
||||
|
||||
$('body').on('click', '.flush-it', function(event) {
|
||||
$.ajax ({
|
||||
url : rara_business_cdata.ajax_url,
|
||||
type : 'post',
|
||||
data : 'action=flush_local_google_fonts',
|
||||
nonce : rara_business_cdata.nonce,
|
||||
success : function(results){
|
||||
//results can be appended in needed
|
||||
$( '.flush-it' ).val(rara_business_cdata.flushit);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function scrollToSection( section_id ){
|
||||
var preview_section_id = "banner_section";
|
||||
|
||||
var $contents = jQuery('#customize-preview iframe').contents();
|
||||
|
||||
switch ( section_id ) {
|
||||
|
||||
case 'accordion-section-header_image':
|
||||
preview_section_id = "banner-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-services':
|
||||
preview_section_id = "services-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-about':
|
||||
preview_section_id = "about-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-choose-us':
|
||||
preview_section_id = "choose-us";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-team':
|
||||
preview_section_id = "team-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-testimonial':
|
||||
preview_section_id = "testimonial-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-stats':
|
||||
preview_section_id = "stats-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-portfolio_section':
|
||||
preview_section_id = "portfolio-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-blog_section':
|
||||
preview_section_id = "blog-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-cta':
|
||||
preview_section_id = "cta-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-faq':
|
||||
preview_section_id = "faq-section";
|
||||
break;
|
||||
|
||||
case 'accordion-section-sidebar-widgets-client':
|
||||
preview_section_id = "client-section";
|
||||
break;
|
||||
}
|
||||
|
||||
if( $contents.find('#'+preview_section_id).length > 0 && $contents.find('.home').length > 0 ){
|
||||
$contents.find("html, body").animate({
|
||||
scrollTop: $contents.find( "#" + preview_section_id ).offset().top
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/**
|
||||
* Metabox for Sidebar Layout
|
||||
*
|
||||
* @package Rara_Business
|
||||
*
|
||||
*/
|
||||
|
||||
function rara_business_add_sidebar_layout_box(){
|
||||
$screens = array( 'post', 'page' );
|
||||
foreach( $screens as $screen ){
|
||||
add_meta_box(
|
||||
'rara_business_sidebar_layout',
|
||||
__( 'Sidebar Layout', 'rara-business' ),
|
||||
'rara_business_sidebar_layout_callback',
|
||||
$screen,
|
||||
'normal',
|
||||
'high'
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'add_meta_boxes', 'rara_business_add_sidebar_layout_box' );
|
||||
|
||||
$rara_business_sidebar_layout = array(
|
||||
'default-sidebar'=> array(
|
||||
'value' => 'default-sidebar',
|
||||
'label' => __( 'Default Sidebar', 'rara-business' ),
|
||||
'thumbnail' => get_template_directory_uri() . '/images/default-sidebar.png'
|
||||
),
|
||||
'no-sidebar' => array(
|
||||
'value' => 'no-sidebar',
|
||||
'label' => __( 'Full Width', 'rara-business' ),
|
||||
'thumbnail' => get_template_directory_uri() . '/images/no-sidebar.png'
|
||||
),
|
||||
'left-sidebar' => array(
|
||||
'value' => 'left-sidebar',
|
||||
'label' => __( 'Left Sidebar', 'rara-business' ),
|
||||
'thumbnail' => get_template_directory_uri() . '/images/left-sidebar.png'
|
||||
),
|
||||
'right-sidebar' => array(
|
||||
'value' => 'right-sidebar',
|
||||
'label' => __( 'Right Sidebar', 'rara-business' ),
|
||||
'thumbnail' => get_template_directory_uri() . '/images/right-sidebar.png'
|
||||
)
|
||||
);
|
||||
|
||||
function rara_business_sidebar_layout_callback(){
|
||||
global $post, $rara_business_sidebar_layout;
|
||||
wp_nonce_field( basename( __FILE__ ), 'rara_business_nonce' );
|
||||
?>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<td colspan="4"><em class="f13"><?php esc_html_e( 'Choose Sidebar Template', 'rara-business' ); ?></em></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
foreach( $rara_business_sidebar_layout as $field ){
|
||||
$layout = get_post_meta( $post->ID, 'sidebar_layout', true ); ?>
|
||||
|
||||
<div class="radio-image-wrapper" style="float:left; margin-right:30px;">
|
||||
<label class="description">
|
||||
<span><img src="<?php echo esc_url( $field['thumbnail'] ); ?>" alt="<?php echo esc_attr( $field['label'] ); ?>" /></span><br/>
|
||||
<input type="radio" name="sidebar_layout" value="<?php echo esc_attr( $field['value'] ); ?>" <?php checked( $field['value'], $layout ); if( empty( $layout ) ){ checked( $field['value'], 'default-sidebar' ); }?>/> <?php echo esc_html( $field['label'] ); ?>
|
||||
</label>
|
||||
</div>
|
||||
<?php } // end foreach
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
function rara_business_savesidebar_layout( $post_id ){
|
||||
global $rara_business_sidebar_layout;
|
||||
|
||||
// Verify the nonce before proceeding.
|
||||
if( !isset( $_POST[ 'rara_business_nonce' ] ) || !wp_verify_nonce( $_POST[ 'rara_business_nonce' ], basename( __FILE__ ) ) )
|
||||
return;
|
||||
|
||||
// Stop WP from clearing custom fields on autosave
|
||||
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
||||
return;
|
||||
|
||||
if( 'page' == $_POST['post_type'] ){
|
||||
if( ! current_user_can( 'edit_page', $post_id ) ) return $post_id;
|
||||
}elseif( ! current_user_can( 'edit_post', $post_id ) ){
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
$layout = isset( $_POST['sidebar_layout'] ) ? sanitize_key( $_POST['sidebar_layout'] ) : 'default-sidebar';
|
||||
|
||||
if( array_key_exists( $layout, $rara_business_sidebar_layout ) ){
|
||||
update_post_meta( $post_id, 'sidebar_layout', $layout );
|
||||
}else{
|
||||
delete_post_meta( $post_id, 'sidebar_layout' );
|
||||
}
|
||||
}
|
||||
add_action( 'save_post' , 'rara_business_savesidebar_layout' );
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Filter to modify functionality of RTC plugin.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if( ! function_exists( 'rara_business_cta_section_bgcolor_filter' ) ){
|
||||
/**
|
||||
* Filter to add bg color of cta section widget
|
||||
*/
|
||||
function rara_business_cta_section_bgcolor_filter(){
|
||||
return '#0aa3f3';
|
||||
}
|
||||
}
|
||||
add_filter( 'rrtc_cta_bg_color', 'rara_business_cta_section_bgcolor_filter' );
|
||||
|
||||
if( ! function_exists( 'rara_business_cta_btn_alignment_filter' ) ){
|
||||
/**
|
||||
* Filter to add btn alignment of cta section widget
|
||||
*/
|
||||
function rara_business_cta_btn_alignment_filter(){
|
||||
return 'centered';
|
||||
}
|
||||
}
|
||||
add_filter( 'rrtc_cta_btn_alignment', 'rara_business_cta_btn_alignment_filter' );
|
||||
|
||||
if( ! function_exists( 'rara_business_team_member_image_size' ) ){
|
||||
/**
|
||||
* Filter to define image size in team member section widget
|
||||
*/
|
||||
function rara_business_team_member_image_size(){
|
||||
return 'rara-business-team';
|
||||
}
|
||||
}
|
||||
add_filter( 'tmw_icon_img_size', 'rara_business_team_member_image_size' );
|
||||
|
||||
if( ! function_exists( 'rara_business_modify_testimonial_widget' ) ){
|
||||
/**
|
||||
* Filter to add modify testimonial widget
|
||||
*/
|
||||
function rara_business_modify_testimonial_widget( $html, $args, $instance ){
|
||||
$obj = new RaraTheme_Companion_Functions();
|
||||
$name = ! empty( $instance['name'] ) ? $instance['name'] : '' ;
|
||||
$designation = ! empty( $instance['designation'] ) ? $instance['designation'] : '' ;
|
||||
$testimonial = ! empty( $instance['testimonial'] ) ? $instance['testimonial'] : '';
|
||||
$image = ! empty( $instance['image'] ) ? $instance['image'] : '';
|
||||
|
||||
if( $image )
|
||||
{
|
||||
$attachment_id = $image;
|
||||
$icon_img_size = apply_filters('icon_img_size','rttk-thumb');
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="rtc-testimonial-holder">
|
||||
<div class="rtc-testimonial-inner-holder">
|
||||
<div class="text-holder">
|
||||
<?php if( $image ){ ?>
|
||||
<div class="img-holder">
|
||||
<?php echo wp_get_attachment_image( $attachment_id, $icon_img_size, false,
|
||||
array( 'alt' => esc_attr( $name ))) ;?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="testimonial-meta">
|
||||
<?php
|
||||
if( $name ) { echo '<span class="name">'.$name.'</span>'; }
|
||||
if( isset( $designation ) && $designation!='' ){
|
||||
echo '<span class="designation">'.esc_attr($designation).'</span>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if( $testimonial ) echo '<div class="testimonial-content">'.wpautop( wp_kses_post( $testimonial ) ).'</div>'; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$html = ob_get_clean();
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
add_filter( 'raratheme_companion_testimonial_widget_filter', 'rara_business_modify_testimonial_widget', 10, 3 );
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* This file represents an example of the code that themes would use to register
|
||||
* the required plugins.
|
||||
*
|
||||
* It is expected that theme authors would copy and paste this code into their
|
||||
* functions.php file, and amend to suit.
|
||||
*
|
||||
* @see http://tgmpluginactivation.com/configuration/ for detailed documentation.
|
||||
*
|
||||
* @package TGM-Plugin-Activation
|
||||
* @subpackage Example
|
||||
* @version 2.6.1 for parent theme Rara Business for publication on WordPress.org
|
||||
* @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer
|
||||
* @copyright Copyright (c) 2011, Thomas Griffin
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
|
||||
* @link https://github.com/TGMPA/TGM-Plugin-Activation
|
||||
*/
|
||||
|
||||
/**
|
||||
* Include the TGM_Plugin_Activation class.
|
||||
*/
|
||||
require_once get_template_directory() . '/inc/tgmpa/class-tgm-plugin-activation.php';
|
||||
|
||||
add_action( 'tgmpa_register', 'rara_business_register_required_plugins' );
|
||||
|
||||
/**
|
||||
* Register the required plugins for this theme.
|
||||
*
|
||||
* In this example, we register five plugins:
|
||||
* - one included with the TGMPA library
|
||||
* - two from an external source, one from an arbitrary source, one from a GitHub repository
|
||||
* - two from the .org repo, where one demonstrates the use of the `is_callable` argument
|
||||
*
|
||||
* The variables passed to the `tgmpa()` function should be:
|
||||
* - an array of plugin arrays;
|
||||
* - optionally a configuration array.
|
||||
* If you are not changing anything in the configuration array, you can remove the array and remove the
|
||||
* variable from the function call: `tgmpa( $plugins );`.
|
||||
* In that case, the TGMPA default settings will be used.
|
||||
*
|
||||
* This function is hooked into `tgmpa_register`, which is fired on the WP `init` action on priority 10.
|
||||
*/
|
||||
function rara_business_register_required_plugins() {
|
||||
/*
|
||||
* Array of plugin arrays. Required keys are name and slug.
|
||||
* If the source is NOT from the .org repo, then source is also required.
|
||||
*/
|
||||
$plugins = array(
|
||||
|
||||
// This is an example of how to include a plugin from the WordPress Plugin Repository.
|
||||
array(
|
||||
'name' => __( 'RaraTheme Companion', 'rara-business' ),
|
||||
'slug' => 'raratheme-companion',
|
||||
'required' => false,
|
||||
),
|
||||
array(
|
||||
'name' => __( 'Newsletter', 'rara-business' ),
|
||||
'slug' => 'newsletter',
|
||||
'required' => false,
|
||||
),
|
||||
array(
|
||||
'name' => __( 'Rara One Click Demo Import','rara-business' ),
|
||||
'slug' => 'rara-one-click-demo-import',
|
||||
'required' => false,
|
||||
),
|
||||
);
|
||||
|
||||
/*
|
||||
* Array of configuration settings. Amend each line as needed.
|
||||
*
|
||||
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
|
||||
* strings available, please help us make TGMPA even better by giving us access to these translations or by
|
||||
* sending in a pull-request with .po file(s) with the translations.
|
||||
*
|
||||
* Only uncomment the strings in the config array if you want to customize the strings.
|
||||
*/
|
||||
$config = array(
|
||||
'id' => 'rara-business', // Unique ID for hashing notices for multiple instances of TGMPA.
|
||||
'default_path' => '', // Default absolute path to bundled plugins.
|
||||
'menu' => 'tgmpa-install-plugins', // Menu slug.
|
||||
'has_notices' => true, // Show admin notices or not.
|
||||
'dismissable' => true, // If false, a user cannot dismiss the nag message.
|
||||
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
|
||||
'is_automatic' => false, // Automatically activate plugins after installation or not.
|
||||
'message' => '', // Message to output right before the plugins table.
|
||||
);
|
||||
|
||||
tgmpa( $plugins, $config );
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Register widget area.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
|
||||
* @package Rara_Business
|
||||
*/
|
||||
function rara_business_widgets_init() {
|
||||
|
||||
$sidebars = array(
|
||||
'sidebar' => array(
|
||||
'name' => __( 'Sidebar', 'rara-business' ),
|
||||
'id' => 'sidebar',
|
||||
'description' => __( 'Default Sidebar', 'rara-business' ),
|
||||
),
|
||||
'services' => array(
|
||||
'name' => __( 'Services Section', 'rara-business' ),
|
||||
'id' => 'services',
|
||||
'description' => __( 'Add "Text" widget for the title and description. Add "Rara: Icon Text" widget for the services.', 'rara-business' ),
|
||||
),
|
||||
'about' => array(
|
||||
'name' => __( 'About Section', 'rara-business' ),
|
||||
'id' => 'about',
|
||||
'description' => __( 'Add "Rara: Featured Page Widget" for about section.', 'rara-business' ),
|
||||
),
|
||||
'choose-us' => array(
|
||||
'name' => __( 'Why Choose Us Section', 'rara-business' ),
|
||||
'id' => 'choose-us',
|
||||
'description' => __( 'Add "Text" widget for the title and description. Add "Rara: Icon Text" widget for the choos us reasons. Add "Image" widget for featured image.', 'rara-business' ),
|
||||
),
|
||||
'team' => array(
|
||||
'name' => __( 'Team Section', 'rara-business' ),
|
||||
'id' => 'team',
|
||||
'description' => __( 'Add "Text" widget for the title and description. Add "Rara: Team Member" widget for the team members.', 'rara-business' ),
|
||||
),
|
||||
'testimonial' => array(
|
||||
'name' => __( 'Testimonial Section', 'rara-business' ),
|
||||
'id' => 'testimonial',
|
||||
'description' => __( 'Add "Text" widget for the title and description. Add "Rara: Testimonial" widget for the testimonials.', 'rara-business' ),
|
||||
),
|
||||
'stats' => array(
|
||||
'name' => __( 'Stat Counter Section', 'rara-business' ),
|
||||
'id' => 'stats',
|
||||
'description' => __( 'Add "Text" widget for the title and description. Add "Rara: Stat Counter Widget" for the statistics.', 'rara-business' ),
|
||||
),
|
||||
'cta' => array(
|
||||
'name' => __( 'Call To Action Section', 'rara-business' ),
|
||||
'id' => 'cta',
|
||||
'description' => __( 'Add "Rara : Call To Action widget" for the title, description and call to action buttons.', 'rara-business' ),
|
||||
),
|
||||
'faq' => array(
|
||||
'name' => __( 'FAQs Section', 'rara-business' ),
|
||||
'id' => 'faq',
|
||||
'description' => __( 'Add "Text" widget for the title and description. Add "Rara: FAQs" widget for frequently asked questions.', 'rara-business' ),
|
||||
),
|
||||
'client' => array(
|
||||
'name' => __( 'Clients Section', 'rara-business' ),
|
||||
'id' => 'client',
|
||||
'description' => __( 'Add "Rara: Client Logo" widget for client logos.', 'rara-business' ),
|
||||
),
|
||||
'footer-one'=> array(
|
||||
'name' => __( 'Footer One', 'rara-business' ),
|
||||
'id' => 'footer-one',
|
||||
'description' => __( 'Add footer one widgets here.', 'rara-business' ),
|
||||
),
|
||||
'footer-two'=> array(
|
||||
'name' => __( 'Footer Two', 'rara-business' ),
|
||||
'id' => 'footer-two',
|
||||
'description' => __( 'Add footer two widgets here.', 'rara-business' ),
|
||||
),
|
||||
'footer-three'=> array(
|
||||
'name' => __( 'Footer Three', 'rara-business' ),
|
||||
'id' => 'footer-three',
|
||||
'description' => __( 'Add footer three widgets here.', 'rara-business' ),
|
||||
),
|
||||
'footer-four'=> array(
|
||||
'name' => __( 'Footer Four', 'rara-business' ),
|
||||
'id' => 'footer-four',
|
||||
'description' => __( 'Add footer four widgets here.', 'rara-business' ),
|
||||
)
|
||||
);
|
||||
|
||||
foreach( $sidebars as $sidebar ){
|
||||
register_sidebar( array(
|
||||
'name' => esc_html( $sidebar['name'] ),
|
||||
'id' => esc_attr( $sidebar['id'] ),
|
||||
'description' => esc_html( $sidebar['description'] ),
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h2 class="widget-title" itemprop="name">',
|
||||
'after_title' => '</h2>',
|
||||
) );
|
||||
}
|
||||
}
|
||||
add_action( 'widgets_init', 'rara_business_widgets_init' );
|
||||
|
||||
if( ! function_exists( 'rara_business_recent_post_thumbnail' ) ):
|
||||
/**
|
||||
* Filter to modify recent post widget thumbnail image
|
||||
*/
|
||||
function rara_business_recent_post_thumbnail( $size ){
|
||||
return $size = "rara-business-blog";
|
||||
}
|
||||
endif;
|
||||
add_filter( 'rara_recent_img_size', 'rara_business_recent_post_thumbnail' );
|
||||