Skip to content

Instantly share code, notes, and snippets.

@wpsmith
wpsmith / wp_user_query.php
Created August 14, 2012 21:37
WP_User_Query
<?php
/**
* WordPress WP_User_Query Comprehensive Reference
* Compiled by wpsmith - wpsmith.net
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_User_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/user.php
*/
$args = array(
@trepmal
trepmal / gist:3308061
Created August 9, 2012 21:04
Checkboxes & Ajax
<?php
//Plugin Name: Checkboxes & Ajax
//Description: In re to http://wordpress.stackexchange.com/questions/61390/edit-post-meta-with-checkboxes-on-front-end
//add our test checkboxes
add_filter( 'the_content', 'cba_add_checkboxes');
function cba_add_checkboxes( $c ) {
$first = get_post_meta( get_the_ID(), 'first_item_key', true );
$second = get_post_meta( get_the_ID(), 'second_item_key', true );
@aanomm
aanomm / snippet.txt
Created August 6, 2012 06:16
CSS: Bootstrap Centre Navbar
.center.navbar .nav,
.center.navbar .nav > li {
float:none;
display:inline-block;
*display:inline; /* ie7 fix */
*zoom:1; /* hasLayout ie7 trigger */
vertical-align: top;
}
.center .navbar-inner {
@samikeijonen
samikeijonen / page-template-bloghatchpro.php
Created July 25, 2012 19:15
Hatch Pro Blog Template
<?php
/**
* Template Name: blog
*
* A custom page template for displaying blog archives.
*
* @package Hatch Pro
* @subpackage Template
*/
@OpenGrid
OpenGrid / twitter-bootstrap-forms-responsive.css
Created July 24, 2012 15:19
Twitter Bootstrap form-horizontal css for form for two column layout
@media (max-width: 980px) {
.form-horizontal .control-group > label {
float: none;
width: auto;
padding-top: 0;
text-align: left;
}
.form-horizontal .controls {
margin-left: 0;
}
@aanomm
aanomm / wp-protect_whole_site
Created July 18, 2012 03:09
WP: SECURITY > protect_whole_site
function protect_whole_site() {
if ( !is_user_logged_in() ) {
auth_redirect();
}
}
add_action ('template_redirect', 'protect_whole_site');
//Whats Up
(function(){
var p = PUBNUB
, speech = p.$('text-to-speech')
, tts = p.$('tts')
, tts_tpl = p.attr( tts, 'template' )
, speeches = p.$('speeches_template')
, speech_tpl = p.attr( speeches, 'template' )
@hkirsman
hkirsman / functions.php
Created June 26, 2012 19:55
Wordpress WPML custom
<?php
function languages_list_custom() {
$languages = icl_get_languages('orderby=code');
$languages_count = count($languages);
if(!empty($languages) && $languages_count>1){
echo '<div id="lang_sel_list_custom"><ul>';
$i=1;
global $sitepress_settings;
$show_flags = $sitepress_settings['icl_lso_flags'];
@tenman
tenman / author.php
Created June 20, 2012 05:00
Show author profile
<?php /*for example*/?>
<?php get_header();?>
<?php get_header();?>
<?php
if(WP_DEBUG == true){
echo '<!--'.basename(__FILE__,'.php').'['.basename(dirname(__FILE__)).']-->'."\n";
}?>
<div>
@leftlane
leftlane / add_meta_key_manually.php
Created June 12, 2012 06:37
Add a meta_key to all WordPress users of Subscriber Role using add_user_meta
<?php // Create the WP_User_Query object
$wp_user_query = new WP_User_Query( array( 'role' => 'subscriber' ) );
// Get the users
$users = $wp_user_query->get_results();
// Check for users
if (!empty($users))
{
// Loop through each user
foreach ($users as $user)
{