Archived topic
GPP / child theme / stylesheets blocked
3 replies · Started by Jan on October 18, 2022
Hi there,
I'm facing a similar issue as described here. However I'm not able to figure out why certain GP stylesheets are being blocked.
Together with the Developer of the plugin (MemberPress) we made minor progress and managed to enqueue one GP stylesheet. We added the following to the function.php
// MP courses - Enque accordion CSS on lesson pages
add_action('mpcs_courses_footer', function() { ?>
<script>
let toggleBtn = document.querySelector('#toggle-btn');
let targetElement = document.querySelector('#toggled-container');
if(toggleBtn) {
toggleBtn.addEventListener('click', function(e) {
e.preventDefault();
targetElement.classList.toggle('show-content');
});
}
</script>
<?php
});
// MP courses - Enqueue GP stylesheet
add_action( 'wp_enqueue_scripts', 'mepr_courses_enqueues', 110 );
function mepr_courses_enqueues() {
if( is_singular( array( 'mpcs-lesson', 'mpcs-course' ) ) ) {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$dir_uri = get_template_directory_uri();
wp_register_style('generate-style-mpcs', get_template_directory_uri() . "/assets/css/main{$suffix}.css");
wp_enqueue_style( 'generate-style-mpcs', get_template_directory_uri() . "/assets/css/main{$suffix}.css" );
}
}
add_filter('mpcs_classroom_style_handles',
function($allowed_handles){
$allowed_handles[] = 'generate-style-mpcs';
return $allowed_handles;
}
);
Any thoughts as to what might be blocking the remaining GP stylesheets? (--> side by side comparison between legacy and new site)
Thanks,
Jan
Hi there,
so the missing GP stylesheets are:
navigation-branding-flex.min.css
offside.min.css
Neither of which are actually required on that URL you provided as the page isn't loading the GP Site header or Off canvas panel. If i visit a different page where those elements do exist, then i see the styles are loaded.
So what is the actual issue ?
Hi David,
thanks for looking into this.
When looking at the Here is a set of issues that I see:
- Typography of the child theme (Montserrat font) is not being loaded
- Color Schema of the child theme (blue colored headlines) is missing
- Padding of the title headline is missing
- The "Transcript button" (Accordion) has a different style and is not working
Not if we are looking only at one issue here. The accordion issue seems similar to what we troubleshooted here.
Just to be on the safe side, I checked the elements hook for the accordion once more. It is active and has the same configuration as the one on the legacy site.
Hope that helps.
Best,
Jan
If i can refer to Toms reply here:
https://generatepress.com/forums/topic/gpp-child-theme-stylesheet-overwrite/#post-1861891
This is what i find confusing.
GP uses the standard WP method for loading scripts and stylesheets.
And as Tom says. as long as the wp_head() exists then those scripts should load.
As a side note, i notice that those Memberpress pages seem to have no wp_footer. So Memberpress are making decisions that are non-standard.
So what are they doing that would interfere with the wp_enqueue_scripts hook ?