Aggiungere date ai feed di foto, video e album

È possibile utilizzare questo snippet per aggiungere date sotto i post nei feed delle griglie Foto, Album e Video.

Feed di foto

Aggiungere il seguente JavaScript al sito. Questo può essere fatto manualmente utilizzando un plugin JavaScript personalizzato. Per ulteriori informazioni, consultare la nostra documentazione qui.

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>' );
});

Feed di album e video

Utilizzare invece il seguente snippet per aggiungere date ai feed degli album o dei video:

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>' );
});
supporto

Non è stato possibile trovare la risposta nei documenti?

Contatto con l'assistenza

Questo articolo è stato utile?