This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Movies Post Type | |
Plugin URI: http://vienhoang.com | |
Description: Offers a method for managing a movie collection. | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_url_to_text( $text ) { | |
// Look for anything that is not a space, i = case insensitive, m = multiple line | |
$text = preg_replace('/(http[^s])+/im', '<a href="$1">$1</a>', $text ); | |
return $text; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Messenger Widget | |
Plugin URI: http://vienhoang.com | |
Description: Display any messages. | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Movies Post Type | |
Plugin URI: http://vienhoang.com | |
Description: Offers a method for managing a movie collection. | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_shortcode( 'vh_movies', function() { | |
$loop = new WP_Query( | |
array( | |
'post_type' => 'vh_movie', | |
'orderby' => 'title' | |
) | |
); | |
if ( $loop->have_posts() ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Twitter Shower | |
Plugin URI: http://vienhoang.com | |
Description: Display message. | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: VH Cron | |
Plugin URI: http://vienhoang.com | |
Description: Demo for running WP Cron Jobs | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: VH Filter | |
Plugin URI: http://vienhoang.com | |
Description: Filter the content. | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: VH Options | |
Plugin URI: http://vienhoang.com | |
Description: Options page for a theme. | |
Version: 1.0 | |
Author: Vien Hoang | |
Author URI: http://vienhoang.com | |
License: GPL2 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function limiting($num) { | |
$fruits = array('bananas', 'apples', 'pear'); | |
foreach ( $fruits as $v ) { | |
if ( $num-- === 0) { | |
break; | |
} |