Skip to content

Instantly share code, notes, and snippets.

View JasvinderSingh1's full-sized avatar
🤘

Jasvinder Singh JasvinderSingh1

🤘
  • Lucknow, India
View GitHub Profile
@JasvinderSingh1
JasvinderSingh1 / wordpress.txt
Last active February 21, 2021 18:37
WORDPRESS CODES
// reference for Wordpress Functions
https://codex.wordpress.org/Function_Reference
https://developer.wordpress.org/
/***********************/
Display terms with pagination start
if ( get_query_var( 'paged' ) )
$paged = get_query_var('paged');
@JasvinderSingh1
JasvinderSingh1 / CodeIgniter
Last active September 25, 2020 13:09
CodeIgniter Tips & Tricks
// .htaccess in codeigniter to remove index.php
Replace the below code in config.php file.
$config['index_page'] = "index.php"
// Remove index.php
$config['index_page'] = ""
create .htaccess file.
<script>
jQuery(document).ready(function(){
jQuery(document).on("click",".openpopup",function(){
jQuery(".popmain").show();
});
jQuery(document).on("click",".closepopup",function(){
jQuery(".popmain").hide();
});
});
//compare a date with current date
$end_date = 2018-06-24
if((time()-(60*60*24)) < strtotime($end_date))
//simple curl
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "http://www.example.com/yourscript.php",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
@JasvinderSingh1
JasvinderSingh1 / WordPress Plugins
Last active July 11, 2018 08:16
WordPress Useful Plugins
https://wordpress.org/plugins/nav-menu-roles/ Nav Menu Roles By Kathy Darling
https://wordpress.org/plugins/woocommerce-products-filter/ For product filter
/**
* To make archive listing yearly instead of monthly
*/
function my_limit_archives( $args ) {
$args['type'] = 'yearly';
return $args;
}
add_filter( 'widget_archives_args', 'my_limit_archives' );
add_filter( 'widget_archives_dropdown_args', 'my_limit_archives' );
<?php
class functions
{
function token_generate($length = 10)
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++)
{
<?php
// in this file we wil define all generic functins
// This is to display data from table
function get_table_data($tbl, $where='', $order='', $limit='')
{
global $conn;
$sql = "select * from $tbl";
if(!empty($where))
{
$sql .= " where $where";
How to redirect http://domain.com to https://www.domain.com?
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
*********************
//https://stackoverflow.com/questions/18480105/how-to-show-multiple-areas-by-location-in-google-maps-using-php
var map;
var geocoder;
var marker;
var people = new Array();
var latlng;
var infowindow;
$(document).ready(function() {