catchresponsive_setup

Sets up theme defaults and registers support for various WordPress features.

Description

catchresponsive_setup(); 

Note that this function is hooked into the after_setup_theme hook, which runs before the init hook. The init hook is too late for some features, such as indicating support post thumbnails.


Usage

  1. if ( !function_exists( 'catchresponsive_setup' ) ) { 
  2. require_once '/inc/catchresponsive-core.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = catchresponsive_setup(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/catchresponsive-core.php  
  1. function catchresponsive_setup() { 
  2. /** 
  3. * Get Theme Options Values 
  4. */ 
  5.  
  6. /** 
  7. * Make theme available for translation 
  8. * Translations can be filed in the /languages/ directory 
  9. * If you're building a theme based on catchresponsive, use a find and replace 
  10. * to change 'catch-responsive' to the name of your theme in all the template files 
  11. */ 
  12. load_theme_textdomain( 'catch-responsive', get_template_directory() . '/languages' ); 
  13.  
  14. /** 
  15. * Add default posts and comments RSS feed links to head 
  16. */ 
  17. add_theme_support( 'automatic-feed-links' ); 
  18.  
  19. /** 
  20. * Enable support for Post Thumbnails on posts and pages 
  21. * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails 
  22. */ 
  23. add_theme_support( 'post-thumbnails' ); 
  24.  
  25. // Add Catch Responsive's custom image sizes 
  26. add_image_size( 'catchresponsive-slider', 1200, 514, true ); // Used for Featured slider Ratio 21:9 
  27.  
  28. add_image_size( 'catchresponsive-featured-content', 350, 197, true ); // used in Featured Content Options Ratio 16:9 
  29.  
  30. //Archive Images 
  31. add_image_size( 'catchresponsive-featured', 860, 484, true); // used in Archive Top Ratio 16:9 
  32. add_image_size( 'catchresponsive-square', 200, 200, true ); // used in Archive Left/Right Ratio 1:1 
  33.  
  34. /** 
  35. * This theme uses wp_nav_menu() in one location. 
  36. */ 
  37. register_nav_menus( array( 
  38. 'primary' => __( 'Primary Menu', 'catch-responsive' ),  
  39. 'secondary' => __( 'Secondary Menu', 'catch-responsive' ),  
  40. ) ); 
  41.  
  42. /** 
  43. * Enable support for Post Formats 
  44. */ 
  45. add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); 
  46.  
  47. /** 
  48. * Setup the WordPress core custom background feature. 
  49. */ 
  50. if ( 'light' == $options['color_scheme'] ) { 
  51. $default_bg_color = $default_bg_color['background_color']; 
  52. $default_bg_image = 'body-bg.jpg'; 
  53. elseif ( 'dark' == $options['color_scheme'] ) { 
  54. $default_bg_color = $default_bg_color['background_color']; 
  55. $default_bg_image = 'body-bg-dark.jpg'; 
  56.  
  57. add_theme_support( 'custom-background', apply_filters( 'catchresponsive_custom_background_args', array( 
  58. 'default-color' => $default_bg_color,  
  59. 'default-image' => get_template_directory_uri() . '/images/' . $default_bg_image,  
  60. ) ) ); 
  61.  
  62. /** 
  63. * This theme styles the visual editor to resemble the theme style,  
  64. * specifically font, colors, icons, and column width. 
  65. */ 
  66. add_editor_style( array( 'css/editor-style.css', catchresponsive_fonts_url() ) ); 
  67.  
  68. /** 
  69. * Setup title support for theme 
  70. * Supported from WordPress version 4.1 onwards 
  71. * More Info: https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ 
  72. */ 
  73. add_theme_support( 'title-tag' ); 
  74.  
  75. //@remove Remove check when WordPress 4.8 is released 
  76. if ( function_exists( 'has_custom_logo' ) ) { 
  77. /** 
  78. * Setup Custom Logo Support for theme 
  79. * Supported from WordPress version 4.5 onwards 
  80. * More Info: https://make.wordpress.org/core/2016/03/10/custom-logo/ 
  81. */ 
  82. add_theme_support( 'custom-logo' ); 
  83.  
  84. /** 
  85. * Setup Infinite Scroll using JetPack if navigation type is set 
  86. */ 
  87. $pagination_type = $options['pagination_type']; 
  88.  
  89. if ( 'infinite-scroll-click' == $pagination_type ) { 
  90. add_theme_support( 'infinite-scroll', array( 
  91. 'type' => 'click',  
  92. 'container' => 'main',  
  93. 'footer' => 'page' 
  94. ) ); 
  95. elseif ( 'infinite-scroll-scroll' == $pagination_type ) { 
  96. //Override infinite scroll disable scroll option 
  97. update_option('infinite_scroll', true); 
  98.  
  99. add_theme_support( 'infinite-scroll', array( 
  100. 'type' => 'scroll',  
  101. 'container' => 'main',  
  102. 'footer' => 'page' 
  103. ) );