Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2021-12-03 12:06:33
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,308
specific article to be always first on an article list
i have article list here
i would like that article “Läti 2017” to be always first (sticky) on that list.
my list code:
<txp:article frontpage="0" limit="12" sort="Posted desc" wraptag="div" break="div" class="tulbad-3 col-content-2 cat">
<div class="cat-img">
<txp:permlink><txp:article_image /></txp:permlink>
</div>
<div class="cat-text">
<h5><txp:permlink><txp:title /></txp:permlink></h5>
</div>
</txp:article>
Offline
Re: specific article to be always first on an article list
If you make that article a sticky article, you can do:
<txp:article … status="sticky" />
<txp:article … status="live" />
where ...
is all your other attributes. You may also be able to do:
<txp:article … status sort="Status desc, Posted desc" />
using just status
on its own, which Oleg mentioned covers both cases.
And then you can also always do:
<txp:article_custom id="123" … />
<txp:article exclude="123" … />
where 123
is the id of the article you want to appear first.
TXP Builders – finely-crafted code, design and txp
Offline
#3 2021-12-03 14:23:30
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,308
Re: specific article to be always first on an article list
jakob wrote #332082:
If you make that article a sticky article, you can do:
<txp:article … status sort="Status desc, Posted desc" />...
using juststatus
on its own, which Oleg mentioned covers both cases.
choosed this one and that article is first in a list now, but it doesn’t show up in article page anymore :(
my form:
...
<txp:article frontpage="0" limit="12" status sort="Status desc, Posted desc" wraptag="div" break="div" class="tulbad-3 col-content-2 cat">
<div class="cat-img">
<txp:permlink><txp:article_image /></txp:permlink>
</div>
<div class="cat-text">
<h5><txp:permlink><txp:title /></txp:permlink></h5>
</div>
</txp:article>
Offline
Re: specific article to be always first on an article list
Hi Gallex, I also had some similar issues which I eventually solved by having all articles live
but use a custom field.
Check this structure, especially on lines 193-196. c10
is a name of a custom field that, if I have an article which I mark with an x
, it keeps them on the top of the first page.
You may want to check out what I have in the live and sticky forms but. do remember that by sticky
here I am not referring to the status
.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: specific article to be always first on an article list
There should be no problem with viewing sticky articles, just save one on the demo site and access it by its URL. But there is no evidence your other articles use the form you cite above. Their HTML output is
<section class="content-1">
<div class="container">
<div class="container">
<div class="title">
<h1>Norra 2019</h1>
</div>
<div class="body">
<ul class="article-album article-album-3">
<li><a href="https://maalitudmaailm.ee/images/2.jpg" data-fancybox="group" data-caption="It is a long established fact that ">
<img src="https://maalitudmaailm.ee/images/2t.jpg" alt="It is a long established fact that " width="306" height="250">
</a>
<span class="thumb-alt">It is a long established fact that </span>
</li>
...
</ul>
</div>
</div>
</div>
</section>
Offline
#6 2021-12-06 08:44:13
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,308
Re: specific article to be always first on an article list
etc wrote #332085:
There should be no problem with viewing sticky articles, just save one on the demo site and access it by its URL. But there is no evidence your other articles use the form you cite above. Their HTML output is…
how to save article on the demo site?
i thought the individual article part of my code is not important in my issue, that’s why i leaved it out. the whole code:
<txp:if_individual_article>
<txp:article>
<div class="title">
<h1><txp:title /></h1>
</div>
<div class="body">
<txp:body />
</div>
</txp:article>
<txp:else />
<h6 class="header-top-left">Maalid</h6>
<txp:article frontpage="0" limit="12" status sort="Status desc, Posted desc" wraptag="div" break="div" class="tulbad-3 col-content-2 cat">
<div class="cat-img">
<txp:permlink><txp:article_image /></txp:permlink>
</div>
<div class="cat-text">
<h5><txp:permlink><txp:title /></txp:permlink></h5>
</div>
</txp:article>
</txp:if_individual_article>
Offline
Offline
#8 2021-12-06 09:58:44
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,308
Re: specific article to be always first on an article list
etc wrote #332089:
It is, try adding
status
to<txp:article>
also in the individual part.
perfect easy solution! thank you, oleg!
Offline
Re: specific article to be always first on an article list
Great! We have considered modifying <txp:article />
to process both live
and sticky
articles on individual pages, but some prehistoric templates use
<txp:article />
<txp:article status="sticky" />
combo, which means sticky articles would be output twice.
Offline