Hi again…!
<?php foreach($page->children()->listed() as $article): ?>
when i want to load specific order from the list, how can I do?
and… I want to load 5 recent post in main page, how can I set this…?
thank you very much…!
Hi again…!
<?php foreach($page->children()->listed() as $article): ?>
when i want to load specific order from the list, how can I do?
and… I want to load 5 recent post in main page, how can I set this…?
thank you very much…!
By what criteria to you want to sort the articles?
Sort by date, then limit the number with limit()
:
thank you!
but I mean…
I want to make like this:
and one more question…
<?php foreach($page->children()->listed()->flip() as $works): ?>
<h1><?= $works->title()->html() ?></h1>
<?php endforeach ?>
$listPages = $page->list()->toPages();
foreach ($listPages as $p) {
echo $p->title();
}
This assumes you are actually on the member page.
For your first example, this is not about sorting but fetching particular files, for example
$newest1 = page('works/exterior')->children()->listed()->first();
$newest2 = page('works/architerior')->children()->listed()->first();
$latest5 = page('works')->children()->listed()->sortBy('date', 'desc')->limit(5);
thanks!
but it is now working…
I need to load that list to team.php,
but that data is in “site/team/member”. so I try $memberpage = page(‘member’) instead of $listPages, but now wokring… do you know why…?
You probably mean not working, not “now”.
The page helper need the full id of the page, not only the slug:
$memberpage = page(‘team/member’) ...
<?php
$memberSign = page('team/member');
$listPages = $memberSign->list()->toPages();
?>
<?php foreach ($listPages as $p): ?>
<div class="swiper-hover" id="hoverList">
<h1><?= $p->title() ?></h1>
</div>
<?php endforeach ?>
then they said… Call to a member function list() on null…
Then a page with slug member
doesn’t exist. You really have to provide more useful information.
The page is probably team/sanghak-lee
, but I doubt you want to fetch these members all by their name but rather loop through the children of the team page.
oh you right. member is just for blueprint…
So… I am still stuck in here…
I tried to use just page(‘team’) but this is team page template so nothing changes…
do you know how can I solve this…?
regrads,