prestoav Posted January 4, 2016 Posted January 4, 2016 Hi everyone, I'm using the ProcessBlog module successfully and adding a nice pagination with MarkupPager. All very successful thanks to pointers from the forums here! However, when generating the category pages I can't find a way to use $page->find with a selector for the blog categories. The categories for an individual post are within an array of categories called 'blog_categories'. What should the $page->find construct look like if the categories are within $child->blog_categories? I've tried a few possibilities including this with no luck: Each page has the same name as the category (e.g. 'Events') $posts = $pages->find("template=blog-post, limit=6, blog_categories%=$page->title"); And this: $posts = $pages->find("template=blog-post, limit=6, blog_categories.title%=$page->title"); Any ideas? Is this even possible? All contributions gratefully received!
Tom. Posted January 4, 2016 Posted January 4, 2016 I must apologise, I haven't used the ProcessBlog module. However I'm guessing the blog_categories are a page field? If so you could try $posts = $pages->find("template=blog-post, limit=6, blog_categories.title%=$page->title");
prestoav Posted January 4, 2016 Author Posted January 4, 2016 Thanks Tom. Although I had tried that idea your message prompted me to dig a little deeper. It does work but... The category I was testing was titled 'Hints & Tips'. Even though both the page title and category title were cleaned so the '&' was presented as the HTML entity '&' in both cases the selector still doesn't work. However, changing the title of the category to 'Hints and Tips' has made the selector you shared work. Awsome, thanks!
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