The reason is because $post_id
does not have a value there. Like I said, I don’t know how to get the value given the code you’ve posted. This is specific to the framework you are using. I am not familiar with the framework an you will need to ask the creators of that framework how to get the post ID of the current post in the loop where this code is used.