-
jQuery UI Datepicker in dynamic form
I have a dynamic form with a repeatable field. The script for the repeatable field is this one // Insert new table row $('#wprm_add_date_to_exclude').on('click', function() { var row = $('#wprm_dates_to_exclude tr:last'); var clone = row.clone(); var count = row.parent().find( 'tr' ).length; clone.find( 'td input' ).val( '' ); clone.find( 'input, select' ).each(function() { var name = $( this ).attr( 'name' ); name = name.replace( /\[(\d+)\]/, '[' + parseInt( count ) + ']'); $( this ).attr( 'name', name ).attr( 'id', name ); }); clone.insertAfter( row ); return false; }); // Remove table row $('body').on('click', '#wprm_dates_to_exclude .wprm_remove_date_to_exclude', function() { if( confirm( wprm_admin_js_settings.delete_table ) ) $(this).closest('tr').remove(); return false; }); But i can't figure out how to dynamically add the datepicker to the newly created field, i've googled it and found many articles about it, but none of the solutions worked, any idea how to fix this issue? Thank you.
-
Can't get google maps markers to show up
I have 2 markers with the same coordinates, so i'm trying to approximate their coordinates so that they both display. I have the following code, that does not seem to work. Strange thing is that into the browser console i do not even see any error. Nothing, but no marker displays at all. for (var i = 0; i < locations.length; i++) { var item = locations[i]; var a = 0.01; var newLat = item[1] + -.00004 * Math.cos((+a*i) / 180 * Math.PI); // x var newLng = item[2] + -.00004 * Math.sin((+a*i) / 180 * Math.PI); // Y var finalLatLng = new google.maps.LatLng(newLat,newLng); var marker = new google.maps.Marker({ position: finalLatLng, map: map, title: item[0], link: item[3], address: item[5], phone: item[6], mobile: item[7], website: item[8], image: item[9], readmore: item[10], icon: item[11], type: item[12], infoWindowIndex: i }); marker.category = locations[i][12]; gmarkers.push(marker); google.maps.event.addListener(marker, 'click', function (event) { var ua = navigator.userAgent; var event = (ua.match(/iPad/i)) ? "touchstart" : "click"; // prevent ghost clicks on ipad infoBox.setContent('<div class="marker-wrapper animated fadeInDown"><div class="marker-title"> <a href="'+ this.link +'">'+ this.title +'</a> </div><div class="marker-content"><div class="two_third popup-content"><ul>'+ this.address +''+ this.phone +''+ this.mobile +''+ this.website +'</ul></div>'+ this.image +''+ this.readmore +'<div class="clearboth"></div> <div class="close" onClick=\'javascript:infoBox.close();\'><span class="icon-cancel"></span></div></div><span class="icon-down-dir"></span></div>'); infoBox.open(map, this); map.setCenter(this.position); map.panTo(this.position); }); // end click even } //end for I have also tried editing the code this way by passing a new var to the position parameter and i get the errorUncaught InvalidValueError: setPosition: not a LatLng or LatLngLiteral: not an Object Any clue how to fix this issue? Spent the whole morning trying but i haven't found a solution for (var i = 0; i < locations.length; i++) { var item = locations[i]; var myLatLng = new google.maps.LatLng(item[1], item[2] ); var marker = new google.maps.Marker({ position: myLatLng + (Math.random() -.5) / 1500, map: map, title: item[0], link: item[3], address: item[5], phone: item[6], mobile: item[7], website: item[8], image: item[9], readmore: item[10], icon: item[11], type: item[12], infoWindowIndex: i }); marker.category = locations[i][12]; gmarkers.push(marker); google.maps.event.addListener(marker, 'click', function (event) { var ua = navigator.userAgent; var event = (ua.match(/iPad/i)) ? "touchstart" : "click"; // prevent ghost clicks on ipad infoBox.setContent('<div class="marker-wrapper animated fadeInDown"><div class="marker-title"> <a href="'+ this.link +'">'+ this.title +'</a> </div><div class="marker-content"><div class="two_third popup-content"><ul>'+ this.address +''+ this.phone +''+ this.mobile +''+ this.website +'</ul></div>'+ this.image +''+ this.readmore +'<div class="clearboth"></div> <div class="close" onClick=\'javascript:infoBox.close();\'><span class="icon-cancel"></span></div></div><span class="icon-down-dir"></span></div>'); infoBox.open(map, this); map.setCenter(this.position); map.panTo(this.position); }); // end click even } //end for Any help would be appreciated. Thank you.
-
PHP generate array through foreach and merge to existing one
Hello, I've got a problem and i've been trying to think how to fix it however i can't understand how to achieve it. I have an array stored into a variable called $default_fields = array (); I need to generate a new array, return it and store it into a variable so then i can use array_merge or array_push to merge to 2 array into one. All of this need to be done through a foreach loop , how can i achieve such thing ? Thanks
-
Ajax form submit ?
Hi, thanks for your reply i tried your suggestion but unfortunately it doesn't work, the submit buttons changes to "wait..." but nothing happens when i leave fields empty or even when i fill them Here's the code from the source of the page form: <form id="contact-form-contact-form" class="contact-form row" method="post" action="" enctype="multipart/form-data"> <div class="usermessagea"></div> <fieldset> <ul> <li class="text-field 3"> <label for="name-contact-form"> <span class="mainlabel">Name</span> </label> <div class="input-prepend"><input type="text" name="bt_contact[name]" id="name-contact-form" class="required" value="" /></div> <div class="msg-error"></div><div class="clear"></div> </li> <li class="text-field 3"> <label for="email-contact-form"> <span class="mainlabel">Email</span> </label> <div class="input-prepend"><input type="text" name="bt_contact[email]" id="email-contact-form" class="required email-validate" value="" /></div> <div class="msg-error"></div><div class="clear"></div> </li> <li class="text-field 3"> <label for="phone-contact-form"> <span class="mainlabel">Phone</span> </label> <div class="input-prepend"><input type="text" name="bt_contact[phone]" id="phone-contact-form" class="" value="" /></div> <div class="msg-error"></div><div class="clear"></div> </li> <li class="textarea-field 9"> <label for="message-contact-form"> <span class="mainlabel">Message</span> </label> <div class="input-prepend"><textarea name="bt_contact[message]" id="message-contact-form" rows="8" cols="30" class="required"></textarea></div> <div class="msg-error"></div><div class="clear"></div> </li> <li class="submit-button span9"> <input type="text" name="bt_bot" id="bt_bot" /> <input type="hidden" name="bt_action" value="sendemail" id="bt_action" /> <input type="hidden" name="bt_referer" value="http://localhost/my-website/?page_id=2" /> <input type="hidden" name="id_form" value="11" /> <input type="submit" name="bt_sendemail" value="Send Message" class="sendmail alignleft" /> <div class="clear"></div> </li> </ul> </fieldset> </form> Other codes associated to the form <script type="text/javascript"> var messages_form_11 = { name: "Insert the name", email: "Insert a valid email", phone: "", message: "Insert a message" }; </script> <script type='text/javascript'> /* <![CDATA[ */ var contactForm = {"wait":"wait..."}; /* ]]> */ </script> The page also loads the jquery.placeholder plugin, hope this helps? Any idea why it doesn't work ? Thank you
-
Ajax form submit ?
Hi guys, I have the following script which basically is "attached" to a contact form, however when i submit the form it refreshes the page. How can i make that it submits the form via ajax showing validation without refreshing the page ? Thank you jQuery(document).ready(function($){ // contact var error = true; function addLoading( e ) { $(e).val( '{wait}'.replace('{wait}', contactForm.wait) ).attr('disabled', true); } function removeLoading( e ) { $(e).val(value_submit).attr('disabled', false); } function addError(msg, e, effect) { error = true; $(e).removeClass('icon success'); $(e).addClass('icon error'); $(e).parents('li').find('.msg-error').text(msg); if( effect !== undefined && effect == true ) { $(e).css({position:'relative'}).animate({left:-10}, 100).animate({left:10}, 100).animate({left:-5}, 100).animate({left:5}, 100).animate({left:0}, 100); } } function addSuccess(e) { $(e).addClass('icon success'); } function removeError(e) { error = false; $(e).parents('li').find('.msg-error').text(''); $(e).removeClass('icon error'); $(e).removeClass( 'formRed') addSuccess(e); } $('.contact-form .required').blur(function(){ var name = $(this).attr('name').match( /(.*)\[(.*)\]/ ); var id_form = $(this).parents('.contact-form').find('input[name="id_form"]').val(); jQuery.globalEval( 'var msg = messages_form_'+id_form+'.'+name[2] ); if( $(this).val() == '' ) addError( msg, this ); else removeError(this); }); $('.contact-form .email-validate').blur(function(){ var expr = /^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/; var name = $(this).attr('name').match( /(.*)\[(.*)\]/ ); var id_form = $(this).parents('.contact-form').find('input[name="id_form"]').val(); jQuery.globalEval( 'var msg = messages_form_'+id_form+'.'+name[2] ); if( ( $(this).val() != '' && !expr.test( $(this).val() ) ) || ( $(this).is('.required') && $(this).val() == '' ) ) addError( msg, this ); else removeError(this); }); $('.contact-form').submit(function(){ addLoading( '.contact-form input:submit' ); }); $('input[placeholder], textarea[placeholder]').placeholder(); });
-
Insert data in mysql via form
I've created a menu page inside the wordpress dashboard with a form with only a submit button, mysql data that needs to be addeded to the wordpress database. EDIT : i've got the following code : http://pastie.org/1652253 When i press the submit button i get this message ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS wp_terms ( term_id bigint(20) unsigned NOT ' at line 3 How do i fix this ?
-
WordPress custom post type taxonomy loop
Hello guys, i need to query posts from a specific custom post type and from a specific taxonomy category. I've got the following loop <?php $folio_loop = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => get_post_meta($post->ID, 'ep_portfolio_posts_per_page', true), 'orderby' => 'menu_order' ) ); ?> <?php while ( $folio_loop->have_posts() ) : $folio_loop->the_post(); ?> <?php endwhile; ?>` now, i've created a taxonomy named portfolio_categories , and i've created a category (using the taxonomy) with the name "One Column" what should i have to do in order to get posts only from that taxonomy category ? Thanks...
-
Fullscreen scroll
I'm creating this theme for wordpress http://enovastudio.org/wordpress-demo/photographer/category/blog/'>http://enovastudio.org/wordpress-demo/photographer/category/blog/ , the background is a fullscreen image that get's expanded automatically, basically i'm using the css from this plugin http://nanotux.com/blog/fullscreen/ but without the javascript (with css i'm expanding the image at 100% height and width with hidden overflow) Now if you take a look at the blog category here http://enovastudio.org/wordpress-demo/photographer/category/blog/ , when there is to much content on the page, the scroll appears (as it should) , but it doesn't work as it should, a part of the content stay hidden and i can't scoll. Any advice ? Thanks...
-
Submenu not clickable
yeah it worked but then i wasn't able to adjust the position, becouse there was a problem with the background of the ul. Nvm i changed script for the gallery and everything works now thanks anyway
-
Submenu not clickable
Hello guys, i'm building a website using wordpress and i've got a little problem. Everything is fine and working but i can't click on any link available in my submenu using jquery superfish. The submenu works in every other page, but when i'm using a special jquery gallery from a tutorial the submenu stop "working" i can't click on it and it get's hidden. Take a look here http://enovastudio.org/wordpress-demo/photographer/gallery/ if you go on the homepage, the submenu works, but not on the gallery page. The submenu works on the gallery page until the gallery is not loaded, once the gallery is loaded and jquery moves the bar from the left it stop working... is there a way to fix this ? i've spent more than 3 hours tryng to fix this (i'm sure it's a css problem) but i can't figure it out... that's why i'm asking your help guys.... thanks...
-
Wordpress : custom post type and wp-pagenavi
Hello, this is the first time that i use wp-pagenavi plugin, i'm currently using custom post type on a page template, this is the code : <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $loop = new WP_Query( array( 'post_type' => 'myposttype', 'posts_per_page' => 4, 'paged'=>$paged ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> .....loop code... <?php endwhile; ?> <?php wp_pagenavi(); ?> If i use the normal pagination everything works but if i use <?php wp_pagenavi(); ?> nothing shows on my page, but then, if i check in wp-pagenavi settings page the option ""Show navigation even if there's only one page." it shows some sort of navigation on my page but it says that there is only 1 page but it's not true, there are 2 page... what's going on ?
-
jquery cycle : z-index strange issue
Hello guys i'm building a template for a friend and i've a got a strange problem take a look at this page http://demo.enovastudio.org/im/cycle.html The navigation bar at the top of the page is visible just a for a few seconds then it get's hidden by jquery cycle, i immediately thought it was a problem with the z-index i've tried everything but I could not find a solution, then I read a few options available to jquery-cycle and i've found the "fit" option. If i enable the fit option (fit :1) the navigation bar is visible and jquery cycle works only if i use as sliding effect : "fade", if i change this effect with another one it doesn't work anymore, pictures aren't visible. Is there a way to fix this strange issue ? thanks...
-
jquery superfish css "problem"
thank you so much it works
-
jquery superfish css "problem"
thanks for reply anyway it works in ie8 also, and i've fixed the "height problem" in another way, but with the js suggested snippet the "fade effect" of the submenu doesn't work anymore... so since i want the "fade" effect maybe it's better if cufon replace only the "top menu" font and not the submenu... how can i do this ?
-
jquery superfish css "problem"
Ok this is the first time i use superfish and now i've got a problem take a look at this url http://demo.enovastudio.org/cluster/ if you hover on "Available Pages" and then on "Gallery" you'll se that there is a multi level submenu, ok everything works but , everytime i add a new level submenu the "li" container gets additional height/.. how can i fix this ? this is the superfish css code ul#navbar { float: right; margin-top: -27px; } .sf-menu, .sf-menu * { margin:0; padding:0; list-style:none; } .sf-menu { line-height:1.0; } .sf-menu ul { position:absolute; top:-999em; width:10em; /* left offset of submenus need to match (see below) */ } .sf-menu ul li { width:100%; margin-bottom: 10px; } .sf-menu li:hover { visibility: inherit; /* fixes IE7 'sticky bug' */ } .sf-menu li { float:left; position:relative; } .sf-menu a { display:block; position:relative; color:#717171; text-decoration:none; text-transform: uppercase; font-weight: bold; font-size: 14px; padding-left:22px; } .sf-menu a:hover { color:#fff; } .sub-sub { padding-bottom:-50px; } li.sfHover ul li a { background:transparent url(images/submenu_limiter.png) repeat-x; padding-top:13px; } .sf-menu li:hover ul, .sf-menu li.sfHover ul { left:0; top:2.7em; /* match top ul list item height */ z-index:99; background: #111111; -moz-border-radius-bottomleft:5px; -moz-border-radius-bottomright:5px; border-bottom-right-radius:5px; border-bottom-left-radius:5px; -webkit-border-bottom-right-radius:5px; -webkit-border-bottom-left-radius:5px; } ul.sf-menu li:hover li ul, ul.sf-menu li.sfHover li ul { top:-999em; } ul.sf-menu li li:hover ul, ul.sf-menu li li.sfHover ul { left:10em; /* match ul width */ top:0; } ul.sf-menu li li:hover li ul, ul.sf-menu li li.sfHover li ul { top:-999em; } ul.sf-menu li li li:hover ul, ul.sf-menu li li li.sfHover ul { left:10em; /* match ul width */ top:0; }