i saw that my question was jumped over sorry if i asked wrong or basic question…i’m new and i could really use some help. pinegrow looks great, and i want to move from webflow, but i also want to be sure that is right tool for me
if it is not possible via PHP Code & Functions is there any other way to put this code (except writing it directly to file and overwiting on every export)
if i strip php tags i get something like this this:
if (!empty($url)) { > }
and of course it doesn’t work after export. What am I doing wrong?
Hey Emmanuel, thank you very much actually it’s raining here, so finally we can rest from the heat a little. Another thing popup, seems like there is no option for meta_query in The Loop:
‘meta_query’ => array {
}
Is there any workaround or i need to put it manually after every export? cheers and thank you again.
I’m currently working on a project and using the technique you outlined here but unfortunately one of the additional args I’ve added isn’t being used by the loop and I was hoping to get some clarification on how to set it up properly if possible.
For some background, I’m currently using a loop built with The Loop action to show a custom post type, and within that custom post type there is a date field named “event_date”. I would like the loop to only show posts that are after the current date and to list them in ascending order and also ordered by the the “event_date” field. (hopefully that makes sense)
In working up a solution for this I hand coded it first and then swapped the original Pinegrow generated loop’s args in the theme’s code to make sure it worked, and it did. From there I checked the “Args in own PHP block” and then added in the additional args that I couldn’t add through The Loop action in PHP blocks. Here is a code view of the Pinegrow generated args compared to what I originally hand coded.
On the front end the loop is correctly not showing any posts that are older than the current date but is unfortunately not ordering them by the “event_date” field in the CPT but rather by their creation date in WordPress (the default behavior).
If there was a way to add the CPT field into the “Order by” selector in the Order Parameters section in The Loop action I feel like it would work properly but unfortunately that’s not currently possible (or at least I can’t figure out how to make it work ).
If you or @Emmanuel can shed some light on this and get me going in the right direction I’d really appreciate it.
I’d like to add to this conversation for anybody who is using this method and wanting to apply it to a block thats using the @block: attribute for adding block controls in the editor for the user.
After you create the block and add the block attributes and also add the tags @block: in the places you want controls for the block, you need to use PG_Blocks::getAttributeForAction( $args, ‘your-attribute-id’
because if you use e.g ‘terms’ => ‘slug’, the query will not work. The values in the controls you made for the block will not be read and will return nothing. If you look in the php code block pinegrow generates, you will see thats how they are achieving the same thing. You simply have to apply it to your query code.
By doing the custom query above in a php block after the one generated by pinegrow I was able to make a gutenberg block where the user from the editor can choose location + service from custom taxonomies and display the results without having the custom query overridden when I save/export from pinegrow.