Skip to content

Instantly share code, notes, and snippets.

Avatar

Nilambar Sharma ernilambar

View GitHub Profile
@ernilambar
ernilambar / dbtest.php
Last active November 9, 2015 08:14
Simple tool for testing MySQL database
View dbtest.php
<?php
/**
* Simple tool for testing MySQL database.
*
* @package DB_Test
* @author Nilambar Sharma <nilambar@outlook.com>
* @license GPL-2.0+
* @link http://www.nilambar.net
* @copyright 2015 Nilambar Sharma
*/
@ernilambar
ernilambar / author-box-snippet.php
Created February 1, 2015 14:31
author-box-snippet.php
View author-box-snippet.php
<?php
add_action( 'blue_planet_author_box', 'custom_blue_planet_author_box' );
function custom_blue_planet_author_box(){
ob_start();
?>
<style>
.authorbox{
@ernilambar
ernilambar / featured.php
Created August 27, 2014 00:18
Example Page Template for showing featured posts [NS Featured Posts]
View featured.php
@ernilambar
ernilambar / transient_example.php
Last active July 17, 2017 06:05
WordPress Transient Example
View transient_example.php
<?php
function example_transient(){
$transient_key = 'my_unique_transient_key';
$transient_period = 24 * HOUR_IN_SECONDS;
$output = get_transient( $transient_key );
if ( false === $output ) {
$output = 'Hello World';
@ernilambar
ernilambar / wordpress_loop.php
Last active January 29, 2016 06:21
Alternative WordPress Loop Example
View wordpress_loop.php
<?php
$custom_query_args = array(
'post_type' => 'post',
);
// Get current page and append to custom query parameters array
$custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$custom_query = new WP_Query( $custom_query_args ); ?>
<?php
// Pagination fix