Skip to content

Instantly share code, notes, and snippets.

View softiconic's full-sized avatar

Softiconic softiconic

View GitHub Profile
@softiconic
softiconic / custom.js
Last active December 2, 2023 18:57
JavaScript for activating tabs.
$(function() {
var $a = $(".tabs li");
$a.click(function() {
$a.removeClass("active");
$(this).addClass("active");
});
});
@softiconic
softiconic / function.php
Last active December 2, 2023 18:57
Remove the company name field from the WooCommerce checkout page.
//remove company name
add_filter( 'woocommerce_checkout_fields' , 'remove_company_name' );
function remove_company_name( $fields ) {
unset($fields['billing']['billing_company']);
return $fields;
}
@softiconic
softiconic / gist:07a3cc4b12a815bbe9c47e7f3b6f42eb
Last active December 2, 2023 18:56
Defer the JavaScript execution in the function file.
//defer js
function defer_parsing_of_js($url)
{
if (is_admin()) return $url;
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
if (strpos($url, ' js-mini.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
@softiconic
softiconic / HTML file
Created May 5, 2020 09:34
Only text Slider
<h1 id="changingtext">We Are <span>Digital </span>Marketing.</h1>
@softiconic
softiconic / CSS file
Last active December 2, 2023 18:56
Social icon with a fixed position on both desktop and mobile devices.
.scfloatPC {
right: 0;
position: fixed;
top: 50%;
transform: translateY(-50%);
z-index: 999;
text-align: center;
}
.scfloatPC a {
display: block;
@softiconic
softiconic / Shopify Footer Link list title
Last active December 2, 2023 18:56
Title for a list of links in the footer on a Shopify website.
@softiconic
softiconic / choose-lang.php
Last active December 2, 2023 18:55
The default language functionality is not functioning as expected with the Polylang plugin.
replace (comment) this line in wp-content/plugins/polylang/frontend/choose-lang.php file (line 185)
$language = $this->options['hide_default'] && ( ( isset( $_SERVER['HTTP_REFERER'] ) && in_array( parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ), $this->links_model->get_hosts() ) ) || ! $this->options['browser'] ) ?
$this->model->get_language( $this->options['default_lang'] ) :
$this->get_preferred_language(); // sets the language according to browser preference or default language
by
$language = 'fa';
protected function home_language() {
@softiconic
softiconic / Script.js
Last active December 2, 2023 18:55
Create a slider of a specific type.
<script>
var text = [ 'Direct Impact <span>Marketing</span>','<tt>   </tt>Drive <span>Buyer</span> Traffic','Grass Roots<span> Advertising</span>','Advertising <span> That</span> Works'];
var counter = 0;
var elem =document.getElementById('changingtext');
var f = setInterval(change, 1000);
function change() {
elem.innerHTML = text[counter];
counter++;
if (counter >= text.length) {
@softiconic
softiconic / style.css
Created July 13, 2020 17:25
Placeholder text on click hide
textarea::-webkit-input-placeholder, input::-webkit-input-placeholder {
color: #fff;
opacity: 1;
transition: opacity 0.5s;
-webkit-transition: opacity 0.5s;
}
textarea:focus::-webkit-input-placeholder, input:focus::-webkit-input-placeholder {
opacity: 0;
}
@softiconic
softiconic / WP Multiplelanguage Plugin
Created July 23, 2020 12:36
WP Best Multiple Language Plugin
Polylang
Polylang Connect for Elementor