Archive November, 2011

Objective-C: Addendum on notifications and delegates

Answer to the question of ILeW with an article about what the real, attaching such as notifications and delegates work. Using a pattern we see first how the delegate pattern:

Delegate

An object in search of a delegate

Continued ...

WordPress Snippet: src thumbnail

WordPress allows you to associate a thumbnail to a post , page or post customized. , che restituiscono il completo tag img , risulta meno intuitivo come ottenere il solo link: If it is easy to extract the entire image code, thanks to features the_post_thumbnail() or get_the_post_thumbnail , which return the complete tag img , less intuitive is how to get the single link:

1
2
3
4
/ / If $ post_id is the id of the post
get_post_thumbnail_id ( $post_id ) ; $ Image_id = get_post_thumbnail_id ($ post_id);
wp_get_attachment_image_src ( $image_id , 'full' ) ; $ Image = wp_get_attachment_image_src ($ image_id, 'full');
[ 0 ] echo $ image [0]

Continued ...

WordPress Delete Post

WordPress allows you to intercept when a post - even custom type - is being eliminated. . There are two action hooks that can be used: delete_post and deleted_post . In the first analysis, the former should be attributed to a "is being eliminated" the post, even if it does not seem to be, or better.

Continued ...

Sort an array of arrays in PHP

vista in WordPress: ordinare una serie di post per un campo qualsiasi può essere utilizzata facilmente anche per ordinare array di array . PHP function usort ( ) seen in Wordpress: order a series of posts for any field can be used to easily sort arrays of arrays. For example if we have:

1
2
3
4
5
6
7
8
9
array ( $ Args = array (
'nome' => 'mike' , 'anno' => 2001 ) , array ('name' => 'Mike', 'year' => 2001),
'nome' => 'frank' , 'anno' => 2010 ) , array ('name' => 'Frank', 'year' => 2010),
...
);

$args , function ( $a , $b ) { usort ($ args, function ($ a, $ b) {
$a [ 'anno' ] > $b [ 'anno' ] ) ; return ($ a ['year']> $ b ['year']);
});

Continued ...


Stop SOPA