[Resolved] Theme's CSS drops out on one particular page if user is logged out

Home Forums Support [Resolved] Theme's CSS drops out on one particular page if user is logged out

Home Forums Support Theme's CSS drops out on one particular page if user is logged out

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #648212


    First time to come across this tricky situation though: the theme’s entire CSS gets dumped out on one page if a user is not logged in. It is the “Business Member Login” page in the navigation (I’ve notated URL of site in the box for admins here on the forum). If a user is logged in, the theme’s CSS is fine for that page.

    Note that this is tied to a directory plugin which I’ve keep activated to troubleshoot, as it is the purpose of the site. If I deactivate the plugin, the CSS stays with GeneratePress.

    But when the plugin is activated and I switch to other themes, the CSS also stays. It only drops with GeneratePress.

    I have Premium and a child theme installed, but the issue happens the moment I activate GP.

    Many thanks in advance!

    GeneratePress 2.1.3
    GP Premium 1.7
    Lead Developer
    Lead Developer

    Hi there,

    Glad you’re enjoying the theme!

    I’m not too sure what I’m look for on that page. Any chance you can share a screenshot of what it should look like?


    Thanks Tom!

    How other pages display when users are logged out (or in), you see elements set up by GP (paper texture, fonts, colours). https://drive.google.com/file/d/1QjFDN1ZyAGncIOXlQmI_ynmBnrlh0UVN/view?usp=sharing

    How that one page displays when users are logged out (no elements). Note that the same plugin is in use on both pages, but for some reason, GP’s CSS is being dumped. Everything displays fine if you are logged in. https://drive.google.com/file/d/1Pfc9lwyUmUxIvlUWuVtGCGYT_Zd1-ZcU/view?usp=sharing

    Lead Developer
    Lead Developer

    Here’s what I’m seeing as a logged out user: http://prntscr.com/kizn8m

    Perhaps there’s some sort of caching issue going on?


    Hi Tom,

    That page displays correctly. But click “Business Member Login” (second screenshot I sent) and you’ll see that the page drops CSS.

    There isn’t a caching plugin installed.


    Lead Developer
    Lead Developer

    Something is preventing the dynamic CSS from printing to the page.

    Any chance you can deactivate your other plugins to rule out a plugin conflict?


    All others are deactivated, except GP Premium and the plugin (made sure to turn them off while I awaited your feedback). There is no caching plugin. There is no conflict with other themes, just GP.

    My conversation with the listing plugin developer was the usual: deactivate all other plugins, revert back to TwentySeventeen theme. The only time the CSS gets dumped is when I switch to GP, no matter what plugins are or are not activated. Once we narrowed it down to GP, the plugin developer directed me to you.

    Do you know of a solution to inject that missing dynamic CSS for this one page? I would be completely satisfied with such a workaround πŸ™‚

    Lead Developer
    Lead Developer

    It makes sense that it only happens with GP, as GP adds dynamic CSS to the <head>, whereas something like TwentySeventeen doesn’t.

    Here’s an example of the function we use to add it:

    add_action( 'wp_enqueue_scripts', 'generate_enqueue_dynamic_css', 50 );
     * Enqueue our dynamic CSS.
     * @since 2.0
    function generate_enqueue_dynamic_css() {
    	$css = '.example {color: red;}';
    	wp_add_inline_style( 'generate-style', $css );

    So for some reason, that plugin is preventing the above from happening.

    Maybe if you show the developer this they’ll have an idea?


    Thanks Tom, I will see what they have to say about this. Fingers crossed, and thanks for the stellar customer service!

    Have you come across any plugins or wording I can use to research how I might be able to pull that CSS and inline it in the event I come up against a wall?

    Much appreciated!

    Lead Developer
    Lead Developer

    It really depends. The best way to do it is how we’re doing it, so we’d need to know why the plugin is preventing that from working to find an alternative that will work.


    Thanks Tom! This was the dev’s reply:

    “Yes, it is quite clear that the theme adds inline CSS code. But we have to find out why it does not include this required CSS code when we are using one specific shortcode on a page. This is the clue.

    This is just an example code to test they gave you. You can place it into functions.php of the theme and look if it will appear in the source code of a page. I tested it with our plugin on the dashboard page and it appears.”

    I don’t think we’re going to find a direct solution, so found a workaround for myself, which I’ll share here in case anyone else with GP purchases “Web 2.0 Directory” plugin and finds the CSS gets dumped whenever a page has the [webdirectory-dashboard] shortcode for logged out users:

    1) Installed “Theme My Login” to pull usual WP login content in-page
    2) Set Theme My Login to redirect existing members to page with [webdirectory-dashboard]
    3) Direct new listing members to the submission URL (note that the plugin wants to do this over-the-top submission page. If you want to get straight to user-side listing creation, just hover over the ‘submit’ button and take note of the URL and use that.

    GP is hands down my fav theme. I recommend it to everyone and this thread is a testament to your willingness to work with us, and I hope my little thread can be of help to others, as I’ve accomplished SO MUCH by going through this forum.

    Beer time! πŸ™‚

    Lead Developer
    Lead Developer

    I’m glad you found a workaround! Sorry I couldn’t be more helpful.

    Really appreciate you posting your solution – thank you! πŸ™‚

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.