Jump to content

PWaddict

Members
  • Posts

    992
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by PWaddict

  1. In your selector add sort=sort.
  2. Here is how I did it: $wire->addHookAfter("Pages::save", function(HookEvent $event) { $page = $event->arguments[0]; if($page->template->name != 'my-template') return; $admin_page_name = wire("pages")->get(2)->name; $repeater_id = wire("fields")->get('my_repeater_field')->id; $empty_items = $pages->find("template=repeater_my_repeater_field, my_text_field='', parent=/{$admin_page_name}/repeaters/for-field-{$repeater_id}/for-page-{$page->id}/, include=all"); if(count($empty_items)) { foreach($empty_items as $empty_item) { $page->of(false); $page->my_repeater_field->remove($empty_item); $page->save(); } }
  3. I would like to auto remove repeater items if a text field inside repeater item is empty. The below code placed inside the template removes the specific repeater items when someone visits the page. How can make it work in a Hook when the editor saves the page on backend? $admin_page_name = $pages->get(2)->name; $repeater_id = $fields->get('my_repeater_field')->id; $empty_items = $pages->find("template=repeater_my_repeater_field, my_text_field='', parent=/{$admin_page_name}/repeaters/for-field-{$repeater_id}/for-page-{$page->id}/, include=all"); foreach($empty_items as $empty_item) { $page->of(false); $page->my_repeater_field->remove($empty_item); $page->save(); }
  4. Has anyone figured this out? I really need this hook.
  5. I've never output repeater content outside from their pages so maybe I'm not the right guy to help you. Until someone else can reply you should check the Repeater demonstration page on the part "Finding pages by repeater value (using selectors)".
  6. Try the below but on the template enter the name of the repeater template. If you go to "Setup > Templates > Filters > Show system templates? > Yes" you'll find that your repeater field has a template like this: repeater_your_event_repeater: $upcoming_dates = $pages->find("template=repeater_your_event_repeater, agenda_datum>=$today, sort=agenda_datum, limit=3");
  7. Sorry my mistake. The selector code if placed on another page must be $pages->find. Try this: $upcoming_dates = $pages->find("template=your_event_template, agenda_datum>=$today, sort=agenda_datum, limit=3");
  8. @tooth-paste Of course just add a limit on your selector like this: $upcoming_dates = $page->agendaitem->find("agenda_datum>=$today, sort=agenda_datum, limit=3");
  9. I think it depends on the content.
  10. @wbmnfktr Repeater items are actually pages too. @tooth-paste Here is how you can do it: <?php if(count($page->event_repeater)) { $today = strtotime("today"); $upcoming_dates = $page->event_repeater->find("event_date>=$today, sort=event_date"); if(count($upcoming_dates)) { foreach($upcoming_dates as $upcoming_date) { ?> <div>...</div> <?php } } } ?>
  11. Is there any difference between these? Aren't they doing exactly the same thing? if($page->template == 'admin') return; if($page->template->name == 'admin') return;
  12. To easily add rel="next" and rel="prev" tags for pagination in head section insert the following hook to your site/ready.php: $wire->addHookAfter('Page::render', function(HookEvent $event) { $page = $event->object; if($page->template == 'admin') return; $tags = ''; $config = wire('config'); if($config->urls->httpNext) { $tags .= "<link rel='next' href='{$config->urls->httpNext}'>"; } if($config->urls->httpPrev) { $tags .= "<link rel='prev' href='{$config->urls->httpPrev}'>"; } $event->return = str_replace("</head>", $tags . "</head>", $event->return); });
      • 9
      • Like
      • Thanks
  13. Try to install a fresh copy of PW to the server you have the issue and during installation PW will let you know if your server is properly configured.
  14. When you moved the files on the server did you also moved the folders cache, logs & sessions from site/assets/ ? If yes then I suggest you to DELETE those folders. This could be the problem.
  15. The Inputfield Dependencies page doesn't say anything about the published status so I guess it isn't possible. You might be able to do what you want with a hook.
  16. Using this it properly works: $today = time(); $news_posts = $page->children("limit=10, news_date<=$today");
  17. Using the following selector I should be able to get today's and past posts but I'm only getting the past ones. $news_posts = $page->children("limit=10, news_date<=today"); If I change the operator to >= then I get today's and upcoming posts but why the <= doesn't display today's posts too?
  18. On the PW 3.0.104 version we get the field labels instead of the field names on "Missing required value", "Restored previous value" and "Page unpublished because field is required" error messages. More info on GitHub.
  19. On the PW 3.0.104 version we get the field labels instead of the field names on "Missing required value", "Restored previous value" and "Page unpublished because field is required" error messages. More info on GitHub.
  20. I forgot to update the topic. On the PW 3.0.104 version we get the field labels instead of the field names on "Missing required value", "Restored previous value" and "Page unpublished because field is required" error messages. More info on GitHub.
  21. It should be src="https://www.youtube-nocookie.com/embed/abc123?feature=oembed&rel=0" in order to work. It seems that TextformatterVideoEmbedOptions module can't add the options to your custom TextformatterVideoEmbed module. Install the original TextformatterVideoEmbed module and you'll see that the "rel" will be added properly.
  22. As I said above you can easily hide them by changing the "YouTube: Show Related Videos at the End" to 0 value. This adds the "rel=0" to the embed url which hides both pause and end related videos. I've already tried and it's working fine.
  23. Can you show me a screenshot of the "ytp-pause-overlay"?
  24. I think it would be easier to find that great tip if the topic moved to the Tutorials section.
  25. Change the "YouTube: Show Related Videos at the End" to 0 value. It hides the related videos when you pause too.
×
×
  • Create New...