Skip to content

Instantly share code, notes, and snippets.

View danielpataki's full-sized avatar

Daniel Pataki danielpataki

View GitHub Profile
@danielpataki
danielpataki / __.php
Last active August 29, 2015 14:10
Internationalization
$name = __( 'My Stats', 'textdomain' );
@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();
}
@danielpataki
danielpataki / Vagrantfile
Created December 26, 2014 08:30
Full Vagrantfile
# -*- 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"
@danielpataki
danielpataki / full.php
Last active August 29, 2015 14:12
Workout Diary
add_filter( 'the_content', 'show_diary_details' );
function show_diary_details( $content ) {
$diary = '';
if( has_category( 'workout' ) ) {
$diary = '<table>
<tr>
<th>Activity</th>
<th>Duration</th>
<th>Distance</th>
@danielpataki
danielpataki / custom-post-hooks.php
Last active August 29, 2015 14:14
Revealing Post Ids
$custom_post_types = get_post_types(
array(
'public' => true,
'_builtin' => false
),
'names'
);
foreach ( $custom_post_types as $post_type ) {
add_action( 'manage_edit-'. $post_type . '_columns', 'revealid_add_id_column' );
@danielpataki
danielpataki / changelog.txt
Last active August 29, 2015 14:19
Submitting and maintaining plugins
== Changelog ==
= 1.1.4 =
* WordPress 4.2 compatibility check
= 1.1.3 =
* Added hook for modifying the post types
* Added Hungarian translation
@danielpataki
danielpataki / bold.html
Last active August 29, 2015 14:20
Showing code
&lt;strong&gt;bold text&lt;/bold&gt;
@danielpataki
danielpataki / make_site.sh
Last active August 29, 2015 14:22
Site Creation Automation
echo Making site $1 directory...
mkdir /var/www/html/$1
echo Creating apache configuration file...
sudo touch /etc/apache2/sites-available/$1.conf
echo Writing configuration file...
echo "<VirtualHost *:80>
ServerName $1.$2