ildarvasin Posted December 5, 2019 Share Posted December 5, 2019 pls help I made a news template with various fields and I want my list to appear automatically on the main page with all the news names how to do it sorry for my bad english Link to comment Share on other sites More sharing options...
louisstephens Posted December 5, 2019 Share Posted December 5, 2019 In you home template, you could do something like: <?php $newsArticles = $pages->find('template=your_news_templates'); foreach ($newsArticles as $newsArticle) { echo "<a href=\"" . $newsArticle->url . "\">" . $newsArticle->title . "</a>"; } ?> This would output each article's title (as well as a url to the article). Obviously you can change the markup to whatever you would need. 3 Link to comment Share on other sites More sharing options...
ildarvasin Posted December 5, 2019 Author Share Posted December 5, 2019 thank you so much, louisstephens Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now