Hello, I have a wix site which has the blog app and I want to filter all the blog/posts displayed in my site by a “single condition”.
Imagine that I want to only display the POSTS where the title starts with “Shop.”
If post title is " Shop this guitar" it will be displayed.
If post title is “Play guitar”, it will not be displayed.
I’m a developer, but I’m struggling so much with corvid haha it seems that I do not know nothing.
In regular coding languages, I would just add a where condition to the database query on posts table.
In this case, I see that we can use Hooks “beforeQuery” or “beforeGet”. Which I’m confused which one, but I’m trying with both just in case.
I added 2 hooks just to test the console.out(“hooks being fired”) but it seems not to work, in the following example nothing is shown in the developer console (F12 nor wix console).
So my data.js is like this:
export function Blog$Posts_beforeGet(itemId, context) {
//TODO: write your code here...
console.log('Data hook fired');
}
export function Blog$Posts_afterGet(item, context) {
//TODO: write your code here...
console.log('Data hook fired');
return item;
}
So, my question is:
How can I filter by code the “original” query that wix makes to the blog/posts?.
Imagine that I just want to add a single “AND” condition to the query that wix does to the blog/posts.
Can I achieve it by using hooks? Which event?
P.D.: I know you can make a dynamic page with custom feed and load the blog posts, but, there the rich text is not displayed, so, I would like to use the Wix Blog App page but filtering the posts that are displayed by a “custom” query.
Thank you!


