Skip to content

Instantly share code, notes, and snippets.

Nilambar Sharma ernilambar

Block or report user

Report or block ernilambar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ernilambar
ernilambar / dbtest.php
Last active Nov 9, 2015
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
*/
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 / date-in-np.php
Created Dec 24, 2014
showing date in nepali
View date-in-np.php
<?php
add_filter('get_the_date_nepali','my_custom_get_the_date_nepali',10,3);
function my_custom_get_the_date_nepali( $new_date, $converted_date, $original_date){
$output = '';
$gate = getNepaliNumber($converted_date['date']);
$mahina = getMahina($converted_date['month']);
$year = getNepaliNumber($converted_date['year']);
$output .= $gate . ' '. $mahina .', '.$year;
@ernilambar
ernilambar / featured.php
Created Aug 27, 2014
Example Page Template for showing featured posts [NS Featured Posts]
View featured.php
@ernilambar
ernilambar / transient_example.php
Last active Jul 17, 2017
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 Jan 29, 2016
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
@ernilambar
ernilambar / ob_example.php
Last active Dec 10, 2017
Example for using ob functions ob_start
View ob_example.php
<?php
function my_function() {
ob_start();
?>
<h1>Hello World</h1>
<?php
$output = ob_get_contents();
You can’t perform that action at this time.