How to use scss in wordpress theme?

WordPress core by itself doesn’t support SCSS, even though it is actually used in core development now. The issue with “plugin” type solutions to add such support transparently is that they rely on “ports” of preprocessors. SCSS is not natively developed for PHP, running it in such environment is only possible with third party re–implementations. … Read more

Getting headers property from WP_Theme object

You cannot access the $headers property as it is a private property. Members declared as private may only be accessed by the class that defines the member For that reason, you get NULL when you try to access the property with wp_get_theme()->headers. You need to make use of the magic __get() method of the class … Read more

Multisite: setting theme and options when a new blog is created

The best hook I can find is wpmu_new_blog (line 1086, wp-includes/ms-functions.php, wpmu_create_blog()) – it passes 6 arguments like so; do_action( ‘wpmu_new_blog’, $blog_id, $user_id, $domain, $path, $site_id, $meta ); $meta is an array of initial site options, not to be confused with the options generated by populate_options(). Programatically creating nav menus may prove to be a … Read more

Display custom_background outside wp_head()

custom_background() places the CSS to wp_head() as you mentioned so to get those CSS as if you don’t have wp_head() in your header, these tweaks from the core files would help: function wpse_228588_background_image_css() { $background_styles=””; if ( $bgcolor = get_background_color() ) $background_styles .= ‘background-color: #’ . $bgcolor . ‘;’; $background_image_thumb = get_background_image(); if ( $background_image_thumb … Read more

add image size still doesn’t work even after regenerating thumbnails

There are a couple of things to check here. First, make sure that add_theme_support( ‘post-thumbnails’ ) is loaded before add_image_size( ‘small-thumb’, 60, 60, true ) You can always hook everything through a function to the after_setup_theme hook. I always add these in my theme setup function function wpse_setup_theme() { add_theme_support( ‘post-thumbnails’ ); add_image_size( ‘small-thumb’, 60, … Read more

How to remove “Proudly powered by WordPress” in Twenty Sixteen (2016) theme?

The quick and dirty way would be to either delete the two lines that are ‘resposible’ for the message, or wrap them by comments / comment-them-out. In your theme folder ‘twentysixteen’ look for the theme file ‘footer.php’ Around line 50 look for the following two lines: <span class=”site-title”><a href=”https://wordpress.stackexchange.com/questions/230348/<?php echo esc_url( home_url(“https://wordpress.stackexchange.com/” ) ); ?>” … Read more

Building useful features into your theme

It’s all site-dependent. I have a few core things I build in to any theme’s functions.php though: Change logo on admin page to suit the client’s company Hide WP-Stats smiley graphic Hide WP.me short URLs and replace with their chosen provider Add option for Twitter, Facebook, and Buzz buttons and ability to pull in Tweets … Read more