Añadir fechas a los feeds de fotos, vídeos y álbumes

Puedes utilizar este fragmento de código para añadir fechas debajo de las entradas de tus rejillas de fotos, álbumes y vídeos.

Archivos fotográficos

Añada el siguiente JavaScript a su sitio. Esto puede hacerse manualmente utilizando un plugin JavaScript personalizado. Para más información, consulte nuestra documentación aquí.

function cffTimeConverter(UNIX_timestamp){
  var a = new Date(UNIX_timestamp * 1000);
  var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
  var year = a.getFullYear();
  var month = months[a.getMonth()];
  var date = a.getDate();
  var time = date + ' ' + month + ', ' + year;
  return time;
}
$('.cff-album-item').each(function(){
  var timeStamp = $(this).attr('data-cff-timestamp');
  if( $(this).find('.cff-photo-date').length < 1 ) $(this).append( '<p class="cff-photo-date">' + cffTimeConverter(timeStamp) + '</p>' );
});

Álbumes y vídeos

Utilice en su lugar el siguiente fragmento para añadir fechas a los feeds de Álbum o Vídeo:

function cffTimeConverter(UNIX_timestamp){
  var a = new Date(UNIX_timestamp * 1000);
  var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
  var year = a.getFullYear();
  var month = months[a.getMonth()];
  var date = a.getDate();
  var time = date + ' ' + month + ', ' + year;
  return time;
}
$('.cff-album-item').each(function(){
  var timeStamp = $(this).attr('data-cff-timestamp');
  if( $(this).find('.cff-photo-date').length < 1 ) $(this).find('.cff-album-info').append( '<p class="cff-photo-date">' + cffTimeConverter(timeStamp) + '</p>' );
});
soporte

¿No ha encontrado la respuesta en los documentos?

Contacto

¿Le ha resultado útil este artículo?