Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
farookibrahim / functions.php
Created July 3, 2020 05:30
Vodi - Videos Control Bar Tags Filter
if ( ! function_exists( 'vodi_videos_control_bar_tag_filter' ) ) {
/**
* Display top control bar tag filter
*/
function vodi_videos_control_bar_tag_filter() {
$instance = apply_filters( 'vodi_videos_control_bar_tag_filter_instance', array(
'title' => '',
'limit' => 2,
'slugs' => '',
'query_type' => 'and',
@farookibrahim
farookibrahim / functions.php
Created June 30, 2020 07:39
Vodi - Video v1 add custom content before & after sidebar
if ( ! function_exists( 'vodi_child_single_video_custom_sidebar_before_content' ) ) {
function vodi_child_single_video_custom_sidebar_before_content() {
?>
Your custom before content
<?php
}
}
if ( ! function_exists( 'vodi_child_single_video_custom_sidebar_after_content' ) ) {
function vodi_child_single_video_custom_sidebar_after_content() {
@farookibrahim
farookibrahim / functions.php
Created June 26, 2020 11:25
Front - WeDocs Customize Search Form
if ( ! function_exists( 'front_wedocs_docs_search_form' ) ) :
function front_wedocs_docs_search_form() {
?>
<div class="gradient-half-primary-v1">
<div class="bg-img-hero-center" style="background-image: url( <?php echo esc_attr( get_template_directory_uri() ); ?>/assets/svg/components/bg-elements-10.svg );">
<div class="container space-1">
<div class="w-lg-80 mx-lg-auto">
<!-- Input -->
<form role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>" class="wedocs-search-form input-group input-group-borderless">
@farookibrahim
farookibrahim / functions.php
Created June 24, 2020 14:01
Cartzilla - Load custom header for blog pages only
if( ! function_exists( 'cz_child_blog_header_static_content_id' ) ) {
function cz_child_blog_header_static_content_id( $static_content_id ) {
if ( is_home() || ( 'post' == get_post_type() && ( is_category() || is_tag() || is_author() || is_date() || is_year() || is_month() || is_time() ) ) ) {
$static_content_id = 100;
}
return $static_content_id;
}
}
add_filter( 'cartzilla_header_static_content_id', 'cz_child_blog_header_static_content_id', 99 );
@farookibrahim
farookibrahim / functions.php
Created June 24, 2020 08:15
Cartzilla - Single Product Custom "Last update" Date
if( ! function_exists( 'cartzilla_wc_product_modified_date' ) ) {
function cartzilla_wc_product_modified_date() {
global $product;
$updated_date = get_post_meta( $product->get_id(), 'updated_date', true );
?>
<li class="d-flex justify-content-between mb-3 pb-3 border-bottom">
<span class="text-dark font-weight-medium"><?php echo esc_html('Last update', 'cartzilla'); ?></span>
<span class="text-muted"><?php echo date( 'F j, Y', strtotime( $updated_date ) ); ?></span>
</li><?php
}
@farookibrahim
farookibrahim / functions.php
Created June 24, 2020 05:25
Vodi - Customize Shortcode Atts Orderby Options
if( ! function_exists( 'vodi_child_block_editor_assets_shortcode_atts_orderby_options' ) ) {
function vodi_child_block_editor_assets_shortcode_atts_orderby_options() {
$custom_script = '
var addFilter = wp.hooks.addFilter;
addFilter("vodi.component.shortcodeAtts.orderby.options", "vodi-child/shortcode-atts-orderby-options", vodiChildShortCodeOrderbyOptions);
function vodiChildShortCodeOrderbyOptions(options,props) {
const { postType } = props;
return [
{ label: "Title", value: "title" },
@farookibrahim
farookibrahim / functions.php
Created June 23, 2020 16:20
Cartzilla - Marketplace shop archive display sale badge
if ( ! function_exists( 'cartzilla_toggle_shop_loop_v2_hooks' ) ) {
function cartzilla_toggle_shop_loop_v2_hooks() {
if ( 'style-v2' === cartzilla_get_shop_page_style() ) {
add_action( 'woocommerce_before_shop_loop_item', 'cartzilla_wc_loop_product_sale_flash', 25 );
}
}
}
add_action( 'woocommerce_before_shop_loop', 'cartzilla_toggle_shop_loop_v2_hooks', 10 );
@farookibrahim
farookibrahim / functions.php
Created June 23, 2020 16:18
Cartzilla - Display Free Downloads WooCommerce plugin downloads count instead of sales count
if( ! function_exists( 'cartzilla_mp_loop_product_sold_count' ) ) {
function cartzilla_mp_loop_product_sold_count() {
global $product;
$product_id = $product->get_id();
$download_count = get_post_meta( $product_id, 'somdn_dlcount', true ) ? intval( get_post_meta( $product_id, 'somdn_dlcount', true ) ) : 0 ;
if ( $download_count > 0 ) {
?>
<div class="font-size-sm mr-2">
<?php echo apply_filters( 'cartzilla_sold_count_icon_icon', '<i class="czi-download text-muted mr-1"></i>' ); ?>
<span class="font-size-xs"><?php echo esc_html( sprintf( _nx( '%s Download', '%s Downloads', $download_count, 'front-end', 'cartzilla' ), $download_count ) ); ?></span>
@farookibrahim
farookibrahim / functions.php
Created June 23, 2020 14:24
Cartzilla - Change Shop Page Sorting Dropdown Text
if ( ! function_exists( 'cartzilla_wc_catalog_orderby' ) ) {
function cartzilla_wc_catalog_orderby( $options ) {
$options = array(
'popularity' => esc_html__( 'Popularity', 'cartzilla' ),
'price' => esc_html__( 'Low - Hight Price', 'cartzilla' ),
'price-desc' => esc_html__( 'High - Low Price', 'cartzilla' ),
'rating' => esc_html__( 'Average Rating', 'cartzilla' ),
'title-asc' => esc_html__( 'A - Z Order', 'cartzilla' ),
'title-desc' => esc_html__( 'Z - A Order', 'cartzilla' ),
@farookibrahim
farookibrahim / functions.php
Last active July 6, 2020 10:49
Vodi - Movies Year Filter force 1st page after filter
if( ! function_exists( 'vodi_child_movies_year_filter_link' ) ) {
function vodi_child_movies_year_filter_link( $link ) {
$pattern = '/page\\/[0-9]+\\//i';
$link = preg_replace( $pattern, '', $link );
return $link;
}
}
add_filter( 'masvideos_movies_year_filter_link', 'vodi_child_movies_year_filter_link', 20 );