Jump to content

jarvis

Members
  • Content Count

    479
  • Joined

  • Last visited

Community Reputation

1 Neutral

About jarvis

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Sorted it with usort($productions, function($a1, $a2) { $v1 = strtotime($a1['year']); $v2 = strtotime($a2['year']); return $v2 - $v1; // $v2 - $v1 to reverse direction });
  2. Hi, I have a loop which creates an array: $productions[] = array( 'url'=>get_the_permalink(), 'year'=>$production_year->name, 'title'=>get_the_title() ); When I output the results, the year is in the wrong order: 2019 2018 2017 2016 2015 2014 2020 What I can't work out is how to order 2014 - 2020 I tried ksort(array, SORT_STRING) and ksort(array, SORT_NUMERIC) I also tried natsort But still have the same issue - am I missing something? Thanks
  3. @requinix Many thanks, that solved the issue! Have a great Christmas!
  4. Hi All, I hope someone can help! So I have a basic form which uses Select2. If someone uses the first field, it disables the remaining fields - this works fine. The issue is if you clear the selection in the first drop down, then pick a value from another drop down, it seems to select your choice but also adds 'Select' as an option. I've created a JS Bin to help show the issue: View the JS Bin Any help is appreciated Thanks
  5. Hi, Am hoping someone can please help. I've the following code: $chosen_methods = WC()->session->get( 'chosen_shipping_methods' ); $chosen_method = explode(':', reset($chosen_methods) ); The first line returns the warning: "Warning: reset() expects parameter 1 to be array, null given in" I've tried the following: $chosen_method = ''; $chosen_method = NULL; $chosen_methods = array(); Sadly, none have worked. What am I missing? Thanks
  6. I see what you're saying but I'm still at a loss, I can see the docs but I cannot fathom how to do what I need "ajax": { "method" :"POST", "url" : '<?php echo admin_url('admin-ajax.php');?>', "data": function ( d ) { return $.extend( {action:action,tax:tax,id:id}, d, { "searchResultsHeader": $('.search-results-header').val() } ); } } ??
  7. Hi @requinix I tried to adjust example.on( 'xhr', function ( e, settings, json ) {// check is the response is not null and show the table if (json != null) { $('#example').removeClass("hide-me",""); jQuery(".search-results-header").html(data); } } ); I also tried adding d.search-results-header = $('#search-results-header').val(); Into the render part of the code I'll be honest, I'm struggling to make sense of it, hence turning to this forum for assistance. I'd previously read the link you sent and struggled to make sense of it. I also Google'd for ex
  8. Thanks @requinix When I previously tried ajaxifying the content, the search on the table didn't work. The code above worked and still enables the search functionality I just can't quite see how to do/integrate the other part
  9. @requinix I was going aiming to to insert it into that div. So table content goes to table and additional info to here. Or is it better to do it another way?
  10. Hi All, I use a jQuery datatable to display information from a search. The results are posted back via Ajax to a default table placeholder like so: <table id="example" class="table table-striped table-responsive hide-me" style="width:100%"> <thead> <tr> <th>Sponsor</th> <th>Nationality</th> <th>Sector</th> <th>Team Sponsored</th> <th>Sport</th> </tr> </thead>
  11. Thanks @requinix Unfortunately, this stems from a Wordpress build and the code is generated by a plugin, so its beyond my control.
  12. HI All, I'm hoping someone can help! I need to either remove or change a DIV tag directly above another. Here's the code: <div style="clear:both;"></div> <div class="berocket_lgv_widget" style="float:left;padding: 5px 0px 5px 0px;"> Either the entire first DIV needs removing or change the style to clear:none I thought something like: $(".berocket_lgv_widget").prev().attr("style", " clear:none"); $(".berocket_lgv_widget").prev().remove(); No joy with either. I also tried before() Any help is much appreciated Thanks
  13. Apologies, why is it by posting I managed to work these things out Each of my posts when created gets the company ID assigned. So rather than query post by author ID, I queried for all posts linked by company ID This worked! More so because the tests I were doing were based on posts written by the primary user ID, not any other user IDs with the same company ID Problem solved!
  14. Hi All, I really hope someone can help me on this. Basically, I'm trying to disable a bunch of accounts linked by a custom field value of company_id. It toggles a custom field of enable_account from 1 to 0 - this part works fine. What I also need to do, is once the user is disabled, locate any posts by the user (author ID) and set it from publish to draft. Now, this is oddly the part not working! If I dump the code out in any file its fine, however, once I put the exact code back to my functions file, it fails. So I have the disable link on a template like so: <a hr
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.