init
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
|
||||
function flatsome_contact_form_presets($args){
|
||||
?>
|
||||
<style>.metabox-holder .dev-cta{display:none!important;}</style>
|
||||
|
||||
<div class="metabox-holder">
|
||||
<p style="font-size: 1.5em; background-color: rgba(0, 130, 0, 0.09); padding:15px;">
|
||||
Copy and paste a form preset into the 'Form' tab.
|
||||
<a href="#">Learn more here..</a>
|
||||
</p>
|
||||
|
||||
<!-- Contact form -->
|
||||
<h3>Simple contact form</h3>
|
||||
<textarea style="width:100%;min-height: 100px;">
|
||||
<label>Your Name (required)</label>
|
||||
[text* your-name]
|
||||
|
||||
<label>Your Email (required)</label>
|
||||
[email* your-email]
|
||||
|
||||
<label>Your Message (required)</label>
|
||||
[textarea your-message]
|
||||
|
||||
[submit class:button primary "Submit"]
|
||||
|
||||
</textarea>
|
||||
|
||||
<!-- Inline Newsletter signup -->
|
||||
<h3>Newsletter Form Horizontal</h3>
|
||||
<textarea style="width:100%;min-height: 100px;">
|
||||
<div class="flex-row form-flat medium-flex-wrap">
|
||||
<div class="flex-col flex-grow">
|
||||
[email* your-email placeholder "Your Email (required)"]
|
||||
</div>
|
||||
<div class="flex-col ml-half">
|
||||
[submit class:button primary "Sign Up"]
|
||||
</div>
|
||||
</div>
|
||||
</textarea>
|
||||
|
||||
<!-- Inline Newsletter signup -->
|
||||
<h3>Newsletter Form Vertical</h3>
|
||||
<textarea style="width:100%;min-height: 100px;">
|
||||
<div class="form-flat">
|
||||
[email* your-email placeholder "Your Email (required)"]
|
||||
[submit class:button primary "Sign Up"]
|
||||
</div>
|
||||
</textarea>
|
||||
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function flatsome_contact_form_presets_tab( $panels ) {
|
||||
$new_page = array(
|
||||
'Flatsome-Presets' => array(
|
||||
'title' => __( 'Presets', 'flatsome-admin' ),
|
||||
'callback' => 'flatsome_contact_form_presets'
|
||||
)
|
||||
);
|
||||
$panels = array_merge($new_page,$panels);
|
||||
return $panels;
|
||||
}
|
||||
add_filter( 'wpcf7_editor_panels', 'flatsome_contact_form_presets_tab' ,50);
|
164
wp-content/themes/flatsome/inc/integrations/integrations.php
Normal file
164
wp-content/themes/flatsome/inc/integrations/integrations.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* Entry point for plugin integrations
|
||||
*
|
||||
* @author UX Themes
|
||||
* @category Integration
|
||||
* @package Flatsome/Integrations
|
||||
*/
|
||||
|
||||
function flatsome_integration_url() {
|
||||
return get_template_directory() . '/inc/integrations';
|
||||
}
|
||||
|
||||
function flatsome_integration_uri() {
|
||||
return get_template_directory_uri() . '/inc/integrations';
|
||||
}
|
||||
|
||||
global $integrations_url;
|
||||
global $integrations_uri;
|
||||
$integrations_url = get_template_directory() . '/inc/integrations';
|
||||
$integrations_uri = get_template_directory_uri() . '/inc/integrations';
|
||||
|
||||
function flatsome_integrations_scripts() {
|
||||
global $integrations_uri;
|
||||
|
||||
wp_dequeue_style( 'nextend_fb_connect_stylesheet' );
|
||||
wp_deregister_style( 'nextend_fb_connect_stylesheet' );
|
||||
wp_dequeue_style( 'nextend_google_connect_stylesheet' );
|
||||
wp_deregister_style( 'nextend_google_connect_stylesheet' );
|
||||
|
||||
// Ninja forms.
|
||||
if ( function_exists( 'Ninja_Forms' ) && ! is_admin() ) {
|
||||
remove_action( 'ninja_forms_display_css', 'ninja_forms_display_css' );
|
||||
wp_enqueue_style( 'flatsome-ninjaforms', $integrations_uri . '/ninjaforms/ninjaforms.css' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'flatsome_integrations_scripts' );
|
||||
|
||||
// WPML Integration.
|
||||
if ( function_exists( 'pll_get_post' ) || function_exists( 'icl_object_id' ) ) {
|
||||
require $integrations_url . '/wpml/flatsome-wpml.php';
|
||||
}
|
||||
|
||||
// Contactform7.
|
||||
if ( class_exists( 'WPCF7' ) ) {
|
||||
require $integrations_url . '/contact-form-7/contact-form-7.php';
|
||||
}
|
||||
|
||||
if ( function_exists( 'ubermenu' ) ) {
|
||||
require $integrations_url . '/ubermenu/flatsome-ubermenu.php';
|
||||
}
|
||||
|
||||
// WP Rocket.
|
||||
if ( function_exists( 'get_rocket_option' ) && ! is_admin() ) {
|
||||
require $integrations_url . '/wp-rocket/wp-rocket.php';
|
||||
}
|
||||
|
||||
// Sensei Integration.
|
||||
if ( class_exists( 'Sensei_Main' ) ) {
|
||||
require $integrations_url . '/sensei/sensei.php';
|
||||
}
|
||||
|
||||
// Yoast Integration.
|
||||
if ( class_exists( 'WPSEO_Options' ) ) {
|
||||
require $integrations_url . '/wp-seo/class-wp-seo.php';
|
||||
}
|
||||
|
||||
// Rank Math Integration.
|
||||
if ( class_exists( 'RankMath' ) ) {
|
||||
require $integrations_url . '/rank-math/class-rank-math.php';
|
||||
}
|
||||
|
||||
// WooCommerce Integrations.
|
||||
if ( is_woocommerce_activated() ) {
|
||||
|
||||
function flatsome_woocommerce_integrations_scripts() {
|
||||
|
||||
global $integrations_url, $integrations_uri;
|
||||
|
||||
if ( is_extension_activated( 'woocommerce_booking' ) ) {
|
||||
wp_enqueue_style( 'flatsome-woocommerce-bookings-style', $integrations_uri . '/wc-bookings/bookings.css', 'flatsome-woocommerce-style' );
|
||||
}
|
||||
|
||||
// Extra Product Options.
|
||||
if ( is_extension_activated( 'TM_Extra_Product_Options' ) ) {
|
||||
wp_enqueue_style( 'flatsome-woocommerce-extra-product-options', $integrations_uri . '/wc-extra-product-options/extra-product-options.css', 'flatsome-woocommerce-style' );
|
||||
}
|
||||
|
||||
if ( is_extension_activated( 'Easy_booking' ) ) {
|
||||
wp_enqueue_style( 'flatsome-woocommerce-easy-booking', $integrations_uri . '/wc-easy-booking/wc-easy-bookings.css', 'flatsome-woocommerce-style' );
|
||||
}
|
||||
|
||||
if ( is_extension_activated( 'WC_Bulk_Variations' ) ) {
|
||||
wp_enqueue_style( 'flatsome-woocommerce-bulk-variations', $integrations_uri . '/wc-bulk-variations/bulk-variations.css', 'flatsome-woocommerce-style' );
|
||||
}
|
||||
|
||||
if ( is_extension_activated( 'Fancy_Product_Designer' ) ) {
|
||||
wp_enqueue_style( 'flatsome-fancy-product-designer', $integrations_uri . '/wc-product-designer/product-designer.css', 'flatsome-woocommerce-style' );
|
||||
}
|
||||
|
||||
if ( is_extension_activated( 'Woocommerce_Advanced_Product_Labels' ) ) {
|
||||
wp_enqueue_style( 'flatsome-woocommerce-advanced-labels', $integrations_uri . '/wc-advanced-product-labels/advanced-product-labels.css', 'flatsome-woocommerce-style' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'flatsome_woocommerce_integrations_scripts' );
|
||||
|
||||
|
||||
// Add Yith Wishlist integration.
|
||||
if ( class_exists( 'YITH_WCWL' ) ) {
|
||||
require $integrations_url . '/wc-yith-wishlist/yith-wishlist.php';
|
||||
}
|
||||
|
||||
// Add Composite products integration.
|
||||
if ( class_exists( 'WC_Composite_Products' ) ) {
|
||||
require $integrations_url . '/wc-composite-products/composite-products.php';
|
||||
}
|
||||
|
||||
// WooCommerce Ajax Navigation.
|
||||
add_filter( '_ajax_layered_nav_containers', 'ux_add_custom_container' );
|
||||
function ux_add_custom_container( $containers ) {
|
||||
$containers[] = '.woocommerce-pagination';
|
||||
$containers[] = '.woocommerce-result-count';
|
||||
|
||||
return $containers;
|
||||
}
|
||||
|
||||
// Yith Ajax Navigation.
|
||||
add_filter( 'sod_ajax_layered_nav_product_container', 'aln_product_container' );
|
||||
function aln_product_container( $product_container ) {
|
||||
// Enter either the class or id of the container that holds your products.
|
||||
return '.products';
|
||||
}
|
||||
|
||||
// Infinitive scroll fix
|
||||
function flatsome_woocommerce_extensions_after_setup() {
|
||||
if ( defined( 'YITH_INFS_VERSION' ) ) {
|
||||
$options = get_option( 'yit_infs_options' );
|
||||
|
||||
if ( ! empty( $options ) || $options['yith-infs-navselector'] == '.woocommerce-pagination' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty( $options ) ) {
|
||||
$options = array();
|
||||
}
|
||||
|
||||
$new_options = array(
|
||||
'yith-infs-navselector' => '.woocommerce-pagination',
|
||||
'yith-infs-nextselector' => '.woocommerce-pagination li a.next',
|
||||
'yith-infs-itemselector' => '.products',
|
||||
'yith-infs-contentselector' => '#wrapper',
|
||||
);
|
||||
|
||||
$options = array_merge( $options, $new_options );
|
||||
|
||||
update_option( 'yit_infs_options', $options );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'after_switch_theme', 'flatsome_woocommerce_extensions_after_setup', 15 );
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
/* Ninja Forms styling */
|
||||
.ninja-forms-required-items,
|
||||
.hp-wrap,
|
||||
.honeypot-wrap{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nf-form-layout .nf-field-element select,
|
||||
.nf-form-layout .nf-field-element input{
|
||||
height: 2.7em;
|
||||
}
|
||||
|
||||
.ninja-forms-response-msg .ninja-forms-error-msg,
|
||||
.ninja-forms-field-error{
|
||||
color:red;
|
||||
}
|
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* Rank Math integration
|
||||
*
|
||||
* @author UX Themes
|
||||
* @package Flatsome\Integrations
|
||||
* @since 3.12.0
|
||||
*/
|
||||
|
||||
namespace Flatsome\Integrations;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Class Rank_Math
|
||||
*
|
||||
* @package Flatsome\Integrations
|
||||
*/
|
||||
class Rank_Math {
|
||||
|
||||
/**
|
||||
* Static instance
|
||||
*
|
||||
* @var Rank_Math $instance
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Rank_Math constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp', [ $this, 'integrate' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting based integration.
|
||||
*/
|
||||
public function integrate() {
|
||||
// Primary term.
|
||||
if ( get_theme_mod( 'rank_math_primary_term' ) ) {
|
||||
add_filter( 'flatsome_woocommerce_shop_loop_category', [ $this, 'get_primary_term' ], 10, 2 );
|
||||
}
|
||||
if ( get_theme_mod( 'rank_math_manages_product_layout_priority' ) ) {
|
||||
add_filter( 'flatsome_product_block_primary_term_id', [ $this, 'get_primary_term_id' ], 10, 2 );
|
||||
}
|
||||
// Breadcrumb.
|
||||
if ( get_theme_mod( 'rank_math_breadcrumb' ) ) {
|
||||
remove_action( 'flatsome_breadcrumb', 'woocommerce_breadcrumb', 20 );
|
||||
add_action( 'flatsome_breadcrumb', [ $this, 'rank_math_breadcrumb' ], 20 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve primary product term, set through Rank Math.
|
||||
*
|
||||
* @param string $term The original term string.
|
||||
* @param \WC_Product $product Product.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_primary_term( $term, $product ) {
|
||||
$primary_term = '';
|
||||
$primary_cat_id = get_post_meta( $product->get_Id(), 'rank_math_primary_category', true );
|
||||
|
||||
if ( $primary_cat_id ) {
|
||||
$product_cat = get_term( $primary_cat_id, 'product_cat' );
|
||||
$primary_term = $product_cat->name;
|
||||
}
|
||||
|
||||
if ( ! empty( $primary_term ) ) {
|
||||
return $primary_term;
|
||||
}
|
||||
|
||||
return $term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve primary product term ID, set through Rank Math.
|
||||
*
|
||||
* @param string $term The original term string.
|
||||
* @param \WC_Product $product Product.
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
public function get_primary_term_id( $term, $product ) {
|
||||
$primary_term_id = get_post_meta( $product->get_Id(), 'rank_math_primary_product_cat', true );
|
||||
|
||||
if ( ! empty( $primary_term_id ) ) {
|
||||
return $primary_term_id;
|
||||
}
|
||||
|
||||
return $term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rank Math breadcrumbs.
|
||||
*
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
* @param bool $display Whether to display the breadcrumb (true) or return it (false).
|
||||
*
|
||||
* @return string|void The breadcrumbs if $display set to false.
|
||||
*/
|
||||
public function rank_math_breadcrumb( $class = '', $display = true ) {
|
||||
if ( function_exists( 'rank_math_the_breadcrumbs' ) && function_exists( 'rank_math_get_breadcrumbs' ) ) {
|
||||
$args = array();
|
||||
$classes = is_array( $class ) ? $class : array_map( 'trim', explode( ' ', $class ) );
|
||||
$classes[] = 'rank-math-breadcrumb';
|
||||
$classes[] = 'breadcrumbs';
|
||||
$classes[] = get_theme_mod( 'breadcrumb_case', 'uppercase' );
|
||||
$classes = array_unique( array_filter( $classes ) );
|
||||
$classes = implode( ' ', $classes );
|
||||
|
||||
$args['wrap_before'] = '<nav class="' . esc_attr( $classes ) . '"><p>';
|
||||
|
||||
if ( ! $display ) {
|
||||
return rank_math_get_breadcrumbs( $args );
|
||||
}
|
||||
rank_math_the_breadcrumbs( $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the object and returns its instance.
|
||||
*
|
||||
* @return Rank_Math The object instance
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
|
||||
Rank_Math::get_instance();
|
||||
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Sensei plugin integration
|
||||
*/
|
||||
|
||||
/** @var $woothemes_sensei Sensei_Main */
|
||||
global $woothemes_sensei;
|
||||
|
||||
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
|
||||
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );
|
||||
remove_action( 'pre_get_posts', array( $woothemes_sensei->course, 'allow_course_archive_on_front_page' ), 9 );
|
||||
|
||||
add_action( 'sensei_before_main_content', 'fl_sensei_theme_wrapper_start', 10 );
|
||||
add_action( 'sensei_after_main_content', 'fl_sensei_theme_wrapper_end', 10 );
|
||||
|
||||
/**
|
||||
* Theme wrapper start for sensei.
|
||||
*/
|
||||
function fl_sensei_theme_wrapper_start() {
|
||||
echo '<div class="sensei-page page-wrapper"><div class="row"><div class="large-12 col">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Theme wrapper end for sensei.
|
||||
*/
|
||||
function fl_sensei_theme_wrapper_end() {
|
||||
echo '</div></div></div>';
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Ubermenu plugin integration
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adds a extra separate full width menu header bar with Ubermenu.
|
||||
* Renders: Main menu for desktop and mobile menu (if set) on tablet/mobile.
|
||||
*/
|
||||
function flatsome_uber_menu() {
|
||||
if ( ! get_theme_mod( 'flatsome_uber_menu', 1 ) ) {
|
||||
return;
|
||||
}
|
||||
$has_mobile_menu = has_nav_menu( 'primary_mobile' );
|
||||
$hide_for_medium = $has_mobile_menu ? 'hide-for-medium' : '';
|
||||
?>
|
||||
<div id="flatsome-uber-menu" class="header-ubermenu-nav relative <?php echo $hide_for_medium; ?>" style="z-index: 9">
|
||||
<div class="full-width">
|
||||
<?php ubermenu( 'main', array( 'theme_location' => 'primary' ) ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $has_mobile_menu ) : ?>
|
||||
<div id="flatsome-uber-menu" class="header-ubermenu-nav relative show-for-medium" style="z-index: 9">
|
||||
<div class="full-width">
|
||||
<?php ubermenu( 'main', array( 'theme_location' => 'primary_mobile' ) ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
add_action( 'flatsome_after_header_bottom', 'flatsome_uber_menu', 10 );
|
@@ -0,0 +1,14 @@
|
||||
.label-wrap{
|
||||
float:none!important;
|
||||
}
|
||||
|
||||
.label-wrap.wapl-alignleft{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.label-wrap.wapl-aligncenter{
|
||||
text-align: center;
|
||||
}
|
||||
.label-wrap.wapl-alignright{
|
||||
text-align: right;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
.book_start_date_label, .book_end_date_label{
|
||||
margin-top: 0!important;
|
||||
font-weight: bolder;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input.booking_calender + img{
|
||||
position: relative;
|
||||
top:-27px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.show_addon_price, .show_time_slot{
|
||||
font-weight: bolder;
|
||||
font-size: 120%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input.booking_calender{
|
||||
padding-left: 40px;
|
||||
margin-bottom: 0px;
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
WooCommerce Bulk Variations
|
||||
https://woocommerce.com/products/bulk-variation-forms/
|
||||
---------------------------------------------------*/
|
||||
#matrix_form {
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
#matrix_form_table th,
|
||||
#matrix_form_table td {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
#matrix_form_table tfoot tr td {
|
||||
padding: 15px 0 0 0;
|
||||
}
|
||||
|
||||
#matrix_form_table .button {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.rtl #matrix_form_table tfoot tr td {
|
||||
text-align: left;
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
jQuery('.composite_data').on('wc-composite-initializing', function (event, composite) {
|
||||
composite.actions.add_action('component_scripts_initialized', function () {
|
||||
jQuery('.quantity').addQty()
|
||||
}, 100)
|
||||
})
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Composite Products integration
|
||||
*
|
||||
* @author UX Themes
|
||||
* @package Flatsome/Integrations
|
||||
* @see https://woocommerce.com/products/composite-products/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Composite products integration script.
|
||||
*/
|
||||
function flatsome_wc_composite_products_integration() {
|
||||
global $integrations_uri;
|
||||
wp_enqueue_script( 'flatsome-composite-products', $integrations_uri . '/wc-composite-products/composite-products.js', array( 'jquery', 'flatsome-js' ), 1.2, true );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'flatsome_wc_composite_products_integration' );
|
||||
|
||||
/**
|
||||
* Disabled sticky add to cart on composite products type.
|
||||
*
|
||||
* @param bool $enabled Default enabled.
|
||||
* @param WC_Product $product The product object.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function flatsome_wc_composite_products_disable_sticky_add_to_cart( $enabled, $product ) {
|
||||
if ( $product->get_type() == 'composite' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $enabled;
|
||||
}
|
||||
|
||||
add_filter( 'flatsome_sticky_add_to_cart_enabled', 'flatsome_wc_composite_products_disable_sticky_add_to_cart', 10, 2 );
|
@@ -0,0 +1,22 @@
|
||||
.book_start_date_label, .book_end_date_label{
|
||||
margin-top: 0!important;
|
||||
font-weight: bolder;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input.booking_calender + img{
|
||||
position: relative;
|
||||
top:-27px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.show_addon_price, .show_time_slot{
|
||||
font-weight: bolder;
|
||||
font-size: 120%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input.booking_calender{
|
||||
padding-left: 40px;
|
||||
margin-bottom: 0px;
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
/* Improving styles for Extra Product Options Plugin
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
.tm-extra-product-options input,
|
||||
.tm-extra-product-options select,
|
||||
.tm-extra-product-options textarea{
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tm-extra-product-options .tmcp-textfield.tm-epo-field{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.tm-extra-product-options .tm-cell{
|
||||
margin: 0!important;
|
||||
padding: 0 0 .5em!important;
|
||||
}
|
||||
|
||||
.tm-extra-product-options .cpf-type-divider hr{
|
||||
margin: .5em 0;
|
||||
border-width: 2px;
|
||||
}
|
||||
.tm-extra-product-options .cpf-type-divider + .tm-cell{
|
||||
border:0;
|
||||
}
|
||||
.tmcp-date-select{
|
||||
padding-right: 20px;
|
||||
}
|
||||
.tm-extra-product-options ul.tmcp-elements li.tmcp-field-wrap{
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tm-extra-product-options .tmcp-field-wrap .price.amount{
|
||||
font-size: .8em!important;
|
||||
opacity: .6;
|
||||
}
|
||||
.tm-epo-totals{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tm-extra-product-options .tm-extra-product-options-field{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tm-extra-product-options .tmcp-field-wrap .amount, .tm-extra-product-options .tmcp-field-wrap .after-amount{
|
||||
margin: .6em 0 1em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
dt.tm-options-totals,
|
||||
dt.tm-final-totals{
|
||||
width: 58%;
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
dd.tm-options-totals,
|
||||
dd.tm-final-totals{
|
||||
width: 40%;
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
dt.tm-options-totals, dd.tm-options-totals{
|
||||
font-size: 80%;
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.rtl dd.tm-options-totals,
|
||||
.rtl dd.tm-final-totals{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tm-final-totals{
|
||||
border-top: 1px solid #eee;
|
||||
padding-top: .5em;
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
.product-image .button{
|
||||
position: absolute;
|
||||
left:50%;
|
||||
top:50%;
|
||||
transform: translate(-50%,-50%);
|
||||
font-size: 11px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.product-image:hover .button{
|
||||
opacity: 1;
|
||||
}
|
@@ -0,0 +1,215 @@
|
||||
td.wishlist-empty{
|
||||
text-align: center!important;
|
||||
padding: 50px;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.wishlist_table .add_to_cart{
|
||||
line-height: 1.3;
|
||||
padding: 7px 10px;
|
||||
}
|
||||
|
||||
/* Popup message */
|
||||
#yith-wcwl-popup-message{
|
||||
background: #fff;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 15px 0;
|
||||
font-size: 120%;
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(50%);
|
||||
width: 300px;
|
||||
z-index: 10000; /* Thanks WP -.- */
|
||||
}
|
||||
|
||||
.wishlist-icon{
|
||||
position: relative;
|
||||
}
|
||||
.wishlist-popup {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
padding: 5px;
|
||||
margin-top: -10px;
|
||||
border-radius: 5px;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
font-size: .9em;
|
||||
top:100%;
|
||||
background-color: rgba(0,0,0,.8);
|
||||
right:0;
|
||||
color:#FFF;
|
||||
transition: opacity .3s, max-height .3s;
|
||||
transition-delay: .3s;
|
||||
}
|
||||
|
||||
.wishlist-popup:after {
|
||||
bottom: 100%;
|
||||
right: 10px;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border-color: rgba(136, 183, 213, 0);
|
||||
border-bottom-color: rgba(0,0,0,.8);
|
||||
border-width: 10px;
|
||||
margin-left: -10px;
|
||||
}
|
||||
|
||||
.wishlist-icon:hover .wishlist-popup{
|
||||
opacity: 1;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.wishlist-popup a{
|
||||
color:#ccc;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.wishlist-popup a:hover{
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
.wishlist-icon.added:after{
|
||||
background-color:red;
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
.wishlist-popup .ajax-loading,
|
||||
.wishlist-popup .feedback{
|
||||
display: none!important;
|
||||
}
|
||||
|
||||
.wishlist-title {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#yith-wcwl-form .hidden-title-form,
|
||||
#yith-wcwl-form .hide-title-form i,
|
||||
.wishlist-title .button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.wishlist-title,
|
||||
.wishlist-empty,
|
||||
.yith_wcwl_wishlist_footer {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.share-icons-title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.wishlist_table.mobile {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .product-checkbox {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .item-wrapper {
|
||||
display: inline-block;
|
||||
width: calc(100% - 25px);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wishlist_table.wishlist_manage_table.mobile li .item-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .item-wrapper .product-thumbnail {
|
||||
display: inline-block;
|
||||
max-width: 60px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.rtl .wishlist_table.mobile li .item-wrapper .product-thumbnail {
|
||||
margin-right: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .item-wrapper .item-details {
|
||||
display: inline-block;
|
||||
width: calc(100% - 74px);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile.with-checkbox li .additional-info-wrapper {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.rtl .wishlist_table.mobile.with-checkbox li .additional-info-wrapper {
|
||||
padding-left: 0;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .additional-info-wrapper {
|
||||
border-bottom: 1px solid #ececec;
|
||||
width: calc(100% - 25px);
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li .additional-info-wrapper .product-add-to-cart,
|
||||
.wishlist_table.mobile li .additional-info-wrapper .move-to-another-wishlist {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .button.add_to_cart_button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile td {
|
||||
border-bottom: none;
|
||||
padding: 3px 0;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile li[id^="yith-wcwl-row-"] {
|
||||
position: relative;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: -12px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
line-height: 18px;
|
||||
font-size: 18px;
|
||||
border-radius: 100%;
|
||||
color: #ccc;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
border: 2px solid currentColor;
|
||||
}
|
||||
|
||||
.rtl .wishlist_table.mobile .product-remove {
|
||||
left: unset;
|
||||
right: -12px;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove a {
|
||||
position: unset;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove a i {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.wishlist_table.mobile .product-remove a:after {
|
||||
content: '×';
|
||||
color: #ccc;
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
Flatsome.behavior('wishlist', {
|
||||
attach: function (context) {
|
||||
jQuery('.wishlist-button', context).each(function (index, element) {
|
||||
'use strict'
|
||||
|
||||
jQuery(element).on('click', function (e) {
|
||||
var $this = jQuery(this)
|
||||
// Browse wishlist
|
||||
if ($this.parent().find('.yith-wcwl-wishlistexistsbrowse, .yith-wcwl-wishlistaddedbrowse').length) {
|
||||
window.location.href = $this.parent().find('.yith-wcwl-wishlistexistsbrowse a, .yith-wcwl-wishlistaddedbrowse a').attr('href')
|
||||
return
|
||||
}
|
||||
$this.addClass('loading')
|
||||
// Delete or add item (only one of both is present).
|
||||
$this.parent().find('.delete_item').click()
|
||||
$this.parent().find('.add_to_wishlist').click()
|
||||
|
||||
e.preventDefault()
|
||||
})
|
||||
})
|
||||
|
||||
markAdded()
|
||||
}
|
||||
})
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
var flatsomeAddToWishlist = function () {
|
||||
jQuery('.wishlist-button').removeClass('loading')
|
||||
markAdded()
|
||||
|
||||
jQuery.ajax({
|
||||
beforeSend: function () {
|
||||
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
},
|
||||
data: {
|
||||
action: 'flatsome_update_wishlist_count',
|
||||
},
|
||||
success: function (data) {
|
||||
var $icon = jQuery('i.wishlist-icon')
|
||||
$icon.addClass('added')
|
||||
if (data == 0) {
|
||||
$icon.removeAttr('data-icon-label')
|
||||
}
|
||||
else if (data == 1) {
|
||||
$icon.attr('data-icon-label', '1')
|
||||
}
|
||||
else {
|
||||
$icon.attr('data-icon-label', data)
|
||||
}
|
||||
setTimeout(function () {
|
||||
$icon.removeClass('added')
|
||||
}, 500)
|
||||
},
|
||||
|
||||
url: yith_wcwl_l10n.ajax_url,
|
||||
})
|
||||
}
|
||||
|
||||
jQuery('body').on('added_to_wishlist removed_from_wishlist', flatsomeAddToWishlist)
|
||||
})
|
||||
|
||||
function markAdded () {
|
||||
jQuery('.wishlist-icon').each(function () {
|
||||
var $this = jQuery(this)
|
||||
if ($this.find('.yith-wcwl-wishlistexistsbrowse, .yith-wcwl-wishlistaddedbrowse').length) {
|
||||
$this.find('.wishlist-button').addClass('wishlist-added')
|
||||
}
|
||||
})
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* YITH wishlist integration
|
||||
*
|
||||
* @author UX Themes
|
||||
* @package Flatsome/Integrations
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'flatsome_wishlist_integrations_scripts' ) ) {
|
||||
/**
|
||||
* Enqueues wishlist integrations scripts
|
||||
*/
|
||||
function flatsome_wishlist_integrations_scripts() {
|
||||
global $integrations_uri;
|
||||
|
||||
wp_dequeue_style( 'yith-wcwl-main' );
|
||||
wp_deregister_style( 'yith-wcwl-main' );
|
||||
wp_dequeue_style( 'yith-wcwl-font-awesome' );
|
||||
wp_deregister_style( 'yith-wcwl-font-awesome' );
|
||||
|
||||
// TODO 4.0 Move and apply on AJAX search plugin.
|
||||
wp_dequeue_style( 'yith_wcas_frontend' );
|
||||
wp_deregister_style( 'yith_wcas_frontend' );
|
||||
|
||||
wp_enqueue_script( 'flatsome-woocommerce-wishlist', $integrations_uri . '/wc-yith-wishlist/wishlist.js', array( 'jquery', 'flatsome-js' ), '3.10.2', true );
|
||||
wp_enqueue_style( 'flatsome-woocommerce-wishlist', $integrations_uri . '/wc-yith-wishlist/wishlist.css', 'flatsome-woocommerce-style', '3.10.2' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'flatsome_wishlist_integrations_scripts' );
|
||||
|
||||
if ( ! function_exists( 'flatsome_wishlist_account_item' ) ) {
|
||||
/**
|
||||
* Add wishlist button to my account dropdown
|
||||
*/
|
||||
function flatsome_wishlist_account_item() {
|
||||
$page_id = get_option( 'yith_wcwl_wishlist_page_id' );
|
||||
if ( ! $page_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wishlist_page = yith_wcwl_object_id( $page_id );
|
||||
?>
|
||||
<li class="wishlist-account-element <?php if ( is_page( $wishlist_page ) ) echo 'active'; ?>">
|
||||
<a href="<?php echo YITH_WCWL()->get_wishlist_url(); ?>"><?php echo get_the_title( $wishlist_page ); ?></a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_account_links', 'flatsome_wishlist_account_item' );
|
||||
|
||||
|
||||
if ( ! function_exists( 'flatsome_product_wishlist_button' ) ) {
|
||||
/**
|
||||
* Add wishlist Button to Product Image
|
||||
*/
|
||||
function flatsome_product_wishlist_button() {
|
||||
$icon = get_theme_mod( 'wishlist_icon', 'heart' );
|
||||
if ( ! $icon ) $icon = 'heart';
|
||||
?>
|
||||
<div class="wishlist-icon">
|
||||
<button class="wishlist-button button is-outline circle icon" aria-label="<?php echo __( 'Wishlist', 'flatsome' ); ?>">
|
||||
<?php echo get_flatsome_icon( 'icon-' . $icon ); ?>
|
||||
</button>
|
||||
<div class="wishlist-popup dark">
|
||||
<?php echo do_shortcode( '[yith_wcwl_add_to_wishlist]' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'flatsome_product_image_tools_top', 'flatsome_product_wishlist_button', 2 );
|
||||
add_action( 'flatsome_product_box_tools_top', 'flatsome_product_wishlist_button', 2 );
|
||||
|
||||
if ( ! function_exists( 'flatsome_header_wishlist' ) ) {
|
||||
/**
|
||||
* Header Wishlist element
|
||||
*
|
||||
* @param $elements
|
||||
* @return mixed
|
||||
*/
|
||||
function flatsome_header_wishlist( $elements ) {
|
||||
$elements['wishlist'] = __( 'Wishlist', 'flatsome' );
|
||||
|
||||
return $elements;
|
||||
}
|
||||
}
|
||||
add_filter( 'flatsome_header_element', 'flatsome_header_wishlist' );
|
||||
|
||||
if ( ! function_exists( 'flatsome_update_wishlist_count' ) ) {
|
||||
/**
|
||||
* Update Wishlist Count
|
||||
*/
|
||||
function flatsome_update_wishlist_count() {
|
||||
wp_send_json( YITH_WCWL()->count_products() );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_ajax_flatsome_update_wishlist_count', 'flatsome_update_wishlist_count' );
|
||||
add_action( 'wp_ajax_nopriv_flatsome_update_wishlist_count', 'flatsome_update_wishlist_count' );
|
@@ -0,0 +1,10 @@
|
||||
Flatsome.behavior('wp-rocket-lazy-load-packery', {
|
||||
attach: function (context) {
|
||||
jQuery('.has-packery .lazy-load', context).waypoint(function (direction) {
|
||||
var $element = jQuery(this.element);
|
||||
$element.imagesLoaded( function() {
|
||||
jQuery('.has-packery').packery('layout');
|
||||
});
|
||||
}, { offset: '90%' });
|
||||
}
|
||||
});
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
function flatsome_wp_rocket_integration() {
|
||||
global $integrations_uri;
|
||||
|
||||
if(get_rocket_option( 'lazyload' )){
|
||||
wp_enqueue_script( 'flatsome-wp-rocket', $integrations_uri.'/wp-rocket/flatsome-wp-rocket.js', array('flatsome-js'), 3.0, true);
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'flatsome_wp_rocket_integration' );
|
||||
|
||||
/**
|
||||
* JS files to be included in the footer during the minification process.
|
||||
*/
|
||||
function flatsome_wp_rocket_minify_js_in_footer( $scripts ) {
|
||||
$uri = get_template_directory_uri();
|
||||
if ( wp_script_is( 'flatsome-countdown-theme-js' ) ) {
|
||||
$scripts[] = $uri . '/inc/shortcodes/ux_countdown/ux-countdown.js';
|
||||
}
|
||||
if ( wp_script_is( 'flatsome-lazy' ) ) {
|
||||
$scripts[] = $uri . '/inc/extensions/flatsome-lazy-load/flatsome-lazy-load.js';
|
||||
}
|
||||
if ( wp_script_is( 'flatsome-wp-rocket' ) ) {
|
||||
$scripts[] = $uri . '/inc/integrations/wp-rocket/flatsome-wp-rocket.js';
|
||||
}
|
||||
if ( wp_script_is( 'flatsome-isotope-js' ) ) {
|
||||
$scripts[] = $uri . '/assets/libs/isotope.pkgd.min.js';
|
||||
}
|
||||
return $scripts;
|
||||
}
|
||||
add_filter( 'rocket_minify_js_in_footer', 'flatsome_wp_rocket_minify_js_in_footer' );
|
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
/**
|
||||
* WP SEO integration
|
||||
*
|
||||
* @author UX Themes
|
||||
* @package Flatsome\Integrations
|
||||
* @since 3.7.0
|
||||
*/
|
||||
|
||||
namespace Flatsome\Integrations;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Class WP_Seo
|
||||
*
|
||||
* @package Flatsome\Integrations
|
||||
*/
|
||||
class WP_Seo {
|
||||
|
||||
/**
|
||||
* Static instance
|
||||
*
|
||||
* @var WP_Seo $instance
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* WP_Seo constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp', [ $this, 'integrate' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting based integration.
|
||||
*/
|
||||
public function integrate() {
|
||||
// Primary term.
|
||||
if ( get_theme_mod( 'wpseo_primary_term' ) ) {
|
||||
add_filter( 'flatsome_woocommerce_shop_loop_category', [ $this, 'get_primary_term' ], 10, 2 );
|
||||
}
|
||||
if ( get_theme_mod( 'wpseo_manages_product_layout_priority' ) ) {
|
||||
add_filter( 'flatsome_product_block_primary_term_id', [ $this, 'get_primary_term_id' ], 10, 2 );
|
||||
}
|
||||
// Breadcrumb.
|
||||
if ( get_theme_mod( 'wpseo_breadcrumb' ) ) {
|
||||
remove_action( 'flatsome_breadcrumb', 'woocommerce_breadcrumb', 20 );
|
||||
add_action( 'flatsome_breadcrumb', [ $this, 'yoast_breadcrumb' ], 20, 2 );
|
||||
|
||||
// Manipulate last crumb.
|
||||
if ( is_woocommerce_activated() && get_theme_mod( 'wpseo_breadcrumb_remove_last', 1 ) && apply_filters( 'flatsome_wpseo_breadcrumb_remove_last', is_product() ) ) {
|
||||
add_filter( 'wpseo_breadcrumb_links', [ $this, 'remove_last_crumb' ] );
|
||||
add_filter( 'wpseo_breadcrumb_single_link', [ $this, 'add_link_to_last_crumb' ], 10, 2 );
|
||||
}
|
||||
|
||||
add_filter( 'wpseo_breadcrumb_separator', [ $this, 'wrap_crumb_separator' ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve primary product term, set through YOAST.
|
||||
*
|
||||
* @param string $term The original term string.
|
||||
* @param \WC_Product $product Product.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_primary_term( $term, $product ) {
|
||||
if ( function_exists( 'yoast_get_primary_term' ) ) {
|
||||
$primary_term = yoast_get_primary_term( 'product_cat', $product->get_Id() );
|
||||
}
|
||||
if ( ! empty( $primary_term ) ) {
|
||||
return $primary_term;
|
||||
}
|
||||
|
||||
return $term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve primary product term ID, set through YOAST.
|
||||
*
|
||||
* @param string $term The original term string.
|
||||
* @param \WC_Product $product Product.
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
public function get_primary_term_id( $term, $product ) {
|
||||
if ( function_exists( 'yoast_get_primary_term_id' ) ) {
|
||||
$primary_term_id = yoast_get_primary_term_id( 'product_cat', $product->get_Id() );
|
||||
}
|
||||
|
||||
if ( ! empty( $primary_term_id ) ) {
|
||||
return $primary_term_id;
|
||||
}
|
||||
|
||||
return $term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yoast breadcrumbs.
|
||||
*
|
||||
* @param string|array $class One or more classes to add to the class list.
|
||||
* @param bool $display Whether to display the breadcrumb (true) or return it (false).
|
||||
*/
|
||||
public function yoast_breadcrumb( $class = '', $display = true ) {
|
||||
if ( function_exists( 'yoast_breadcrumb' ) ) {
|
||||
$classes = is_array( $class ) ? $class : array_map( 'trim', explode( ' ', $class ) );
|
||||
$classes[] = 'yoast-breadcrumb';
|
||||
$classes[] = 'breadcrumbs';
|
||||
$classes[] = get_theme_mod( 'breadcrumb_case', 'uppercase' );
|
||||
$classes = array_unique( array_filter( $classes ) );
|
||||
$classes = implode( ' ', $classes );
|
||||
|
||||
yoast_breadcrumb( '<nav id="breadcrumbs" class="' . esc_attr( $classes ) . '">', '</nav>', $display );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes last crumb in the crumbs array.
|
||||
*
|
||||
* @param array $crumbs The crumbs array.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function remove_last_crumb( $crumbs ) {
|
||||
if ( count( $crumbs ) > 1 ) {
|
||||
array_pop( $crumbs );
|
||||
}
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a link to last crumb, use in conjunction with remove_last_crumb()
|
||||
*
|
||||
* @param string $output The output string.
|
||||
* @param array $crumb The link array.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function add_link_to_last_crumb( $output, $crumb ) {
|
||||
$output = '<a property="v:title" rel="v:url" href="' . $crumb['url'] . '" >';
|
||||
$output .= $crumb['text'];
|
||||
$output .= '</a>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap breadcrumb separator.
|
||||
*
|
||||
* @param string $separator Breadcrumbs separator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function wrap_crumb_separator( $separator ) {
|
||||
return '<span class="divider">' . $separator . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the object and returns its instance.
|
||||
*
|
||||
* @return WP_Seo The object instance
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
|
||||
WP_Seo::get_instance();
|
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* Copy polylang content to new languages */
|
||||
if (function_exists('pll_get_post')){ // is Polylang activated?
|
||||
add_filter('default_content','ux_copy_post_translation', 100, 2);
|
||||
add_filter('default_title','ux_copy_post_translation', 100, 2);
|
||||
function ux_copy_post_translation($content, $post){
|
||||
$from_post = isset($_GET['from_post'])? (int)$_GET['from_post'] : false;
|
||||
if($content == ''){
|
||||
$from_post = get_post($from_post);
|
||||
if($from_post)
|
||||
switch(current_filter()){
|
||||
case 'default_content':
|
||||
$content = $from_post->post_content;
|
||||
break;
|
||||
case 'default_title':
|
||||
$content = $from_post->post_title;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user