Skip to content

Instantly share code, notes, and snippets.

Jakob Jakobuz

Block or report user

Report or block Jakobuz

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
@Jakobuz
Jakobuz / vimrc
Created Mar 18, 2019
My Vim rc file.
View vimrc
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
syntax on
filetype on
filetype plugin on
filetype indent on
behave mswin
runtime macros/matchit.vim
@Jakobuz
Jakobuz / gist:baad801c737812c2eea5bba10bdd6247
Created Mar 27, 2018 — forked from nodesocket/gist:3919205
All world timezones in an HTML select element
View gist:baad801c737812c2eea5bba10bdd6247
<select name="timezone_offset" id="timezone-offset" class="span5">
<option value="-12:00">(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11:00">(GMT -11:00) Midway Island, Samoa</option>
<option value="-10:00">(GMT -10:00) Hawaii</option>
<option value="-09:50">(GMT -9:30) Taiohae</option>
<option value="-09:00">(GMT -9:00) Alaska</option>
<option value="-08:00">(GMT -8:00) Pacific Time (US &amp; Canada)</option>
<option value="-07:00">(GMT -7:00) Mountain Time (US &amp; Canada)</option>
<option value="-06:00">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</option>
<option value="-05:00">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option>
@Jakobuz
Jakobuz / custom_query.php
Created Mar 10, 2018 — forked from danott/custom_query.php
Wordpress custom query for getting information outside of The Loop
View custom_query.php
<?
// This is a sub query for pulling data from outside of the loop..
// However, we need to preserve the original $wp_query if this is inside an existing loop.
// If this is the last query, then you can ditch it.
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('your-custom-query');
View gist:0d009e0cf8c81717ee47a76f1ce889a8
DateTime.ToString() Patterns
All the patterns:
0 MM/dd/yyyy 08/22/2006
1 dddd, dd MMMM yyyy Tuesday, 22 August 2006
2 dddd, dd MMMM yyyy HH:mm Tuesday, 22 August 2006 06:30
3 dddd, dd MMMM yyyy hh:mm tt Tuesday, 22 August 2006 06:30 AM
4 dddd, dd MMMM yyyy H:mm Tuesday, 22 August 2006 6:30
5 dddd, dd MMMM yyyy h:mm tt Tuesday, 22 August 2006 6:30 AM
View recaptcha-form.php
<?php
if(isset($_POST['submit'])):
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
//your site secret key
$secret = 'InsertSiteSecretKey';
//get verify response data
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
$name = !empty($_POST['name'])?$_POST['name']:'';
@Jakobuz
Jakobuz / settings-api-class-demo.php
Created Jan 9, 2018 — forked from tareq1988/settings-api-class-demo.php
A simple theme options page created with WordPress Settings API PHP class https://github.com/tareq1988/wordpress-settings-api-class
View settings-api-class-demo.php
<?php
require_once dirname( __FILE__ ) . '/class.settings-api.php';
/**
* Theme Admin panel for Tareq's Planet
*
* @author Tareq Hasan
*/
class Tareqs_Planet_Admin {
@Jakobuz
Jakobuz / functions.php
Created Dec 6, 2017 — forked from jayarnielsen/functions.php
WP Query Orderby Taxonomy Term Name
View functions.php
add_filter('posts_clauses', 'posts_clauses_with_tax', 10, 2);
function posts_clauses_with_tax( $clauses, $wp_query ) {
global $wpdb;
//array of sortable taxonomies
$taxonomies = array('example-taxonomy', 'other-taxonomy');
if (isset($wp_query-&gt;query['orderby']) &amp;&amp; in_array($wp_query-&gt;query['orderby'], $taxonomies)) {
$clauses['join'] .= "
LEFT OUTER JOIN {$wpdb-&gt;term_relationships} AS rel2 ON {$wpdb-&gt;posts}.ID = rel2.object_id
LEFT OUTER JOIN {$wpdb-&gt;term_taxonomy} AS tax2 ON rel2.term_taxonomy_id = tax2.term_taxonomy_id
LEFT OUTER JOIN {$wpdb-&gt;terms} USING (term_id)
@Jakobuz
Jakobuz / All terms in custom Taxonomy Wordpress
Last active Dec 6, 2017
Wordpress | Get all terms in custom Taxonomy
View All terms in custom Taxonomy Wordpress
$taxonomies = array(
'custom_category'
);
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'exclude' => array(),
'exclude_tree' => array(),
@Jakobuz
Jakobuz / wp_get_archives() with cat_id
Last active Dec 6, 2017
Wordpress | Filter the function wp_get_archives() so a category_id can be added
View wp_get_archives() with cat_id
/*
* Filter the wp_get_archives() so a cat_id can be added
* Example: wp_get_cat_archives('type=monthly&format=option&show_post_count=1', 46);
* in this case '46' = the category id
*/
add_filter('getarchives_where', 'custom_archives_where', 10, 2);
add_filter('getarchives_join', 'custom_archives_join', 10, 2);
function custom_archives_join($x, $r) {
You can’t perform that action at this time.