Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
robertuniqid / fix-4-per-row.css
Created March 11, 2018 09:12
WPEP 4 Per Row CSS Conflict instructions, increment & decrement values until it works. This is not the best solution, but the easiest.
.wpep-wrapper>.wpep-container .course-grid-container [data-items-per-row="4"] .course-grid-item, .wpep-wrapper>.wpep-container .course-grid-container [data-items-per-row="4"] .ebook-grid-item, .wpep-wrapper>.wpep-container .course-grid-container [data-items-per-row="4"] .offer-grid-item {
width: 22.8% !important;
}
@media (max-width: 992px) {
.wpep-wrapper>.wpep-container .course-grid-container [data-items-per-row="4"] .course-grid-item, .wpep-wrapper>.wpep-container .course-grid-container [data-items-per-row="4"] .ebook-grid-item, .wpep-wrapper>.wpep-container .course-grid-container [data-items-per-row="4"] .offer-grid-item {
width: 31.0% !important;
}
}
@media (max-width: 768px) {
@robertuniqid
robertuniqid / wpep-box-sizing-fix.css
Created March 11, 2018 09:23
WPEP Box sizing fix until 1.11
.wpep-wrapper div {
-ms-box-sizing: border-box !important;
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
box-sizing: border-box !important;
}
@robertuniqid
robertuniqid / wpep-shadowed-box.css
Created April 14, 2018 20:08
WPEP Shadowed Box Enforcement
.wpep-shadowed-box{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"!important;filter:alpha(opacity=70)!important;opacity:0.7!important}
.wpep-shadowed-box.wpep-hidden{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"!important;filter:alpha(opacity=0)!important;opacity:0!important}
<?php
$show_content = true;
if( isset( $previous_lesson_id ) && intval( $previous_lesson_id ) != 0 && is_user_logged_in() ) {
global $wpdb;
$sql = 'SELECT lc.*
FROM ' . $wpdb->prefix . 'wpep_section_lesson_completed lc
WHERE lc.lesson_id = ' . $previous_lesson_id . '
@robertuniqid
robertuniqid / example.php
Created May 8, 2018 12:30
WPEP Redirect Student to Current Lesson from a course.
<script type="text/javascript">
jQuery(document).ready(function() {
setTimeout( function() {
window.location = '<?php echo wpep_course_lesson_permalink( wpep_controller()->userActivity->get_delivered_course_lesson_id( $course_id, get_current_user_id() ), $course_id ); ?>';
}, 3000 );
});
</script>
<?php
add_filter( "pre_get_posts", 'example_code_supress_filter', 100 );
function example_code_supress_filter( $query ) {
$query->set( 'suppress_filters', false );
return $query;
}
@robertuniqid
robertuniqid / example.php
Created July 31, 2018 16:56
Send an Email Notification when an Assessment has a Status Change.
<?php
add_action( 'wpep_user_set_assessment_data', function( $key, $value, $post_id, $question_id, $question_answer_id, $user_id ) {
if( $key != WPEP_USER_ASSESSMENT_STATUS )
return;
$student_name = wpep_content_user_profile_format_name( $user_id );
$status_label = wpep_get_setting_translated( 'assessment-status-label-' . $value );
$admin_url = wpep_admin_url_statistics( [
'tab' => 'assessments',
@robertuniqid
robertuniqid / example.php
Last active August 12, 2018 14:58
Example on how the Gutenberg the_content filter for wpautop could've prevented breaking plugins that removed wpautop.
<?php
// How it is :
function gutenberg_wpautop( $content ) {
if ( gutenberg_content_has_blocks( $content ) ) {
return $content;
}
return wpautop( $content );
@robertuniqid
robertuniqid / example.php
Created September 11, 2018 18:32
WPEP Order Index Page by Publish Date
<?php
// Please ensure that WPEP -> Settings -> Index Page -> Grid Options -> Enforce Ordering Option is Disabled.
add_filter( 'wpep_primary_content_list_args', function($args) {
$args = [
'order' => 'DESC',
'orderby' => 'date',
];
@robertuniqid
robertuniqid / custom-link.php
Created September 20, 2018 11:56
Redirect To Homepage / Custom Link After Password Reset