lion_neel

Function Reference/ add theme support

Jun 15th, 2013
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Description
  2. ===============*/
  3.  
  4. Allows a theme or plugin to register support of a certain theme feature. If called from a theme, it should be done in the theme's functions.php file to work.
  5.  
  6. /*Usage
  7. ===============*/
  8.  
  9. <?php add_theme_support( $feature ); ?>
  10.  
  11. /*Parameters
  12. =============*/
  13.  
  14. $feature
  15. (string) (required) Name for the feature being added.
  16.  
  17.        Features list:
  18.  
  19.         *^*   'post-formats'
  20.         *^*   'post-thumbnails'
  21.         *^*   'custom-background'
  22.         *^*   'custom-header'
  23.         *^*   'automatic-feed-links'
  24.         *^*   'menus'
  25.  
  26.        ***Default: None
  27.  
  28. /*Examples
  29. =============*/
  30.  
  31. ^*^ Post Thumbnails
  32.  
  33. This feature enables Post Thumbnails support for a Theme.
  34.  
  35. add_theme_support( 'post-thumbnails' );
  36. add_theme_support( 'post-thumbnails', array( 'post' ) );          // Posts only
  37. add_theme_support( 'post-thumbnails', array( 'page' ) );          // Pages only
  38. add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) ); // Posts and Movies
  39.  
  40. set_post_thumbnail_size( 200, 200, true );             // Sets the size of thubnails
  41. add_image_size( 'post-image', 150, 150, true );       // Sets the size of Post-Images
  42.  
  43.  
  44. Codes must be inside <?php?> Tag.This feature must be called before the init hook is fired. That means it needs to be placed directly into functions.php.
Advertisement
Add Comment
Please, Sign In to add comment