Anjum
asked 10 years ago

I really love your plugin, but I can’t see the modal contact popup i can see here. How can I fix this for my website.

5 Answers
well wisher
answered 10 years ago

Hi anjum the modal you see here is not the inbuilt feature of the plugin itself you can use wp modal plugin to do the same stuff with little modifications !!!

Guru
replied 10 years ago

Sorry for the daft question, modal plugins are nice but how would you initiate modal and how would you setup the cookie to work with the modal window if its being created by the plugin?

well wisher
replied 10 years ago

classe are available for launching modal on click of whatever the link you want to like for example: <a href="/wp-login.php" class="the modal class comes here">Log In</a>, plus cookies in this kinda pop up stuff is used to prevent the window from launching repeatedly each time user reloads the page so that it only pop up only the first time a user visits the site like the terms and conditions thing on the design wall site,but in the case of logins and register the user have to click the link to launch the modal so using cookies doesn't makes sense and thus not needed here i suppose !!!

Guru
replied 10 years ago

I guess you miss-understood what the question asker wants. Can you provide an example of the cookie function controlling the display of the modal window as is on the first time when someone asks a question on this site.

Actually I am also interested to know the solution to this. I would want users to be able to see the best practices in a modal window which only is visible for the first time, or lets say it will not display before the next 3 months.

well wisher
replied 10 years ago

Ok guru the easiest example i think may be this demo of the cool plugin from designwall itself http://demo.designwall.com/dw-popup-card/ just open it once and then close it and the reload the page did the card loaded again no isnt it,thats because its setting up a cookie in your browser now just clean the cookie from your browser and reload it you will find it shows up again.

well wisher
replied 10 years ago

the function used is setcookie() and the syntax is setcookie(name,value,expire,path,domain,secure)

Guru
replied 10 years ago

Thanks for the explanation. I tried to answer this question by taking the source code from dw page and try to make it work. I couldn’t make it work.

well wisher
answered 10 years ago

To set a cookie for 20 min you can do

this

setcookie(“terms_already_seen”, true, time() + (60 * 20));

// 60 seconds ( 1 minute) * 20 = 20 minutes to check it again if its already set do this:

if(isset($_COOKIE[‘terms_already_seen’]) && $_COOKIE[‘terms_already_seen’] == true){     
// IS SET and has a true value do your modal stuff here
}

In this code the user wont see the modal for next 20 minutes after he closes it once you can set it to large no so that the terms is seen after a very long time as setting the expiry date of cookies is  a good practice i would not suggest to completely skip the expiry date of the cookie i hope that helps @guru  @anjum

Guru
answered 10 years ago

Ok, here is the source code for the dw page, how do you make it work on any webpage. I can’t seem to make it work:

<div data-backdrop=”static” class=”modal hide fade in” id=”dw-skip-ads” style=”display: block;” aria-hidden=”false”>
<div class=”modal-header”>
<button aria-hidden=”true” data-dismiss=”modal” class=”close hide” type=”button” style=”display: inline-block;”>×</button>
<h3 style=”text-transform: none;”>For better and faster support, please read our golden rules first </h3>
</div>
<div class=”modal-body”>
<ol>
<li><strong>Guideline</strong>: make sure you have checked our <a href=”http://designwall.com/designwall/guide”>documentation</a&gt; as it could have had covered your issue</li>
<li><strong>Search</strong>: try to search for the issue as someone might have had posted a similar issue and the answer is already out there</li>
<li><strong>Ask</strong>: write a brief question title, informative question description and provide as much details as possible</li>
</ol>
</div>
</div>
<script type=”text/javascript”>
jQuery(document).ready(function($) {
var path = “http://designwall.com/ask-question/&#8221;;
var cookie = $.cookie(‘dwqa_ads_once_time’);
if( ! cookie ) {
$(‘#dw-skip-ads’).modal(‘show’);
$.cookie(‘dwqa_ads_once_time’, true, { expires: 210, path: path });
var time = 5;
var loop = setInterval(function(){
$(‘#dw-skip-ads .modal-header h3 .countdown’).text( ‘(‘ + time– +’)’);
if( time < 0 ) {
clearInterval(loop);
$(‘#dw-skip-ads .modal-header h3 .countdown’).remove();
$(‘#dw-skip-ads .modal-header .close’).show();
return false;
}
},1000);
}
});
</script>

Guru
replied 10 years ago

Dear @wellwisher & the Admins can you please look into this and provide any help 🙂

well wisher
answered 10 years ago

Hi you may have to read this http://getbootstrap.com/javascript/#modals

well wisher
answered 10 years ago

But i would suggest doing the thing with php just add a division set it to hidden using css now this divsion is one with the modal ,now add the class” modal” to the ask question link (hard code it by editing plugin code) now add the above cookie logic in the ask question page as a php script and the modal will display only if it dont find any cookie 

Jackie Lord
answered 10 years ago

Hi @micki !
Glad to know that you liked our feature.
I just share those codes into Github. Please copy those code to functions.php file in your theme folder: https://gist.github.com/j4ckielord/9482836
You also need Bootstrap Modal Script: http://getbootstrap.com/javascript/#modals and jQuery Cookie script: https://github.com/carhartl/jquery-cookie!
Hope this helps!
Jackie

Guru
replied 10 years ago

Works like a charm Jackie 😀

great solution.

Jackie Lord
replied 10 years ago

I’m going to write this feature as a plugin. It will be free!

Guru
replied 10 years ago

ooh thats even better. Nice One 🙂

Powered by DW Question & Answer Pro