datepicker value in mysql
It’s a UNIX timestamp – with PHP, you can use date to format it like so: echo date( ‘d/m/Y’, $timestamp ); // day/month/year
It’s a UNIX timestamp – with PHP, you can use date to format it like so: echo date( ‘d/m/Y’, $timestamp ); // day/month/year
You’re setting the HTML of the second drop down to essentially blank with: $(‘select[name=”second_dropwdown”]’).html(“<option>Sorry, no options</option>”); So when you enable it again, that’s the only option. Instead, you might try including that as an actual option within your select and then selecting it when disabling the second drop down. You could either include it in … Read more
You need to fully reference jQuery throughout your code. It should be… jQuery(window).on(“scroll”, function() { if(jQuery(window).scrollTop() > 50) { jQuery(“.top-bar”).addClass(“active”); } else { jQuery(“.top-bar”).removeClass(“active”); } }); When in no-conflict mode you need to always reference jQuery in full and not use the $. No conflict mode exists to prevent conflicts when jQuery is used with … Read more
jQuery(document).ready(function ($j) { $j(‘#wp_button’).on(‘click’, function() { var data = { action: ‘response’, myid: ajax_var.mypostid, ajaxvar: variable, }; $.post(ajax_var.ajaxurl, data, function(response) { alert(response); location.reload(); }); return false; }); });
As Mayeenul said in the comment you can use: if($category[0]->name == ‘News’ || $category[0]->name == ‘home-news’) { … And to follow up on your comment about the title flashing in, this is because the jQuery is run after the browser has already rendered the content so there’s a brief moment when it’s shown before jQuery … Read more
Try two things – 1. Link your js using wp_enqueue_script action as under : add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ ); function theme_name_scripts() { wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(‘jquery’), ”, true); } Third parameter in wp_enqueue_script() function will make sure jquery is loaded before your current js file. Inside your js file, replace $ with jQuery as … Read more
I don’t know your html code, but here is how it will work. The idea is that you keep the original hidden elsewhere. HTML <button class=”add-form”>add form</button> <form id=”main-form”> <div class=”form-item row”> <input type=”text” name=”abc”> </div> </form> <div class=”stay-hidden original-form-item”> <input type=”text” name=”abc”> </div> CSS .stay-hidden { display:none; } JS // Add form jQuery(‘.add-form’).click(function() { … Read more
You cannot just create .html files arbitrarily, WP won’t recognize them and any PHP code won’t work in html file in first place (typically). While you could bend this into working with some effort it would be bad approach since making Ajax request to WP will cause another core load and essentially double the load … Read more
If process.php is not found, your reference in the file is not correct. Make sure you reference to the correct path, for istance – if the file is in the rootdirectory of your site, add a slash in front of your code: url: “process.php”, will be: url: “/process.php”, If it is in the ‘ajax’ directory: … Read more
Presumably your theme is using the body_class function to output classes. You can add a filter to remove or add your own classes. function wpd_logged_out_body_class( $classes ) { if( ! is_user_logged_in() ){ $classes[] = ‘loggedout’; } return $classes; } add_filter( ‘body_class’, ‘wpd_logged_out_body_class’ );