2023-02-17, 06:31 PM
Pages: 1 2
2023-02-17, 06:34 PM
May need to be more specific about what you're trying to do. Are you trying to edit the value, change a template?
2023-02-17, 06:39 PM
sorry yes, Im trying to edit the views on threadlist template.
like change the way the views display and i need to find {$thread['views']} is what im looking for.
like change the way the views display and i need to find {$thread['views']} is what im looking for.
2023-02-17, 07:00 PM
There is
What change do you want?
{$thread['views']}
in forumdisplay_thread
.What change do you want?
2023-02-17, 07:05 PM
(2023-02-17, 07:00 PM)tedem Wrote: [ -> ]There is{$thread['views']}
inforumdisplay_thread
.
What change do you want?
yes but I want to change what that displays
2023-02-17, 07:08 PM
Display format? Like 1K instead of 1,000?
2023-02-17, 07:08 PM
for example, on this particular forum if a post gets 1,200 views it displays 1.2 B I want to fix that it should be 1.2 K
exactlytlly yes
this also is not for your theme either this is just for something else im doing for someone
(2023-02-17, 07:08 PM)tedem Wrote: [ -> ]Display format? Like 1K instead of 1,000?
exactlytlly yes
(2023-02-17, 07:08 PM)tedem Wrote: [ -> ]Display format? Like 1K instead of 1,000?
this also is not for your theme either this is just for something else im doing for someone
2023-02-17, 07:13 PM
You'd need a plugin for that (and there will already be one if it's doing it), you can't do that directly in the template. Unless it's being done by javascript.
2023-02-17, 07:17 PM
Open
Open
Find:
Replace:
Here is the function I use for the Alpine theme.
./inc/functions.php
- add at the end:function short_number($number)
{
$units = ['', 'K', 'M', 'B', 'T'];
for ($i = 0; $number >= 1000; $i++) {
$number /= 1000;
}
return round($number, 1) . $units[$i];
}
Open
./forumdisplay.php
:Find:
$thread['views'] = my_number_format($thread['views']);
Replace:
$thread['views'] = short_number($thread['views']);
Here is the function I use for the Alpine theme.
2023-02-17, 07:55 PM
(2023-02-17, 07:17 PM)tedem Wrote: [ -> ]Open./inc/functions.php
- add at the end:
function short_number($number) { $units = ['', 'K', 'M', 'B', 'T']; for ($i = 0; $number >= 1000; $i++) { $number /= 1000; } return round($number, 1) . $units[$i]; }
Open./forumdisplay.php
:
Find:$thread['views'] = my_number_format($thread['views']);
Replace:$thread['views'] = short_number($thread['views']);
Here is the function I use for the Alpine theme.
Thanks, this was already setup for this forum just had to change the letters they used. this is exactlly what i needed
Pages: 1 2