Two questions: 1. I have a contact 7 form in my slide

Two questions:
1. I have a contact 7 form in my slide in. Once the submit on the form has been pressed and the successful submit message has appeared I would like slide in to automatically close. I do not see any setting to achieve this.

2. Where is there documentation on the Advance setting "Custom injection hook" - I would like to learn about the options and what they do.

  • Predrag Dubajic

    Hey @Cecil Dorman,

    Hope you're doing well today :slight_smile:

    1. I have a contact 7 form in my slide in. Once the submit on the form has been pressed and the successful submit message has appeared I would like slide in to automatically close. I do not see any setting to achieve this.

    Can you tell me which page is showing the slide in so I can see it in action?
    There is no option in the plugin to close it on submit but we should be able to do it with a bit of jQuery.

    2. Where is there documentation on the Advance setting "Custom injection hook" - I would like to learn about the options and what they do.

    Unfortunately there is no extended documentation on this but you should be able to find more hook info from here:
    http://codex.wordpress.org/Plugin_API

    Best regards,
    Predrag

  • Cecil Dorman

    I now have the slide-in set to show when you are not logged in. I have the Page Rules set to "pages"post pages so you can see it on http://www.avfx.com/meetings-events/ and a variety of other pages.

    I have set the Slide-In Message Override on the Home Page to "Do not Show a Slide-in on this page" but the slide-in is still showing on the home page. How do I make the slide-in stop showing on the Home Page?

  • Cecil Dorman

    I have followed the instructions and granted you access. Slide-in is set to only show if you are logged in with admin privs. We do not want the plug-in showing to public visitors until it is working as we intend. We do not want it to show on the home page ever - it currently is showing on the home page regardless of my efforts to configure settings not to show on the home page. We want visitors to be on a page 6 seconds before it shows and if they close the plug-in we do not want to show up again during their visit. We want to give people a nudge to contact us, but we do not want to annoy them. We want the plug-in to close once they have submitted the contact form 7 that we have embedded in the slide-in.

    I hope you can help us achieve these results.

  • Hoang Ngo

    Hi @Cecil Dorman,

    I hope you are well today.

    For hiding the Slide In on homepage, I couldn't find any hook or filter for that, so we will need to modify the plugin code.
    In the file /slide-in/lib/class_wdsi_public_pages.php line 120, you will see a line of code like this
    if (is_feed()) return true;
    Please update to

    if (is_feed()) return true; // Don't do this for feeds
    		if(is_home()) return true;

    Please note that, any changes to plugin code will be cleared when you update the plugin, so you will need to re-update after update :slight_frown:.

    For hiding the Slide In after form submitted. Please add this code to your theme functions.php or use mu-plugins

    add_action( 'wp_footer', 'hide_slidein_when_submitted' );
    function hide_slidein_when_submitted() {
    	?>
    	<script type="text/javascript">
    		jQuery(function($){
    			var legacy = false;
    			$('#wpcf7-f6586-o1').on('wpcf7:mailsent',function(){
    				slidein_hide('#wdsi-slide_in', 0, true);
    			});
    
    			function slidein_hide(obj, timeout, closed) {
    				var $obj = $(obj);
    				if ( ! timeout ) timeout = 0;
    				if ( closed ) {
    					$obj.data('slidein-closed', '1');
    				}
    				clearTimeout($obj.data('slidein-temp-time-hide'));
    				$obj.data( 'slidein-temp-time-hide', setTimeout(function(){
    					if ( legacy && $obj.data('slidein-running') != '2' ){
    						$obj.data('slidein-running', '2');
    						$obj.removeClass('wdsi-slide-active');
    						if ( $obj.hasClass('wdsi-slide-top') )
    							$obj.stop(true).animate({top: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
    						else if ( $obj.hasClass('wdsi-slide-left') )
    							$obj.stop(true).animate({left: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
    						else if ( $obj.hasClass('wdsi-slide-right') )
    							$obj.stop(true).animate({right: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
    						else if ( $obj.hasClass('wdsi-slide-bottom') )
    							$obj.stop(true).animate({bottom: $obj.data('slidein-pos')}, 1000, legacy_hide_after);
    					}
    					else {
    						$obj.removeClass('wdsi-slide-active');
    					}
    				}, timeout*1000) );
    			}
    			function legacy_hide_after() {
    				$(this).css('visibility', 'hidden');
    				$(this).data('slidein-running', '0');
    			}
    		})
    	</script>
    	<?php
    }

    Best regards,
    Hoang

  • Cecil Dorman

    Hi Hoang,
    Thanks for your response. I am a bit surprised that I would need to add code to your plug-in to have it not show on the home page. When I edit the home page at the bottom of right side (just under featured image) there is a Slide-In Message Override box. I have checked "Do not show a slide-in on this page" but, as you know, the slide-in continues to show on that page. It seems that this is bug in your plug-in the fix to it should be part of the plug-in code and not a "hack" that I need to maintain. Please advise.

    Also you mentioned that I could use mu_plugins instead of adding the supplied code to my functions.php file to get the slide-in to hide after submitting; what is mu-plugin?

  • Predrag Dubajic

    Hi Cecil,

    Hoang provided a quick fix for the issue with home page displaying Slide In even if it's disabled, however there is bug report created for this to fix in future updates.

    Also you mentioned that I could use mu_plugins instead of adding the supplied code to my functions.php file to get the slide-in to hide after submitting; what is mu-plugin?

    mu-plugins is short for "must use plugins" and those are .php files located in your /wp-content/mu-plugins/ folder that are being used on your site without the need to activate them, they are always active.

    If you don't have /wp-content/mu-plugins/ folder on your server then simply create one yourself and inside that folder create new .php file with any name.
    In that file paste the Hoang's code but make sure you have entered php opening tag before the code, so first line of the file should be this <?php, and then below that paste the code provided.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.