Get URL of a specific file
See Determining Plugin and Content Directories. plugins_url( ‘filename’, __FILE__ ); … returns the full URI to the file in your plugin. For themes you use: get_stylesheet_directory_uri() . ‘/path/to/file’;
See Determining Plugin and Content Directories. plugins_url( ‘filename’, __FILE__ ); … returns the full URI to the file in your plugin. For themes you use: get_stylesheet_directory_uri() . ‘/path/to/file’;
The following filter works in Multisite in the following screens: /wp-admin/network/themes.php /wp-admin/network/site-themes.php?id=1 (individual sites allowed themes) add_filter( ‘all_themes’, ‘wpse_55081_remove_themes_ms’ ); function wpse_55081_remove_themes_ms($themes) { unset($themes[‘Twenty Ten’], $themes[‘Twenty Eleven’]); return $themes; } For the regular theme selector in a single site or sub-site of a network /wp-admin/themes.php (Appearance -> Themes), looks like there’s no hook… Manipulate list … Read more
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
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
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
If you only need the current theme name, you can use get_current_theme().
Think of WordPress execution as a series of rungs on a ladder: WordPress climbs one rung, then the next, then the next, and so on. Think of action hooks as the rungs themselves. Here is a (slightly abbreviated, I think) list of those actions, or “rungs” executed during a typical WordPress request. Thus, an add_action() … Read more
Using after_switch_theme will activate the theme (which is fine as we want to run the check within the context of the new theme). If the dependencies are not fulfilled ($missing_dependencies = true;) we’re instantly switching back to the theme previously used (passed via after_switch_theme and $oldtheme). add_action( ‘after_switch_theme’, ‘check_theme_dependencies’, 10, 2 ); function check_theme_dependencies( $oldtheme_name, … Read more
Take a look at How to create a Child Theme and you’ll see that: the previous method to enqueue the parent stylesheet was to import the parent theme stylesheet using @import: this is no longer best practice. The correct method of enqueuing the parent theme stylesheet is to add a wp_enqueue_scripts action and use wp_enqueue_style() … Read more
You can merge palettes $existing = get_theme_support( ‘editor-color-palette’ ); $new = array_merge( $existing[0], array( array( ‘name’ => __( ‘Strong magenta’, ‘themeLangDomain’ ), ‘slug’ => ‘strong-magenta’, ‘color’ => ‘#a156b4’, ), array( ‘name’ => __( ‘Light grayish magenta’, ‘themeLangDomain’ ), ‘slug’ => ‘light-grayish-magenta’, ‘color’ => ‘#d0a5db’, ), )); add_theme_support( ‘editor-color-palette’, $new);