handling duplicate ids in login and registration forms with javascript and removing...
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 24 Jul 2018 17:42:59 +0000 (13:42 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 24 Jul 2018 17:42:59 +0000 (13:42 -0400)
header.php
js/custom.js

index dad750f..44a94d7 100644 (file)
 
 <?php wp_head(); ?>
 </head>
+
+<?php 
+    global $post; 
+    $page = strtolower(str_replace(" ","-",$post->post_title));
+    $type =strtolower(str_replace(" ","-",$post->post_type));
+?>
 <script>
+    window.page             = '<?php echo $page; ?>';
     window.icon_url         = '<?php echo get_template_directory_uri(); ?>';
     window.getting_started  = '<?php echo get_permalink(414); ?>';
     window.journey          = '<?php echo get_permalink(363); ?>';
     window.progress         = '<?php echo get_permalink(365); ?>';
 </script>
-<?php 
-    global $post; 
-    $page = strtolower(str_replace(" ","-",$post->post_title));
-    $type =strtolower(str_replace(" ","-",$post->post_type));
-?>
 <body <?php body_class(); ?> data-page="<?php echo $page; ?>">
-<div id="modal-login">
-    <?php echo do_shortcode('[glm-login-form]'); ?>
-    <a class="registration-link" href="<?php echo get_permalink(367); ?>"> Sign Up </a>
-</div>
+<?php //if($page !== "registration"){ ?>
+    <div id="modal-login">
+        <?php echo do_shortcode('[glm-login-form]'); ?>
+        <a class="registration-link" href="<?php echo get_permalink(367); ?>"> Sign Up </a>
+    </div>
+<?php //} ?>
 
 <div id="page" class="hfeed site">
        <header id="masthead" class="<?php echo of_get_option('header_layout'); ?> <?php echo $page; ?> <?php echo $type; ?>">
index 35b6a8d..4a670d5 100644 (file)
@@ -151,6 +151,40 @@ jQuery(document).ready(function($){
            
     }
     $('.cmvl-title').insertAfter('.cmvl-navbar');
+
+    if(window.page === 'registration'){
+
+        $("#modal-login").find('input').each(function(){
+            if( $(this)[0].id ){
+                $(this).attr('data-id', $(this).attr('id'));
+                $(this).removeAttr('id');
+            }
+        })
+
+        $('.login-modal').on("click", function(){
+            $("#modal-login").find('input').each(function(){
+                if( !$(this)[0].id ){
+                    $(this).attr('data-id', $(this).attr('id'));
+                    $(this).attr('id', $(this).data('id'));
+                }else{
+                    $(this).attr('data-id', $(this).attr('id'));
+                    $(this).removeAttr('id');
+                }
+            })
+
+            $('#registerform').find('input').each(function(){
+                if( $(this)[0].id ){
+                    $(this).attr('data-id', $(this).attr('id'));
+                    $(this).removeAttr('id');
+                }else{
+                    $(this).attr('data-id', $(this).attr('id'));
+                    $(this).attr('id', $(this).data('id'));
+                }
+            })
+        })
+    }
+
+
     if( $(window).width() > 1000){
         $('.login-modal').on("click", function(){
             $("#modal-login").toggleClass("show-login");
@@ -160,6 +194,11 @@ jQuery(document).ready(function($){
     let course_cards = $('.cmvl-courses-list-shortcode').find('tbody').children('tr');
     course_cards.each(function(){
         let link = $(this).find('a').attr('href');
+
+        // remove the get started card from the course list
+        if($(this).find('a').text() === 'Get Started'){
+            $(this).remove();
+        }
         $(this).append( $('<img>', {
             "class": "view-course-icon",
             "src": icon_url
@@ -182,7 +221,12 @@ jQuery(document).ready(function($){
     login_section.on("click", function(){
         $("#modal-login").toggleClass("show-login");
     })
-
+    $('.cmdur-success').find('a').on("click", function(e){
+        e.preventDefault();
+        return false;
+    })
+    $('.cmdur-success').children('a').addClass("login-modal");
+    
     // getting_started.append( $('<div />',{
     //     class: 'contact-form',
     //     text: `Invite Superior Hospitality Partners to your community to see if Hospitality Mentality 360 will be beneficial for you and your visitors.`