Jump to content

Featured Blog Page


Edward Ver
 Share

Recommended Posts

Hello. I'm learning PW and I have a Blog page which shows blog entries and a featured blog using a field.

But if I use the $field featured_post=1, no page is showing. Using limit=1 works fine.

<?php 
$blogger = $pages->find("template=blog_entry,featured_post=1"); // my template
foreach($blogger as $bloggers) {
foreach($bloggers->blog_entries as $blog_entry) { // my repeater field
   
echo "<div><a href='{$blog_entry->url}'><h1 class='text-xl'>{$blog_entry->title}</a></h1>";
echo "<a href='{$blog_entry->url}'><img src='{$blog_entry->blog_main_image->getCrop('blogsmall')->url}' alt='{$blog_entry->blog_main_image->description}'></a>";
echo "{$sanitizer->truncate($blog_entry->blog_text , 100, array('type'=>'sentence', 'keepFormatTags'=>false /* true or false */))}";
echo "<p class='test_to_show_value_of_featured_filed'>{$blog_entry->featured_post}</p>";
echo "</div>";
}}
?>

Any help will be very appreciated. Thanks.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   1 member

×
×
  • Create New...