New answers tagged

0

These three lines work as expected , There is a problem maybe with other code before these lines that prevent the execution of your script; In case just fire the browser console in this page and try them here $( "html" ).append( "<div id='bf_rsvp_note_display'></div>" ); $( "body" ).append( "<div id='bf_rsvp_note_display'></div>" ...


1

I had 2 things wrong: I unregistered wordpress's jquery without properly registering my own (I concatenated my scripts ) I didnt have wp_footer() in my theme. the wp_enqueue_media() function loads the scripts to the footer.


2

From your site i can say that script is not being loaded because of wrong opening quote for script tag.Use " instead of ” So <script src=”http://lookbook.nu/widget/profile.js?id=2303472&width=standard&align=left&stats_fans=1&fanbox=yes&hash=14575a9cd02fd36d2758e5db3cb92b5a”></script> Should be this <script ...


0

Update 2: <?php $storeData = []; $args = ['post_type' => 'store']; $loop = new WP_Query($args); foreach ($loop->posts as $post) { $storeData[] = [ 'title' => apply_filters('the_title', $post->post_title), 'lat' => types_render_field('lat', ['output' => 'raw']), 'long' => types_render_field('long', ...


1

You could probably make use of WP built-in notices and create one using JavaScript. jQuery(function($){ $('.wrap > h1').after('<div class="error notice"><p>' + 'Your error message' + '</p></div>'); });


0

There can be many reasons for that. For the beginning I'd check if the session_start() returns true, and after that I'd make sure my ajax callback function is executed. Just put some die()s in your script.


1

Not allow. Your user is not a software developer, pretending that he is can only end bad. This is even before speaking about security etc. If you think that there are callbacks that make sense, just provide them yourself.


1

Never let anyone add any jQuery scripts via any text editor. How are you going to know if the script is malicious or not, how are you going to handle jQuery errors, how are you going to know if the jQuery is even proper and allowed jQuery. eval() brings an added extra security risk and should be avoided where user submitted strings are to be evaluated. ...


2

You forgot to set dependencies at third parameter put it with array() or array('jquery') if you want to depend on jQuery wp_register_script( 'navbar-scroll', 'http://www.classyclutter.net/wp-content/themes/foodiepro/assets/js/scrolling-navbar.js', array(), '1.0.0', true);


0

You can either register the script and then enqueue it (which is how you're doing it above), or you can simply enqueue it all in one go. Either way, if your script requires jQuery, you should designate it as a dependency with your registration, so WordPress will know to load it automatically for you. So, either: wp_register_script( 'menuscroll', ...


0

I'm beginner in jQuery AJAX too, and I always tried with $.ajax, but I'm using just $.post to my requisitions now and they work well. The syntax is more simple and less risk to make a mistake. Obviously, if I'm wrong in this way, please someone alert me about it. In $.post() you need to put the url, the variable would get by POST as object and a handler ...


0

Just with JS there is no way, because the visitor can reload the page or close window and reopen and reset everything. You can create a table in your wordpress database where the user's name will be saved with 0 (if no comments was done) and the id of the post (if commented). So in one more column, you create the replies number, starting with 0 and go ...


0

Maybe It's the Appropriate Answer for You! Accordingly to this question the more reasonable answer is to use wp_send_json() with (if only necessary) the wp_send_json_success() and wp_send_json_error() functions. They'll return an JSON Object back to the AJAX Request and it will automatically die() for you. It will look something like this: add_action( ...


3

1) Maybe bind to the api.ready state which may fix having to call your section twice (function($, api){ api.bind( 'ready', function() {... } })(jQuery); I saw a note in trac that said "Note that the APIs for dynamically-added controls, and APIs for JS-templated custom Sections and Panels are not yet available as of WordPress 4.2. See #30741." Reading ...


0

Finally all i had to do is specify the mobile custom css code, i give it a name then make it only visible to mobile (800width and above are not mobile, probably tablet, pc e.t.c) @media only screen and (max-width : 800px) { .media{ display: none; } } @media only screen and (min-width : 800px) { .vid{ display: none; } } Then from my widget ...



Top 50 recent answers are included