Forum

Thread tagged as: Configuration, Runway, Blog

Post in list not displaying results

Hi,

I'm using runaway and the blog app.

I have a listing page which works fine. This links to a detail page which also works fine.

However, i've i'm trying to create an additional page which only shows posts from a specific category. However, this doesn't seem to be returning any results. My code on the page is:


<?php perch_blog_custom(array( 'filter' => 'postDateTime', 'match' => 'eqbetween', 'value' => '2009-01-01, 2016-01-01', 'category' => array('Inspiring Stories'), 'template' => 'post_in_list.html', ));
?>


Debug looks like this


Debug Message SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='6dbe812d5941948bedd9192f2107eaf5' LIMIT 1 UPDATE perch2_users SET userHash='981e4028f7a1aa4fc73574259ecfac60' WHERE userID='1' SELECT p.privKey FROM perch2_user_privileges p SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID SELECT collectionID, collectionKey FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC SELECT * FROM perch2_pages WHERE pageID=62 LIMIT 1 SELECT * FROM perch2_content_regions WHERE pageID=62 AND regionPage!='' ORDER BY regionOrder ASC SELECT COUNT() FROM perch2_content_items WHERE itemJSON!='' AND regionID=149 AND itemRev=2 SELECT COUNT(*) FROM perch2_content_items WHERE itemJSON!='' AND regionID=150 AND itemRev=1 Queries: 10

Memory: 2.7777

Many thanks,

Nick Capehorn

Nick Capehorn 0 points

  • 6 years ago

Try removing filter, match and value.. then see if anything is output. I like to simplify the function as the first step in troubleshooting.

Also, since your only specifying a single category, I would replace...

'category' => array('inspiring-stories')

with

'category' => 'inspiring-stories'

though I don't know it makes any difference.

EDITED: I have changed category filter from the Category Title to the Category Slug, for my example to be inline with Drews answer below.

Thanks Andrew. Unfortunately that doesn't seem to make any difference, I still get no results. If I use the standard:


<?php perch_blog_recent_posts(10); ?>

I get results fine (but all categories).

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to use the category slug to filter, not the title.

'Inspiring Stories' will likely have a slug of inspiring-stories

Ah, OK. Thanks.