Skip to content

Instantly share code, notes, and snippets.

@akther80
akther80 / functions.php
Created May 2, 2023 05:18
Cartzilla - Hide vendor info in single store page
if ( ! function_exists( 'cartzilla_dokan_store_page_aside_contact_info' ) ) {
function cartzilla_dokan_store_page_aside_contact_info( $store_user, $store_info ) {
$vendor_name = $store_user->data->display_name;
$store_address = apply_filters( 'cartzilla_dokan_store_page_display_store_address', true ) ? dokan_get_seller_address( $store_user->ID, false ) : false;
$show_store_email = $store_info['show_email'] === 'yes' ? true : false;
$store_email = $show_store_email && $store_user && $store_user->data && $store_user->data->user_email ? $store_user->data->user_email : false;
$store_website = $store_user->data->user_url;
$store_phone = $store_info['phone'];
$social_fields = dokan_get_social_profile_fields();
@akther80
akther80 / functions.php
Created April 20, 2023 10:13
MyTravel - display card
add_action( 'mytravel_car_rental_after_shop_loop_item', 'mytravel_child_single_car_rental_amenities', 5 );
add_filter( 'init', 'mytravel_remove_car_rental_footer_wrapper' );
function mytravel_remove_car_rental_footer_wrapper() {
remove_action( 'mytravel_car_rental_after_shop_loop_item', 'mytravel_car_rental_footer_wrapper', 5 );
}
if ( ! function_exists( 'mytravel_child_single_car_rental_amenities' ) ) {
/**
* Output single hotel amenities
@akther80
akther80 / functions.php
Created April 14, 2023 06:53
Cartzilla - Change Dokan vendor products column
if ( ! function_exists( 'cartzilla_dokan_vendor_page_columns' ) ) {
function cartzilla_dokan_vendor_page_columns( $columns ) {
$layout = get_theme_mod( 'store_layout', 'left' );
if ( 'left' === $layout || 'right' === $layout ) {
$columns = 2;
} else {
$columns = 3;
}
return $columns;
@akther80
akther80 / functions.php
Last active April 7, 2023 10:33
MyTravel - Display Tour Snapshots in Archive List view
if ( ! function_exists( 'mytravel_loop_tour_info' ) ) {
/**
* Output of tour info
*/
function mytravel_loop_tour_info() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$days = mytravel_get_field( 'days' );
@akther80
akther80 / content-tour-list-view.php
Last active April 7, 2023 10:32
MyTravel - Tour List View
<?php
/**
* List view of Tour
*/
defined( 'ABSPATH' ) || exit;
global $product;
// Ensure visibility.
@akther80
akther80 / functions.php
Created April 7, 2023 05:30
MyTravel - Change H5 as H2 in tour subtitles
if ( ! function_exists( 'mytravel_single_tour_itinerary' ) ) {
/**
* Output of single tour itinerary
*/
function mytravel_single_tour_itinerary() {
if ( ! mytravel_is_acf_activated() ) {
return;
}
$tour_itinerary = mytravel_get_field( 'itinerary_places' );
@akther80
akther80 / archive-product.php
Created April 6, 2023 06:58
MyTravel - List view as Default
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@akther80
akther80 / functions.php
Created April 6, 2023 06:56
MyTravel - Make list view ad default
if ( ! function_exists( 'mytravel_shop_view_switcher' ) ) {
/**
* Archive view switcher
*/
function mytravel_shop_view_switcher() {
?>
<ul class="nav tab-nav-shop flex-nowrap mt-4 mt-md-0" id="pills-tab" role="tablist">
<li class="nav-item">
<a class="nav-link font-size-22 p-0 active" id="list-view-tab" data-toggle="pill" href="#list-view" role="tab" aria-controls="list-view" aria-selected="true">
<div class="d-md-flex justify-content-md-center align-items-md-center">
@akther80
akther80 / functions.php
Created April 6, 2023 06:46
Cartzilla - Add user profile in Handheld toolbar
add_action( 'cartzilla_handheld_toolbar', 'cartzilla_wc_handheld_toolbar_user_profile', 60 );
function cartzilla_wc_handheld_toolbar_user_profile() {
if ( cartzilla_navbar_is_account() ) :
?>
<a href="<?php echo get_permalink( wc_get_page_id( 'myaccount' ) ); ?>" class="d-table-cell cz-handheld-toolbar-item">
<span class="cz-handheld-toolbar-icon">
<?php echo get_avatar( wp_get_current_user(), 30, '', '', [ 'class' => 'rounded-circle' ] ); ?>
</span>
<span class="cz-handheld-toolbar-label"><?php echo esc_html_x( 'My Account', 'front-end', 'cartzilla' ); ?></span>
@akther80
akther80 / functions.php
Last active April 5, 2023 10:43
MyTravel - Iternary style
if ( ! function_exists( 'mytravel_tour_tabs' ) ) {
/**
* Output of tour tabs
*/
function mytravel_tour_tabs() {
$tour_tabs = apply_filters( 'mytravel_tour_tabs', array() );
?>
<div id="stickyBlockStartPointTabs" class="mb-4">
<div class="border rounded-pill rounded js-sticky-block p-1 border-width-2 z-index-4 bg-white"