Order Ports

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
cmarangon
Posts: 15
Joined: Thu Feb 03, 2022 6:35 pm
Location: Curitiba - Brazil
Contact:

Order Ports

Post by cmarangon » Sat Feb 05, 2022 12:12 pm

Hello!

I was thinking...

Is there a way to order posts and put a number in front of them?

I use to put a number in front of the post, typing it, like for example

01- Post 01
02- Post 01
03- Post 01

But using
<ol reverse>
<li> Post 01
<li> Post 02
<li> Post 03
</ol>

It wil do it automaticaly.

But my question is,
Is there a way to insert <ol reverse><li>...</ol>
into the PHP code?

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Order Ports

Post by Arvid » Sun Feb 06, 2022 12:30 pm

Hi,

what do you plan to achieve? Where do you want to display that entry list? (Isn't the "last entries" widget what you're looking for?)

All the best
Arvid

cmarangon
Posts: 15
Joined: Thu Feb 03, 2022 6:35 pm
Location: Curitiba - Brazil
Contact:

Re: Order Ports

Post by cmarangon » Sun Feb 06, 2022 12:56 pm

Arvid wrote: ↑Sun Feb 06, 2022 12:30 pm Hi,

what do you plan to achieve?
Where do you want to display that entry list?
(Isn't the "last entries" widget what you're looking for?)

All the best
Arvid
Hi Arvid!

I want to display last posts, sorting them with a number in front of each one, in reverse order.
For it I intend to use
<ol reverse>
<li>
</ol>


So I ask,
What is the file for last posts?

I made an error, order, in English, does not mean sort.

I just need to sort them, like for example, a list for last entries:

05 - Global Warming hot wave
04 - Covid-19 is increasing again
03 - World Cup 2022 is coming soon
02 - Chess champion visits Brazil
01 - Welcome tro FlatPress

If I use

<ol reverse>
<li>
</ol>


It willl do it automatically, sorting them even if a new post is included.

User avatar
Arvid
FlatPress Coder
Posts: 558
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: Order Ports

Post by Arvid » Sun Mar 13, 2022 1:00 pm

I think the LastEntries plugin is what you're looking for. It already outputs the last 10 entries as unordered list (ul) - all you have to do is to change this to an reversed ordered list. See fp-plugins/lastentries/plugin.lastentries.php in line 35 and 60 :)
(To preserve the original plugin, you could copy the plugin folder and rename it to, say, lastentriesreversed. Make sure you then also rename the plugin PHP file (in this case, to plugin.lastentriesreversed.php.)

Let us know if that works out for you!
All the best,
Arvid

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 42 guests