Skip to content

Instantly share code, notes, and snippets.

View danielpataki's full-sized avatar

Daniel Pataki danielpataki

View GitHub Profile
@danielpataki
danielpataki / meta-query.php
Created November 27, 2014 13:59
WP_Meta_Query In 4.1
$query = new WP_Query( array(
'meta_query' => array(
'relation' => 'OR',
array(
'relation' => 'AND',
array(
'key' => 'city',
'value' => 'Miami',
),
array(
@danielpataki
danielpataki / Vagrantfile
Last active November 4, 2016 18:13
Vagrant Setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.55.55"
@danielpataki
danielpataki / full.php
Last active August 29, 2015 14:10
Custom Taxonomies
add_action( 'init', 'create_athlete_taxonomy' );
function create_athlete_taxonomy() {
$labels = array(
'name' => 'Athletes',
'singular_name' => 'Athlete',
'search_items' => 'Search Athletes',
'all_items' => 'All Athletes',
'edit_item' => 'Edit Athlete',
'update_item' => 'Update Athlete',
@danielpataki
danielpataki / __.php
Last active August 29, 2015 14:10
Internationalization
$name = __( 'My Stats', 'textdomain' );
@danielpataki
danielpataki / basics.php
Last active April 5, 2019 13:00
Creating a Plugin
<?php
/**
* Plugin Name: My Facebook Tags
* Plugin URI: http://danielpataki.com
* Description: This plugin adds some Facebook Open Graph tags to our single posts.
* Version: 1.0.0
* Author: Daniel Pataki
* Author URI: http://danielpataki.com
* License: GPL2
*/
@danielpataki
danielpataki / Vagrantfile
Last active February 23, 2019 21:40
WordPress On Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.99.99"
@danielpataki
danielpataki / custom-loop.php
Last active July 8, 2020 20:36
Retrieve Any Post You Want With WP_Query
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'future'
);
$scheduled = new WP_Query( $args );
if ( $scheduled->have_posts() ) :
?>
<?php while( $scheduled->have_posts() ) : $scheduled->the_post() ?>
@danielpataki
danielpataki / do_shortcode.php
Last active August 29, 2015 14:11
Shortcode
<?php echo do_shortcode( "[embed]https://twitter.com/wpmudev/status/542846265898184704[/embed]" ) ?>
<p><?php apply_filters( 'product_display_footer', 'Thanks for using our product display plugin' ) ?></p>
@danielpataki
danielpataki / hook-test.php
Last active August 29, 2015 14:11
Figuring Out Hooks
add_action( 'save_post', 'tweet_my_mood' );
function tweet_my_mood( $post_id, $post ) {
echo get_post_meta( $post_id, 'mood', true );
exit();
}