How to Handle CSS for Multiple Header header.php Files?

That’s not how you use get_theme_file_uri(); You need to specify the directory RELATIVE to your currently active theme’s directory. So for example, if your currently activated theme is rm-acf1, and all of your custom header CSS files are located in the subfolder hdr-styles. This is your theme directory: ./wp-content/rm-acf1/ This is your header styles directory: … Read more

The best way to add stylesheets to WordPress

To load scrpits only in front-end pages use: add_action( ‘wp_enqueue_scripts’, ‘my_front_end_scripts’ ); function my_front_end_scripts(){ wp_enqueue_script(‘script_handle’); wp_enqueue_style(‘style_handle’); } To load scripts only in login use: add_action( ‘login_enqueue_scripts’, ‘my_login_scripts’); function my_login_scripts(){ wp_enqueue_script(‘script_handle’); wp_enqueue_style(‘style_handle’); } To load scripts only in admin use: add_action(‘admin_enqueue_scripts’,’my_admin_scripts’); function my_admin_scripts(){ wp_enqueue_script(‘script_handle’); wp_enqueue_style(‘style_handle’); }

Have WP Theme update from Git Repository

There’re a couple of libraries out there. One of the more well known is from Joey Kudish and hosted on GitHub itself. Basically it does the following: utilizes the GitHub API Adds a callback to the ‘pre_set_site_transient_update_plugins’ filter Adds another callback to the ‘plugins_api’ filter finally utilizes the WP HTTP API and does a wp_remote_get() … Read more

Customize comment list markup

You should use wp_list_comments(), because this will call a Walker class that can handle comment threads: // from wp_list_comments() if ( empty($walker) ) $walker = new Walker_Comment; $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); Walker_Comment handles the markup for the comments. You can pass a custom walker to change it. Example: class Simple_Comment_Walker extends Walker_Comment { function … Read more

Is it possible to display the admin bar while in the Theme Customizer?

Is this what you are looking for? add_filter(‘show_admin_bar’, ‘__return_true’); Codex Btw following code in wp-config.php could help also: define( ‘WP_DEBUG’, true ); // Or false if ( WP_DEBUG ) { define( ‘WP_DEBUG_LOG’, true ); // writes errors down in wp-content/debug.log define( ‘WP_DEBUG_DISPLAY’, true ); // shows errors on screen output, set false to on write … Read more

add_theme_support(‘my-custom-feature’)

You have to register the sidebars in the parent theme just late later enough. Use a hook that runs later, and child themes can register their theme support. Child theme add_action( ‘after_setup_theme’, ‘register_header_sidebar_support’ ); function register_header_sidebar_support() { return add_theme_support( ‘header-sidebar’ ); } Parent theme add_action( ‘wp_loaded’, ‘register_theme_sidebars’ ); function register_theme_sidebars() { if ( current_theme_supports( ‘header-sidebar’ … Read more

How can I stop WP media uploader from creating duplicates of my uploaded images?

I believe the following should stop thumbnails from being created. If you’re wanting to remove some then and unset the $size[{size}]. Following sizes are there “thumbnail”,”medium”,”large”,”post-thumbnail”. add_filter(‘intermediate_image_sizes_advanced’,’stop_thumbs’); function stop_thumbs($sizes){ return array(); }

Context aware widgets. My work in progress

Just like you would from a widget() method: function wse_widget_display_callback($instance) { $show_it = true; if(isset($instance[‘noHome’]) && $instance[‘noHome’] && is_home()) $show_it = false; if(isset($instance[‘noPages’]) && $instance[‘noPages’] && is_page()) $show_it = false; … if($show_it) return $instance; else return false; } I’ve posted here the functions I use to accomplish this, it might be helpful. The form hooks … Read more