Code Amp
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Order by Custom FieldHey @andreasja
Yeah I think this is the right approach.
A WordPress query, if ordered by a custom field will remove any entries that don’t have that custom field associated – which you’ve already discovered and worked around by adding this custom field to the “post” post type.
That’s the best way around it, but it is a work around, I wish there was a way to specific in a query whether or not we wanted to include results which don’t have the custom field but as far as I’m aware it’s not possible yet…
There was one point I mentioned earlier regarding conditionally loading this query modification.
If you are creating a specific page, with your layouts on, then you can simply add a check to make sure we are on the right page, before adding your logic:
function layout_query_args( $query_args, $layout_id ) { // Block editor way would be to check what the current page is /* if ( ! is_page( 'my-page-name' ) ) { return $query_args; } */ // Because you created layouts in our admin pages, they have an ID so you can test for it here // Change 123 for your own layout ID if ( $layout_id !== 123 ) { // If the ID doesn't match, get out of here return $query_args; } // Now we know the modifications will only apply to a layout with ID - 123 // We can add our modifications $query_args[ 'meta_key' ] = 'list_number'; $query_args[ 'orderby' ] = 'meta_value_num date'; $query_args[ 'order' ] = 'DESC'; // Always return in WP filters return $query_args; } add_filter( 'custom-layouts/layout/query_args', 'layout_query_args', 10, 2 );Here you can see, I’ve added
$layout_idto the function, and tested against layout ID123– change this for your layout ID.Also note, the
add_filter(...line has a, 2argument added, which allows us to get the$layout_idpassed into the function.Let me know if that makes sense
Best
– RossThanks @andreasja
@herondino glad you got setup 🙂
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Group posts by Custom fieldHey @atoyansk
That code looks a little off.
Lets try to look at the issue another way (I hope I understood it correctly).
Why don’t we create 3 seperate layouts, and for each one, restrict them to a specific country?
If that sounds like what you are trying to do, or would work, then I can help with the logic to set that up.
The other question would be, how are you creating layouts, via the block editor, or via our admin pages?
Thanks
- This reply was modified 4 years, 4 months ago by Code Amp.
Hey @sarju747
Thanks for the kind words!
Regarding the manual order – this is a feature provided by wordpress natively.
Essentially, any post type, can have a
menu_orderproperty (but by default, this only exists forpages).If you were to enable this for other post types (or you are displaying pages, in our layouts), then you can use this
manual orderto respect the menu_order setting.What post type(s) are you displaying in your layout?
Thanks
– RossForum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] Order by Custom FieldHey @andreasja
You would need to use our
custom-layouts/layout/query_argsfilter from here:
https://customlayouts.com/documentation/action-filter-reference/And then add this (modified code) to your child themes
functions.phpfile.Try this:
function layout_query_args( $query_args ) { // Modify the query args $query_args[ 'meta_key' ] = 'your_key'; $query_args[ 'orderby' ] = 'meta_value_num'; $query_args[ 'order' ] = 'DESC'; // Always return in WP filters return $query_args; } add_filter( 'custom-layouts/layout/query_args', 'layout_query_args', 10 );You would need to change
your_keyto your custom field key (if you are using ACF, let me know, as its not as straight forward as you might think)Also: just to warn you, this code will apply to all layouts on your site.
What you probably want to do is restrict this to a layout ID or specific page.
How are you creating your layouts, as blocks, or via our admin pages?
Thanks
Forum: Plugins
In reply to: [Custom Layouts - Post + Product grids made easy] CSS style overiddenHey @jbonlinea
This is an issue we’re aware of – we need to change some of our css so it can be overwritten more easily – planning to address this in an update a few months away yet.
Do you have a link I could look at so I can provide you with something that would work?
We probably just need to use the parent classes as part of the selector (to increase specificity) and then add your custom class name.
Thanks
Forum: Reviews
In reply to: [Search & Filter] Don’t buy itHey @wesdavisdev – sorry didn’t see this – not patroling the forums here too often.
Regarding your question, yeah, all our fields have unique classes so can be targetted individually for any custom css – this is the default way to use the pro plugin at the moment (with the actual design / WYSIWYG controls coming in version 3, for those that don’t want to / can’t code).
Thanks
- This reply was modified 4 years, 4 months ago by Code Amp.
Hey Moussa
I’m assuming you mean the main currency setting from the WooCommerce settings page, eg, a single currency across your whole site?
While we won’t be able to hook into that setting directly (until we build a WooCommerce price element), you could add the currency symbol next to the price via the before + after text panel:
https://drive.google.com/file/d/1V4EGn6zqqefpu5lxZptXzusZhPHedlf3/view?usp=sharing
You can access the panel once you select the custom field in the editor.
Let me know if that all makes sense?
- This reply was modified 4 years, 4 months ago by Code Amp.
Hey @sarju747 + @imavexadmin
I have a beta ready with this fix ready to go – https://customlayouts.com/documentation/beta/
Can you test it and let me know if it solves your issues?
Thanks
Hey @sarju747 + @imavexadmin
I can recreate this issue if I select some taxonomy terms and save, and later change the post type and try to do something with new taxonomy terms (that belong to the next post type).
There are a couple of other bugs that need fixing too with WP 5.9 (using gradients is throwing an error), tackling them tomorrow, hopefully it won’t take too long to complete.
Thanks
Thanks for the detailed video!
I will do some testing on this tomorrow and let you know what I find.
Hmm sounds odd.
Is the taxonomy a custom one? If it is, do you know the “slug” of the taxonomy?
+ Would you be able to share a screen recording of the save process and show an errors that are there?
You can open the browsers “console” to find any error messages – every browser has one, and you can follow these steps to open it:
https://balsamiq.com/support/faqs/browserconsole/With a screen recording + the console open to see messages, I hope I can see the issue so we can resolve it.
Thanks
Hi @imavexadmin
Before we continue, let me just make sure I’ve got this right – it sounds like (correct me where I’m wrong):
– The admin area works, and you can change the restricted taxonomies
– You can save the admin layout, BUT the taxonomies you chose have been cleared when the page reloads (after the save)
– And, the frontend (the link you provided) does not apply the taxonomy restriction?Thanks
Ok thanks for the update – hopefully we’ll get to releasing this feature sooner rather than later.
Best
– RossHey @ventilator
Right now there isn’t an easy way to do this – we have a bit of complicated setup so we can load SVGs optimally – essentially we register (while a page is loading) different SVGs we use via
xlink:href, and then before the closing body tag we outout those SVGs via PHP – this ensures no SVG is loaded more thank once, and keeps the page size down too.If you wanted to hack at it, the easiest thing to do would be to replace the SVG in our plugin, but as you mention that’s generally not advisable.
We do plan to an option so you can choose an image from your gallery as the placeholder image, but thats not coming for some time.
* I do have another idea, we have some PHP hooks, so you can filter the output of any of our elements – including the featured image.
You could conditionally check for the existance of the image placeholder in the content, and replace the html with your own:
https://customlayouts.com/documentation/action-filter-reference/You would need one called
custom-layouts/element/render_output:add_filter( 'custom-layouts/element/render_output', 'cl_element_render_output', 10, 2 );I hope that might help until we add this feature!
Thanks
– Ross- This reply was modified 4 years, 4 months ago by Code Amp.