Skip to content

Instantly share code, notes, and snippets.

View danielpataki's full-sized avatar

Daniel Pataki danielpataki

View GitHub Profile
@danielpataki
danielpataki / Vagrantfile
Created June 17, 2015 15:53
Setting Up 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.11.44"
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.example.com/catalog?item=12&amp;desc=vacation_hawaii</loc>
@danielpataki
danielpataki / style.css
Created July 23, 2015 15:34
Income Tracker
/*
Theme Name: Earning Stats
Theme URI: http://stats.tastique.net
Author: Daniel Pataki
Author URI: https://danielpataki.com/
Description: The theme that governs my stats page
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@danielpataki
danielpataki / docblock.php
Last active September 13, 2015 17:34
docblock
/**
* Retrive Channel IDs
*
* This function retreives all categories which are set as channels.
* Channels on the website are special categories that have a mailing
* list attached which users can subscribe to.
*
* It returns an array of term objects if $format is set to 'objects',
* otherwise returns an array of term_ids.
*
@danielpataki
danielpataki / display-skeleton.php
Last active September 13, 2015 17:35
Creating An Authors Widget
public function widget( $args, $instance ) {
echo $args['before_widget'];
if( !empty( $instance['title'] ) ) {
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $args['after_title'];
}
// Main Widget Code Here
@danielpataki
danielpataki / nonce-url.php
Last active September 13, 2015 17:35
Nonces
$delete_link = wp_get_shortlink( get_the_ID() ) . '&delete=true';
$nonced_link = wp_nonce_url( $delete_link, 'delete-post-' . get_the_ID(), '_mynonce' );
@danielpataki
danielpataki / migrate.php
Last active September 13, 2015 17:35
Migrate From Media Custom Fields to ACF
$args = array(
'post_type' => 'attachment',
'post_status' => 'any',
'posts_per_page' => -1
);
$attachments = new WP_Query( $args );
while ( $attachments->have_posts() ) {
$attachments->the_post();
@danielpataki
danielpataki / disable-menu.php
Last active September 13, 2015 17:35
Managing Client Access To Plugins
function remove_plugin_menu(){
remove_menu_page( 'plugins.php' );
}
add_action( 'admin_menu', 'remove_plugin_menu' );
@danielpataki
danielpataki / add-column.php
Last active September 13, 2015 17:35
Easy Featured Images
add_filter( 'manage_post_posts_columns', 'efi_table_head' );
/**
* Custom Column Headers
*
* This function adds the custom column we need. It is added to the beginning
* by splitting the original array.
*
* @param array $columns The columns contained in the post list
*
*/
@danielpataki
danielpataki / excerpt-length.php
Last active September 13, 2015 17:36
Enhance Posts And Pages
add_filter( 'excerpt_length', 'my_excerpt_length' );
function my_excerpt_length( $length ) {
return 110;
}