How To Update PHP 7.0 to PHP 7.2 on Debian Easily

Linux, PHPLeave a comment

More than a year a go, I wrote about how to upgrade PHP 5.6 to PHP 7.0.

Now, PHP 7.0 will reached the end of its critical support through December 2018. After that date PHP community will no longer provides support for bugs. Following to PHP 7.0, PHP 7.1 will be put under discontinued support next year.

Also, since dotdeb dropped support for PHP 7.1 and later so we will use another package provided by Ondřej Surý’s.

Continue reading “How To Update PHP 7.0 to PHP 7.2 on Debian Easily”

Featured Image as Previous Next Post Navigation in WordPress

PHP, snippet, Wordpress, , Leave a comment

Just add this code to single.php, replace or comment the default function like the_post_navigation, get_previous_post, get_next_post, etc.

$prev_post = get_previous_post();
$prev_thumbnail = get_the_post_thumbnail( $prev_post->ID, 'large');

$next_post = get_next_post();
$next_thumbnail = get_the_post_thumbnail( $next_post->ID, 'large');

$args = array(
'prev_text'  => $prev_thumbnail,
'next_text'  => $next_thumbnail

the_post_navigation( $args );


Add Custom Size Image to Media Popup in WordPress

PHP, snippet, Wordpress, , Leave a comment

In WordPres 4.5, my old function to add a custom size to media uploader seems not working anymore. But I found that new way to add custom size image is a lot simpler using image_size_names_choose filter.

Basically when you create your own image sizes using the add_image_size function:

function add_news_thumb() {
    add_image_size( 'news', 800, 300, TRUE );
    add_image_size( 'news-detail', 1500, 600, TRUE );
add_action( 'after_setup_theme', 'add_news_thumb' );

you can just add the new sizes to image_size_names_choose:

function added_custom_size( $sizes ) {
  return array_merge( $sizes, array(
	'news' => __( 'News Thumbnail' ), 
	'news-detail' => __( 'News Detail ' ),
  ) );
add_filter( 'image_size_names_choose', 'added_custom_size' );
Screen Shot 2016-06-06 at 4.36.51 PM