Skip to content

Instantly share code, notes, and snippets.

/**
* Get posts pending count as per Post Type.
* @param string $post_type
* @return integer Pending count.
*/
function project_get_pending_items( $post_type ) {
global $wpdb;
$pending_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = %s AND post_status = 'pending'", $post_type ) );
return (int) $pending_count;
}
@obiPlabon
obiPlabon / frontendDevlopmentBookmarks.md
Created November 6, 2015 19:47 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@obiPlabon
obiPlabon / gist:361215d441a2a04b8091
Created February 8, 2016 08:24 — forked from bitfade/gist:ee91d7e8aff16364b9ff
Custom WordPress Media Uploader
(function ($) {
"use strict";
/*global wp,jQuery */
var CustomGalleryEdit,CustomFrame;
function customClasses() {
var media = wp.media;
var l10n = media.view.l10n;
@obiPlabon
obiPlabon / filter.js
Created February 8, 2016 08:25 — forked from bitfade/filter.js
WordPress 3.5 media upload, toolbar with custom filter
/*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */
/*global wp,jQuery */
jQuery(document).ready(function($) {
if (!window.wp || !window.wp.media) {
return;
}
var media = window.wp.media;
@obiPlabon
obiPlabon / gist:218d0b744d78cabe3d26
Created February 8, 2016 08:26 — forked from bitfade/gist:4460948
WordPress 3.5 media upload api example
var workflow = wp.media({
title: 'Select the images',
// use multiple: false to disable multiple selection
multiple: 'add',
button: {
text: 'Add selected images'
},
library: {
type: 'image'
}
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.
@obiPlabon
obiPlabon / gist:32f8d6f8ed29b0054ea95a9f844ba08b
Created August 8, 2016 07:24 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@obiPlabon
obiPlabon / pmg-rewrite.php
Created December 3, 2016 09:41 — forked from chrisguitarguy/pmg-rewrite.php
WordPress rewrite tutorial
<?php
/*
Plugin Name: Rewrite Rule Tutorials
*/
add_action( 'init', 'pmg_rewrite_add_rewrites' );
function pmg_rewrite_add_rewrites()
{
add_rewrite_endpoint( 'json', EP_PERMALINK );
add_rewrite_rule(
/* =========================================================
* composer-view.js v0.2.1
* =========================================================
* Copyright 2013 Wpbakery
*
* Visual composer backbone/underscore version
* ========================================================= */
(function ( $ ) {
var i18n = window.i18nLocale,
store = vc.storage,