Skip to content

Instantly share code, notes, and snippets.

View sureshkldh's full-sized avatar
馃彔
Working from Office

sureshkldh

馃彔
Working from Office
View GitHub Profile
@sureshkldh
sureshkldh / Display post from a date range from custom field
Created January 15, 2020 10:19
Display post from a date range from custom field
$range = array(
'2015-05-01',
'2015-05-31',
);
$args = array(
'post_type' => 'score_post_type',
'posts_per_page' => 5,
'meta_key' => 'score_time',
'orderby' => 'meta_value',
'order' => 'ASC',
@sureshkldh
sureshkldh / jQuery loop over JSON result from AJAX Success?
Created November 28, 2019 11:49
jQuery loop over JSON result from AJAX Success?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery.getJSON demo</title>
<style>
img {
height: 100px;
float: left;
}
@sureshkldh
sureshkldh / Registering a Sidebar in wordpress
Last active November 28, 2019 04:05
Registering a Sidebar in wordpress
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
/* Register the 'primary' sidebar. */
register_sidebar(
array(
'id' => 'primary',
'name' => __( 'Primary Sidebar' ),
'description' => __( 'A short description of the sidebar.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
@sureshkldh
sureshkldh / Rewriting a custom-post-type permalink with taxonomy term? - wordpress
Created November 27, 2019 08:23
Rewriting a custom-post-type permalink with taxonomy term ? - wordrpess
add_action('init', 'wr_events');
function wr_events() {
register_taxonomy(
'event_type',
'wr_event',
array(
'label' => 'Types',
'singular_label' => 'Typ',
@sureshkldh
sureshkldh / fancybox with lightbox popup box
Created November 25, 2019 11:40
fancybox with lightbox popup box
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<!-- Add fancybox3 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<div id="pictures" class="owl-slider">
<a class="item" href="http://localhost/testing/download.jpg" data-fancybox="gallery">
<img src="http://localhost/testing/download.jpg" width="300" height="150" alt="title" />
</a>
@sureshkldh
sureshkldh / AJAX with lazyload IMAGE
Created November 25, 2019 11:36
AJAX with lazyload IMAGE
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8" />
<title>
Lazyload tests
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
@sureshkldh
sureshkldh / Remove specific category from a post
Created November 16, 2019 07:08
Remove specific category from a post
// Remove specific category from a post
if ($category->name == "Uncategorized") {
wp_remove_object_terms( $post_ID, 'uncategorized', 'category' );
}
@sureshkldh
sureshkldh / add-term-to-custom-taxonomy.php
Created November 7, 2019 10:57 — forked from ms-studio/add-term-to-custom-taxonomy.php
add term metabox to custom taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// CREATE CUSTOM TAXONOMY
add_action( 'init', '___create_my_custom_tax' );
@sureshkldh
sureshkldh / PHP Date & Time Function with Example - Difference Time Zone
Created November 6, 2019 08:01
PHP Date & Time Function with Example - Difference Time Zone
<?php
/**
* Time Zone
*
*
*/
/*** Time Zone List */
$timezone_identifiers = DateTimeZone::listIdentifiers();
@sureshkldh
sureshkldh / Jumbotron Template 路 Bootstrap
Created November 4, 2019 09:58
Jumbotron Template 路 Bootstrap
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Jekyll v3.8.5">
<title>Jumbotron Template 路 Bootstrap</title>