Skip to Content
Menu

theme_setup()

Create additional theme support settings including image sizes and headers.

PHP April 27, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Functions.php on line 137.

    No Hooks

    This function does not have any filters or actions available. Request one?
    PHP
            public function theme_setup(){
                //Additions
                add_theme_support('post-thumbnails');
                add_theme_support('custom-logo'); //Custom logo support.
                add_theme_support('title-tag'); //Title tag support allows WordPress core to create the <title> tag.
                //add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption'));
                add_theme_support('automatic-feed-links'); //Add default posts and comments RSS feed links to head
    
                add_theme_support('responsive-embeds');
                add_theme_support('wp-block-styles');
                add_theme_support('align-wide'); //Wide image alignment
    
                //Custom color palette to Gutenberg editor
                add_theme_support('editor-color-palette', array(
                    array(
                        'name' => 'Primary',
                        'slug' => 'primary',
                        'color' => get_theme_mod('nebula_primary_color', $this->get_color('$primary_color')),
                    ),
                    array(
                        'name' => 'Secondary',
                        'slug' => 'secondary',
                        'color' => get_theme_mod('nebula_secondary_color', $this->get_color('$secondary_color')),
                    )
                ));
    
                add_post_type_support('page', 'excerpt'); //Allow pages to have excerpts too
    
                //Removals
                remove_theme_support('custom-background');
                remove_theme_support('custom-header');
    
                //Remove capital P core function
                remove_filter('the_title', 'capital_P_dangit', 11);
                remove_filter('the_content', 'capital_P_dangit', 11);
                remove_filter('comment_text', 'capital_P_dangit', 31);
    
                //Head information
                remove_action('wp_head', 'rsd_link'); //Remove the link to the Really Simple Discovery service endpoint and EditURI link (third-party editing APIs)
                remove_action('wp_head', 'wp_generator'); //Removes the WordPress XHTML Generator meta tag and WP version
                remove_action('wp_head', 'wp_shortlink_wp_head'); //Removes the shortlink tag in the head
                remove_action('wp_head', 'feed_links', 2); //Remove the links to the general feeds: Post and Comment Feed
                remove_action('wp_head', 'wlwmanifest_link'); //Remove the link to the Windows Live Writer manifest file
                remove_action('wp_head', 'feed_links_extra', 3); //Remove the links to the extra feeds such as category feeds
                remove_action('wp_head', 'index_rel_link'); //Remove index link (deprecated?)
                remove_action('wp_head', 'start_post_rel_link', 10, 0); //Remove start link
                remove_action('wp_head', 'parent_post_rel_link', 10, 0); //Remove previous link
                remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); //Remove relational links for the posts adjacent to the current post
    
                //Add new image sizes (Given human-readible names in another function below)
                //"max_size" custom image size is defined in /libs/Optimization.php
                add_image_size('square', 512, 512, 1);
                add_image_size('open_graph_large', 1200, 630, 1);
                add_image_size('open_graph_small', 600, 315, 1);
                add_image_size('twitter_large', 280, 150, 1);
                add_image_size('twitter_small', 200, 200, 1);
            }
    

    Override

    This function can not be short-circuited with an override filter. Request one?