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

How to: get main plugin/theme file?

You can get theme’s main file using following: $theme_info_file = trailingslashit( get_template_directory() ) . ‘style.css’; To get the plugin’s main file you need to know the plugin name. And then you can use following function: function get_plugin_file( $plugin_name ) { require_once( ABSPATH . ‘/wp-admin/includes/plugin.php’ ); $plugins = get_plugins(); foreach( $plugins as $plugin_file => $plugin_info ) … 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