¿Cómo mostrar la etiqueta ap si la fecha del comentario de WordPress es inferior a abril de 2014?
Frecuentes
Visto 33 equipos
0
I need to display a HTML when the comment date below April 2014 . This is my wordpress date code
<time datetime="2014-05-26T12:19:33+00:00">May 26, 2014 at 12:19 pm</time>
I want to display following HTML
<p class="comment-rating"> <img src="#"><br>Rating: <strong>5 / 5</strong></p>
¿Es esto posible?
1 Respuestas
3
Normaly you should show the attemp of what you've tried so far.
Aquí hay una forma de hacerlo:
$(function () {
var checkDate = new Date("2014-05-01");
$.each($("time"), function () {
var $timeItem = $(this);
var currentDate = new Date($timeItem.attr("datetime"));
if (currentDate < checkDate) {
$timeItem.after('<p class="comment-rating"> <img src="#"><br>Rating: <strong>5 / 5</strong></p>');
}
});
});
Demostración:http://jsfiddle.net/36bg4/2/
contestado el 28 de mayo de 14 a las 12:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript jquery wordpress or haz tu propia pregunta.