Skip to content

Instantly share code, notes, and snippets.

View hakikz's full-sized avatar
💭
Github stars make me happy than $ and inspire me to do more for web community :)

Hakik Zaman hakikz

💭
Github stars make me happy than $ and inspire me to do more for web community :)
View GitHub Profile
@hakikz
hakikz / dashboard_menu_rename.php
Last active July 23, 2019 11:11
WordPress Tweaks
<?php
function rename_header_to_logo( $translated, $original, $domain ) {
$strings = array(
'Electro' => 'Ecommerce Theme', // 'The Existing Name' => 'Desired Name'
'Custom Header' => 'Custom Ecommerce Theme'
);
if ( isset( $strings[$original] ) && is_admin() ) {
$translations = &get_translations_for_domain( $domain );
@hakikz
hakikz / Remove_P_tag_From_Contact7_plugin.txt
Last active December 23, 2018 06:53
Remove P tag from WordPress Contact 7 form plugin
## First go to wp-config.php and just paste the line below
define( 'WPCF7_AUTOP', false ); //Sometimes this block of code will not work on live server then please try the second
## If the first one is not working then please go to your theme folder and paste the line in functions.php
add_filter('wpcf7_autop_or_not', '__return_false');
@hakikz
hakikz / onClick_To_Top.js
Last active July 29, 2021 16:53
Smooth Scroll
$('#return-to-top').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});
@hakikz
hakikz / BSCarouselForWP.php
Created March 23, 2021 19:21
BS Carousel For WP with ACF
<!-- Carousel -->
<div id="carouselHero" class="carousel slide carousel-fade" data-ride="carousel" data-pause="false">
<?php if( have_rows('carousel') ): $id = 0 ?>
<div class="carousel-inner">
<?php while( have_rows('carousel') ): the_row(); $id++ ?>
<div class="carousel-item <?php if($id == 1): echo "active"; endif; ?>">
<div class="content-wrap">
<?php
$logo = get_sub_field('logo');
$title = get_sub_field('title');
<?php
function wvs_noo_mebla_theme_support() {
remove_action( 'woocommerce_after_shop_loop_item', 'wvs_pro_archive_variation_template', 30 );
add_action( 'woocommerce_after_shop_loop_item_title2', 'wvs_pro_archive_variation_template', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', 'wvs_pro_archive_variation_template', 10 );
add_action( 'woocommerce_after_shop_loop_item_title2', 'woocommerce_template_loop_add_to_cart', 11 );
// remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
}
<?php
echo apply_filters(
'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.
sprintf(
'<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s" %s>%s</a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ),
esc_attr( $product->get_id() ),
esc_attr( $product->get_sku() ),
esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ),
@hakikz
hakikz / add_to_cart_align.css
Last active May 1, 2021 02:32
Porto Theme [Link on Image Template] Swatch Position Support
ul.products li.product-awq_onimage .add-links {
right: 0 !important;
}
ed.addButton('button_green', {
title: 'Add span',
image: '../wp-includes/images/smilies/icon_mrgreen.gif',
cmd: 'button_green_cmd'
});
ed.addCommand('button_green_cmd', function () {
var data = {
title: 'Default Title',
limit: 10
}
@hakikz
hakikz / wvg-thumbnail-serial.php
Last active December 28, 2021 11:41
Serialize Gallery Thumbnail for Additional Variation Images Gallery for WooCommerce
if ( class_exists( 'Woo_Variation_Gallery' ) ):
function wvg_serialize_support(){
$columns = absint( get_option( 'woo_variation_gallery_thumbnails_columns', apply_filters( 'woo_variation_gallery_default_thumbnails_columns', 4 ) ) );
$thumbnail_js_options = array(
'slidesToShow' => $columns,
'slidesToScroll' => $columns,
'focusOnSelect' => true,
// 'dots'=>true,
'arrows' => wc_string_to_bool( get_option( 'woo_variation_gallery_thumbnail_arrow', 'yes' ) ),
@hakikz
hakikz / .htaccess
Created January 2, 2022 07:41
Protect file from direct access but get it using API call
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(zip|php)$ - [F]