Script updated because when ads pass midnight can republished...
Now ads can republished at the same time of last republish
Here the fixed code...
<?php function republish_link($item_id, $link_title = NULL, $target = '_blank') {
$link = republish_link_raw($item_id);
$link_title = ($link_title == '' ? __('Republish now!', 'backoffice_manager') : $link_title);
//Republish once per day or more
$datenow = new DateTime('NOW');
$itemdate = new DateTime(osc_item_pub_date()); //Fixed line
$diffdate = date_diff($itemdate,$datenow);
// Days to wait before item can be republished.Change 1 with yours
if($link && $diffdate->days >= 1) {
echo '<a style="color:green;font-weight:bold;" href="' . $link . '" target="' . $target . '" title="' . __('This listing is about expire or has expired. Click to republish this item if it is still valid', 'backoffice_manager') . '">' . $link_title . '</a>';
} else {
//echo something else when republish link does not show up
}
}
?>
*also remove php tags.
I modified more code about this plugin such as republished counter,remaining time of next republish and different status according republish status.
If anyone wants this features just pm me to share the code!