Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / show_pagination.php
Last active August 10, 2016 01:25
Wordpress helper: Show pagination
<?php
/**
* show_pagination
*
* Show pagination links.
*
* @author JoseRobinson.com
* @link https://gist.github.com/jrobinsonc/bb3829f9418d37c02a09
* @version 2.0.0
@jrobinsonc
jrobinsonc / example1.php
Last active September 5, 2015 22:15
Wordpress helper: Post views - Set and get the number of views/hits of a post.
<?php
#####################################################
# Example to show most visited posts.
#####################################################
$custom_query = new WP_query(array(
'meta_key' => Posts_views::$key,
'orderby' => 'meta_value_num',
'order' => 'DESC'
@jrobinsonc
jrobinsonc / get_the_slug.php
Last active March 2, 2020 14:49
Wordpress helper: Get slug
<?php
function get_the_slug()
{
global $post;
return is_single() || is_page()? $post->post_name : '';
}
@jrobinsonc
jrobinsonc / Fetch.sublime-settings
Last active April 4, 2016 07:05
NetTuts+ Fetch Settings
{
"files":
{
"cycle": "http://malsup.github.io/jquery.cycle.all.js",
"angular": "http://code.angularjs.org/snapshot/angular.min.js",
"history": "https://raw.github.com/balupton/history.js/master/scripts/compressed/history.js",
"jquery": "http://code.jquery.com/jquery.min.js",
"modernizr": "https://raw.github.com/Modernizr/Modernizr/master/modernizr.js",
"normalize": "https://raw.githubusercontent.com/necolas/normalize.css/master/normalize.css",
"reset": "http://meyerweb.com/eric/tools/css/reset/reset.css"
@jrobinsonc
jrobinsonc / get_file_url.php
Last active August 29, 2015 14:08
Wordpress helper: Get file URL
<?php
/**
* get_file_url
*
* Usage example:
*
* URL relative to the base file:
* get_file_url('styles.css', __FILE__);
*
@jrobinsonc
jrobinsonc / scripts.js
Last active August 29, 2015 14:08
Wordpress addon sample code.
_
@jrobinsonc
jrobinsonc / wp-shortcodes.php
Last active August 29, 2015 14:08
Wordpress shortcode: Shortcodes for native functions of wordpress.
<?php
// Use shortcodes within text widgets
add_filter('widget_text', 'do_shortcode');
// wp_nav_menu
add_shortcode('wp_nav_menu', 'wp_nav_menu_shortcode');
function wp_nav_menu_shortcode($atts = array(), $content = '')
{
@jrobinsonc
jrobinsonc / get_url_shortcode.php
Last active August 29, 2015 14:08
Wordpress shortcode: get_url - Return an absolute URL.
<?php
/**
* Return an absolute URL.
*
* Usage:
* [get_url page=<page id>]
*
* or
*
@jrobinsonc
jrobinsonc / README.md
Last active April 25, 2017 20:12
prettyPhoto for mobile

CSS for mobile:

@media only screen and (max-width: 600px) {
    .pp_pic_holder.pp_default {
        width: 100%!important;
        left: 0!important;
        overflow: hidden;
        top: 50px !important;
@jrobinsonc
jrobinsonc / README.md
Last active June 15, 2016 11:54
JSDB - localStorage and sessionStorage wrapper.

db

localStorage and sessionStorage wrapper.

How to use

First, define your web storage: