Bulk renew expired listings

Discussion in 'GeoCraft WordPress Theme' started by homespunmoney, Oct 4, 2013.

Thread Status:
Not open for further replies.
  1. homespunmoney

    homespunmoney Member

    Joined:
    May 25, 2013
    Messages:
    57
    Likes Received:
    5
    Have searched for an answer but just can't find it.... I need to renew all of the expired listings in my directory. Am hoping you can point me to a way of doing this.

    Thanks!
    chris
     
  2. Gourav

    Gourav Support Staff

    Joined:
    Oct 19, 2012
    Messages:
    7,728
    Likes Received:
    207
    Hello,

    Go to function.php present in your theme directory and add the code given below

    Code:
    global $wpdb;
    $data="SELECT * FROM wp_posts WHERE post_status = 'draft'";
    $queries = $wpdb->get_results($data);
    foreach ($queries as $query) {
    echo $post_id=$query->ID;
    $meta_key='gc_listing_duration';
    $post_status='post_status';
    $posttable='wp_posts';
    $meta_value='08/20/2013 07:15:45';
    update_post_meta($post_id, $meta_key, $meta_value);
    $wpdb->update($posttable,array($post_status =>'publish'), array( 'ID' =>$post_id ),array('%s'),array( '%d' ));
    }
    Sending image for reference
    [​IMG]


    "$meta_value" defines as the date at which you want to expire your listing, So fill "$meta_value" as per your requirements.

    Firstly save that code in the bottom of function.php file and then refresh your dashboard and website, It will activate your all listings after that remove that code and again save your file.
     
  3. homespunmoney

    homespunmoney Member

    Joined:
    May 25, 2013
    Messages:
    57
    Likes Received:
    5
    Perfect!!!!!

    Thanks so much!

    chris
     
Thread Status:
Not open for further replies.

Share This Page