Support » Plugin: WP Maintenance Mode » Unable to enqueue css via wpmm_head hook

  • Resolved rizkysyazuli


    I saw some of the other topics here about adding custom css via the wpmm_head hook. but it seems rather odd to hardcode the css like that. So i’m trying to enqueue an external css instead. But it doesn’t seem to work.

    I’m not exactly a WP expert. So pardon my ignorance with hooks, etc. Any help would be appreciated.

    function custom_comingsoon() {
    	wp_register_style( 'comingsoon',
    		get_stylesheet_directory_uri() . '/comingsoon.css',
    	wp_enqueue_style( 'comingsoon' );
    add_action('wpmm_head', 'custom_comingsoon');
    • This topic was modified 6 months, 1 week ago by rizkysyazuli.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author George J


    Hello @rizkysyazuli,

    You should try:

     * Enqueue custom css files
     * @param array $styles
     * @return array
    function wpmm_enqueue_css_files($styles) {
    	$styles[] = get_stylesheet_directory_uri() . '/comingsoon.css?ver=' . wp_get_theme()->get('Version');
    	return $styles;
    add_filter('wpmm_styles', 'wpmm_enqueue_css_files', 10, 1);

    Ah, i see. We’re injecting it into the $styles array on the header.
    Well, you learn something new everyday 🙂 Thx. it works now btw.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unable to enqueue css via wpmm_head hook’ is closed to new replies.