I've got a "news" embed I'm calling from my homepage. Inside that news listing template it lists 7 articles based on the dates, which could be a mix of 4 different categories. I'm not using EE categories, it's just a radio button field that is compared to set the styling. If I need to switch to EE categories I can.

What's the best way to refresh that whole "news" embed section when they click one of the filter buttons? I need to refresh so it now shows 7 articles with the field type "news_category" equal to say "announcements".

Should I just link to same page but set a segment and pull content based off that segment (/news/announcements), or can I reload this with AJAX or jQuery somehow?

1 Answer 1


I've done similar before and ajax is your best bet rather then refresh or link to another page.

Your home page =

<h1>Home page<h1>
<!-- Other channel calls -->
{exp:channel:entries channel="your_channel"}
 <div id="news">
   <select id="switch"> <!-- Use actual category ID values -->
     <option value="01">Option</option>
     <option value="02">Option 2</option>
   <div id="news-list">
      {embed = "/news/list"} -- Embed the base 7 articles

Your embed (news/list) =

  <h1><a href="/news/{url_title}>{title}</a></h1>

Javascript =

<!-- Assumes you know what you're doing here -->
$('#switch').on('change', function() {
  url = "/ajax/update_news/"+this.value(); <!-- Should render /ajax/update_news/categories_actual_id -->
  $.ajax({url: url, success: function(result){

/ajax/update_news.html =

  category="{segment_3}" {!-- The categories ID --}
  {embed = "/news/list"} -- Embed the base 7 articles

Embeds can be an expensive include if you have lots of other stuff going on within the page, you could alternately use snippets instead.

Update Your code in comment will never work as your using tags that you've dreamt up. If you don't want to use categories then you'll have to use the search tag

{exp:channel:entries search:your_field_name="your_search_term" ...}

Have a good read of this page: https://docs.expressionengine.com/v2/add-ons/channel/channel_entries.html

  • awesome, I'll give this a shot and see how it works out. thank you!
    – Chief
    Apr 4, 2017 at 10:35
  • I have the ajax working but the /ajax/update_news.html doesn't seem to pull the entries I'm trying to filter by. I think it has to do with what category i'm trying to pull from. I'm trying to pull based off a custom radio field I have called "news_category". Do you think I have to change my channel to use EE categories instead, so when i try to do category="{segment_3}" it works? Not sure if you can use channel:entries based off a custom radio field.
    – Chief
    Apr 4, 2017 at 11:32
  • Here's my current code... I hardcoded "news_category" just to test and it still doesn't work so that's why I'm gathering custom radio button's won't work like this. {exp:channel:entries channel="news" news_category="Tournaments" limit="4" orderby="news_date" disable="categories|category_fields|pagination"}
    – Chief
    Apr 4, 2017 at 11:33
  • Answer updated above Apr 5, 2017 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.