showCategory('PHP');

Add a custom sidebar to a WordPress theme or plugin

function my_sidebar() {
  register_sidebar(
    array (
      'name' => __( 'Custom', 'theme-domain' ),
      'id' => 'my-sidebar',
      'description' => __( 'My Sidebar', 'theme-domain' ),
      'before_widget' => '<div class="widget-content">',
      'after_widget' => "</div>",
      'before_title' => '<h3 class="widget-title">',
      'after_title' => '</h3>',
    )
  );
}
add_action( 'widgets_init', 'my_sidebar' );

Showing 14 lines of 22 total lines in this snippet.

Output additional WP media sizes

<?php
global $_wp_additional_image_sizes;
var_dump( $_wp_additional_image_sizes );
?>

Showing 4 lines of 47 total lines in this snippet.

Return short text snippet function

function textSnippet($string,$length=200){
  return preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
}

Showing 3 lines of 3 total lines in this snippet.