This is unreal, all the great stuff I learned over the short time span. Got a lot of new ideas and things to learn from this small weekend. I wanted to put together what I found most interesting in this blog post more as a list and reminder for myself but also for anybody reading this. It may start you off on a learning quest π
This is not my attempt at a complete summary of WCPHX2014, I am merely trying to note down the things I found most interesting and acredit the person how got me to think in that direction via their twitter handle.
Day 1
@bradparbs β Writing Extensible Plugins
slides: http://b.parbs.me/TPhc
1
2
3
4
5
6
7
8
9
10
11
<pre lang="php">if (function_exists(function_name))
if (class_exists(class_name))
do_action( $tag, $arg );
apply_filters( $tag, $value );
load order of plugins, use: plugins_loaded
get_template_part( $slug, $name );
file_exists(filename)
wpcli β command line for wordpress
check: http://www.getsource.net/2013/07/wcsf2013-wpcli/ for more
local dev environment β https://github.com/10up/varying-vagrant-vagrants
linter β https://github.com/SublimeLinter/SublimeLinter
@obencain, @michaeldcain
slides: https://cloudup.com/c6A3IprTH6N
Donβt trust anybody β SANATIZE your data
some functions to look at:
1
2
3
4
5
6
7
8
9
10
<pre lang="php">wp_localize_script( $handle, $object_name, $l10n );
wp_add_inline_style( $handle, $data );
has_post_format( $format, $post );
wp_list_pluck( $list, $field );
is_email( $email, $deprecated );
human_time_diff( $from, $to );
wp_trim_words( $text, $num_words, $more );
capital_p_dangit( $text );
esc_url_raw( $url, $protocols );
https://github.com/WordPress/WordPress/blob/master/wp-includes/formatting.php
@cliffseal
slides: http://www.slideshare.net/cliffseal/transients-wcphx
1
2
3
4
5
<pre lang="php">set_transient( $transient, $value, $expiration );
get_transient( $transient );
delete_transient( $transient );
wp_remote_get( $url, $args );
wp_remote_retrieve_body( $response );
http://codex.wordpress.org/Transients_API
set transient for db queries, external api calls, any data task that takes time
Tip: hook in logical spots to delete transient
Example delete transient on post save
1
2
3
4
5
<pre lang="php">add_action( 'save_post', schurpf_del_transient );
function schurpf_del_transient()
{
delete_transient('schurpf_my_transient' );
}
https://github.com/logoscreative/wcphx14-demo-plugin
Mark Jaquith solution: https://github.com/markjaquith/WP-TLC-Transients
[wpsleep start=β26.01.2014 21:55β³]Check out my second day at WCPHX 2014 at https://schurpf.com/wcphx2014-day2/.[/wpsleep]