The Jugaad Way – WC Singapore 2016

WordCamp-Singapore-logo-deskstop-1Hello, WordCamp Singapore! Here’s everything you need to start using the code snippets outlined in my talk.

1) First, download the Code Snippets plugin, and install it on a test site.

2) Then, grab the code for each example from the code blocks below.

3) Download the slides, if you’d like to follow along at home!


Warning: do NOT run any of this code on a live site.

Modifying the ‘the_title’ filter

add_filter( 'the_title', 'wcsing_add_promo', 10, 2);

function wcsing_add_promo( $title, $id = null ) {

  	$title = "WordCamp Singapore >> " . $title;
  
    return $title;
}

Customizing the ‘login_message’ filter

add_filter( 'login_message', 'wcsing_login_message' );

function wcsing_login_message( $message ) {
  
  return "WC Singapore is going to be awesome!";
   
}

Outputting a notice via the ‘admin_notice’ action

add_action( 'admin_notices','wcsing_admin_notice' ); 

function wcsing_admin_notice() {
	
  echo '
<div class="notice notice-info">Hello, WordCamp Singapore!</div>

';
  
}

Adding text to the comment form via the ‘comment_form’ action

add_action( 'comment_form', 'wcsing_comment_form' );

function wcsing_comment_form( $post_id ) {
	echo '<strong>Are you posting about WC Singapore? You should be!</strong>';
}