Skip to content

Instantly share code, notes, and snippets.

View prionkor's full-sized avatar

Sisir prionkor

View GitHub Profile
<?php
/**
* Class Name: wp_bootstrap_navwalker
* GitHub URI: https://github.com/twittem/wp-bootstrap-navwalker
* Description: A custom WordPress nav walker class to implement the Twitter Bootstrap 2.3.2 navigation style in a custom theme using the WordPress built in menu manager.
* Version: 1.4.4
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@prionkor
prionkor / theme updater
Created September 16, 2013 13:05
Theme updater
theme updater add_action( 'init', 'kit_check_theme_update' );
function kit_check_theme_update(){
$versionInfo = 'http://kallzu.s3.amazonaws.com/_kallzu_wp_updates/ppl-ninja/meta.json';
$theme = $theme_data = is_child_theme() ? wp_get_theme()->parent() : wp_get_theme();
$themeDir = $theme->Template;
$updater = new ThemeUpdateChecker( $themeDir, $versionInfo );
$updater->addResultFilter( 'show_data' );
@prionkor
prionkor / gist:7200935
Last active December 26, 2015 19:19
Meta Query Wordpress
// Get stat data that is older then 30 days
$args = array(
'post_type' => 'site',
'post_per_page' => 1,
'meta_key' => 'stat_updated',
'meta_value_num' => time() - 60*60*24*30, // one month before
'meta_compare' => '<'
);
function kallzu_parse_csv2($csv_url){
ini_set('auto_detect_line_endings', true);
$result = array();
$file = fopen($csv_url, 'r');
while (($line = fgetcsv($file)) !== FALSE) {
//$line is an array of the csv elements
$result[] = $line;
}
fclose($file);
<?php
/*
* Walker Class for Output Select Element from WordPress Menus
*
* */
class WPK_Select_Walker extends Walker_Nav_Menu {
// add main/sub classes to li's and links
function start_el( &$output, $item, $depth, $args ) {
@prionkor
prionkor / default-styles.css
Created April 30, 2014 09:51
WP Editor Generated Classes Styles
/* =WordPress Core
-------------------------------------------------------------- */
.alignnone {
margin: 5px 20px 20px 0;
}
.aligncenter,
div.aligncenter {
display: block;
margin: 5px auto 5px auto;
@prionkor
prionkor / search-data-feed.php
Created May 21, 2014 07:13
JSON Search Data Feed Plugin for Wordpress
<?php
/*
Plugin Name: WPSE Search Data Feed
Plugin URI: http://wordpress.stackexchange.com
Description: Provides interface to search and get result in JSON data
Author: Sisir
Version: 1.0
Author URI: http://developerpage.net
*/
/**
* 7.Sort data function
* Allows you to sort the data by the variables set in the $_GET
* @return Mixed
*/
private function sort_data( $a, $b ) {
// Set defaults
$orderby = 'ID';
$order = 'asc';
@prionkor
prionkor / wp-calender-light.css
Created October 14, 2014 10:20
WP Calendar Widget CSS - Light
* calendar widget */
.widget_calendar {float: left;}
#wp-calendar {width: 100%; }
#wp-calendar caption { text-align: right; color: #333; font-size: 12px; margin-top: 10px; margin-bottom: 15px; }
#wp-calendar thead { font-size: 10px; }
#wp-calendar thead th { padding-bottom: 10px; }
#wp-calendar tbody { color: #aaa; }
#wp-calendar tbody td { background: #f5f5f5; border: 1px solid #fff; text-align: center; padding:8px;}
#wp-calendar tbody td:hover { background: #fff; }
#wp-calendar tbody .pad { background: none; }
@prionkor
prionkor / Dse_News.php
Last active August 29, 2015 14:16
Scrapper
<?php
namespace Numstock\Models;
use Sunra\PhpSimple\HtmlDomParser;
class Dse_News{
protected $url = 'http://dsebd.org/display_news.php';
public function __construct(){