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.