Counter of days

Posted in: Newspaper
Post count: 9

I need to insert next to the date, a counter of days.
Try Javascript does not work


function hbz_day_counter(year,month,day){
// Defaults to void errors.
year = typeof(year) != 'undefined' ? year : 2000;
month = typeof(month) != 'undefined' ? month : 12;
day = typeof(day) != 'undefined' ? day : 13;
var today = new Date(); //Today
var start_ts = Date.UTC(year,(month - 1),day); //Since...
document.write(Math.floor((today - start_ts)/(1000*60*60*24) )-1);
}

<script language=”javascript”>hbz_day_counter(2000,12,13)</script>

Any ideas? I need help please

Post count: 20

hi,
I have put this code in theme panel ‘custom javascript’ and work fine!

var today = new Date();
var start_ts = Date.UTC(2000,(12 – 1),13);
jQuery(‘.td_data_time’).after( “<span>”+start_ts+”</span>” );

Post count: 23312

Hello juodcv,

If you want to achieve what you mean, it is necessary to do some customization to loop_single which you are using.
For example, below I gave you an example for default single template. To do this, you can change loop_single.php file and add the code below, like this: http://screencast.com/t/f36AkBkbrYxp . If you use another single template you have to change the properly file, like this:
http://screencast.com/t/zgIgAJYOwroBhttp://screencast.com/t/0jDtKR4qR

The result you should see here: http://screencast.com/t/lqEiPWmjlS

Hope this helps and let us know how it goes!

If is not what you mean, please provide more details.

Thank you!

Post count: 9

Hi, sorry if I did not explain properly what I need it is to add a number of edition the website, along with the date.
http://infotercera.com/wp-content/uploads/2015/12/Captura-de-pantalla-2015-12-04-a-las-11.55.19.jpg

As in this website…
http://infotercera.com/wp-content/uploads/2015/12/Captura-de-pantalla-2015-12-04-a-las-12.01.02.jpg

Thank you very much, sorry my english

Post count: 22421

Hello,
I am not sure what a number of edition means and what it is supposed to do. Is it just a text you wan to type in next to the date and time or does it have other functionality?
Pleas provide more details.
Thank you!

Post count: 9

The edition number, begins to run when the site gets the line. (Is the number of days in the website).

Assuming that the site was launched the day 01/12/2015

Example of how it should be viewed on the site.

Wednesday December 2, 2015 | Number of Issue 02

Thursday December 3, 2015 | Number of Issue 03

Friday December 4, 2015 | Number of Issue 04

Saturday December 5, 2015 | Number of Issue 05

It is a counter of days, from the 01/12/2015

I hope I was clear from already thank you very much.

  • This reply was modified 10 years by juodcv.
Post count: 22421

Hello,
I understand now but i do not know of any easy solution for it. Maybe you can find a plugin that has this functionality. Maybe one of our users can help if they used such a feature before.
Thank you!

Post count: 9

This would be in php, the problem is how to put together a date
<? echo floor((strtotime(date("Y-m-d")) - strtotime("2015-12-01"))/86400); ?>
Thank you!

Post count: 22421

Hello,
Unfortunately we have no easy solution to provide and time does not allow us to provide any custom work at the moment as we are a small team and we are working hard on development, updates, fixes and support. You can maybe find a solution online for your customization or you can maybe hire a freelancer to help out o this task.
Thank you for your understanding.

Post count: 9

Resolved. add the PHP code in the file top-widget.php

Image

Thank you

Post count: 22421

Hello,
Glad you solved it and good luck on your project! Thank you for posting your customization on our forum as it will help other people who need it.
Have a nice day!

Post count: 12

Hi all!
It’s been a while since this post was posted by now I need exactly the same solution: Putting together the date and the edition number, assuming the edition number will be updating automatically on a daily base.
Unfortunately images attached are no available right now.
Could anybody help me with this?
Thanks!

Post count: 35449

Hi,
If the above solution is still working, then the file that need to be edited is on this path -> wp-content/plugins/td-standard-pack/Newspaper/parts/header/top-widget.php now you need to set the code in the place where you’ll like to display it.
Thank you!

Post count: 9

Hi this solution still works for me.
In order not to modify theme files, I use the Insert PHP Code Snippet plugin (https://es-ar.wordpress.org/plugins/insert-php-code-snippet/). Which generates a shortcode to implement anywhere on the site.

Post count: 12

Hi juodcv!
Thanks for you reply.
I am not sure which is the code I need to insert. I need both, the edition number and the date.
Could you please help me?
Thanks a lot!

Post count: 9

Hi, it won’t let me paste the code directly here, it gives me an error.

Our system detected some kind of strange traffic from your ip. This error has been logged and if our system is damaged, we will fix it as soon as possible.

Contact email and I send it to you

greetings

Post count: 12

Oh great, my email es info@netbios.com.ar.
Thank you so much!

Post count: 9

Info enviada

Viewing 18 posts - 1 through 18 (of 18 total)
The forum ‘Newspaper’ is closed to new topics and replies.