Skip to content

Instantly share code, notes, and snippets.

Daniel Pataki danielpataki

Block or report user

Report or block danielpataki

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
View post-list-template-acf-options.php
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_post-list-options',
'title' => 'Post List Options',
'fields' => array (
array (
'key' => 'field_543f8a046d65e',
'label' => 'Authors',
'name' => 'authors',
@danielpataki
danielpataki / custom.php
Last active Aug 29, 2015
Editor Style Examples
View custom.php
function my_editor_styles() {
add_editor_style( 'admin/editor.css' );
}
add_action( 'after_setup_theme', 'my_editor_styles' );
View commentcount.php
global $wpdb;
for( $i=1; $i <= 5; $i++ ) {
$this_week = 7 * $i;
$last_week = 7 * ( $i - 1);
$comment_counts[] =
$wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_date > '" . date('Y-m-d H:i:s', strtotime('-' . $this_week . ' days')) . "' AND comment_date < '" . date('Y-m-d H:i:s', strtotime('-' . $last_week . ' days')) . "'" ) ;
View basic-shortcode.php
function my_code_output( $atts, $content ) {
return '<pre><code>' . $content . '</code></pre>';
}
add_shortcode('code', 'my_code_output');
@danielpataki
danielpataki / admin-targeting-hook.php
Last active Aug 29, 2015
Common WordPress Code Mistakes
View admin-targeting-hook.php
function user_edit_script( $hook ) {
if ( 'profile.php' != $hook ) {
return;
}
wp_enqueue_script( 'my-user-edit', plugin_dir_url( __FILE__ ) . 'js/my-user-edit.js' );
}
add_action( 'admin_enqueue_scripts', 'user_edit_script' );
View gist:037c76788b73301b1e12
# -*- mode: ruby -*-
# vi: set ft=ruby :
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.77.77"
config.vm.provision :shell, :path => "install.sh"
View wp-cli.sh
#!/bin/bash
# Setup Variables
DBNAME=blog
DBUSER=root
DBPASS=root
DBHOST=localhost
DBPREFIX=9239jej9md_
URL=http://blog.local
View title-tag.php
function theme_slug_setup() {
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'theme_slug_setup' );
if ( ! function_exists( '_wp_render_title_tag' ) ) :
function theme_slug_render_title() {
echo '<title>' . wp_title( '|', false, 'right' ) . "</title>\n";
}
add_action( 'wp_head', 'theme_slug_render_title' );
@danielpataki
danielpataki / meta-query.php
Created Nov 27, 2014
WP_Meta_Query In 4.1
View meta-query.php
$query = new WP_Query( array(
'meta_query' => array(
'relation' => 'OR',
array(
'relation' => 'AND',
array(
'key' => 'city',
'value' => 'Miami',
),
array(
@danielpataki
danielpataki / __.php
Last active Aug 29, 2015
Internationalization
View __.php
$name = __( 'My Stats', 'textdomain' );
You can’t perform that action at this time.