Forum Replies Created
-
AuthorPosts
-
[email protected]
ParticipantFound out it was a bug with the jam.dev debugging recording tool. Spoke to the Jam.dev team, they are aware and releasing a patch. ๐
[email protected]
ParticipantHello Peter,
Sent the details through however it 'seems' to be a rogue chrome extension causing the issue. I will report back if it is something different, thank you.
[email protected]
ParticipantHello Peter,
Thank you for the quick reply, I should have added within the original message that I had already tested this without plugins and default theme.
I have took another video for you to see however: https://screencasts.wdsaigon.com/recordings/5PCJKnEKLIi2yd6P4BdA
Many thanks
Michael
[email protected]
ParticipantSorry, It was a slow moment and now know how to dot it, please feel free to close/delete this.
Many thanks
July 31, 2023 at 1:22 AM in reply to: โ Single Image in settings page to be added to a page or post custom field. #42778[email protected]
ParticipantHello Peter,
Thank you so much!
1. Doh, I must not have scrolled down far enough!
2. Ah ok, I was not to sure if to include it or not/or even the ID of the tab for the settings page haha.
Finally may I ask, is it possible to run that but without the page ID? Example, wherever there is a custom field named
image_of_townon a post or page and thelocation_detailsimage_of_town_1is saved it will update them all? Do I jusr remove the110,from this stringupdate_post_meta( 110, 'image_of_town', $new );so it will readupdate_post_meta( 'image_of_town', $new );Again many thanks for your help!
July 30, 2023 at 8:40 PM in reply to: โ Single Image in settings page to be added to a page or post custom field. #42775[email protected]
ParticipantThanks Peter,
Just sent them to you now.
Many thanks
July 29, 2023 at 12:10 AM in reply to: โ Single Image in settings page to be added to a page or post custom field. #42772[email protected]
ParticipantHi Peter,
Still does not work for me for some strange reason. I used 2021 theme with only MB plugins installed and added the code the them function.php file.
Please see video for you to review:
https://komododecks.com/recordings/FJ8dZstUsF8pm8Ghk7V6
Many thanks
Mick
July 27, 2023 at 10:55 PM in reply to: โ Single Image in settings page to be added to a page or post custom field. #42768[email protected]
ParticipantHello Peter,
Again thank you for the quick reply, unfortunately It did not populate it and still shows the add media button in the page custom fields ๐ I did remove the condition as you advised so the new code is now:
// Hook into rwmb_after_save_field action add_action( 'rwmb_after_save_field', 'update_target_field', 10, 5 ); function update_target_field( $null, $field, $new, $old, $object_id ) { // Check if the saved field is 'image_of_town_1' and the object is a settings page if ( $field['id'] === 'image_of_town_1' && is_admin() ) { // Update the target field (image_of_town) on the post/page with the image URL update_post_meta( 110, 'image_of_town', $new ); } }Here is the display code output of the image_of_town_1 in Metabox just so you can see I am using the correct ID's:
This is a single image field in a tab in a settings page:
<?php // Displaying uploaded image: ?> <?php $image = rwmb_meta( 'image_of_town_1', [ 'object_type' => 'setting', 'size' => 'thumbnail' ], 'mb-website-settings' ); ?> <h3>Logo</h3> <img src="<?= $image['url']; ?>"> <?php // or simpler: ?> <h3>Logo</h3> <?php rwmb_the_value( 'image_of_town_1', [ 'object_type' => 'setting', 'size' => 'thumbnail' ], 'mb-website-settings' ) ?>Here is the single image field in the page custom field:
<?php // Displaying uploaded image: ?> <?php $image = rwmb_meta( 'image_of_town', [ 'size' => 'thumbnail' ] ); ?> <h3>Logo</h3> <img src="<?= $image['url']; ?>"> <?php // or simpler: ?> <h3>Logo</h3> <?php rwmb_the_value( 'image_of_town', [ 'size' => 'thumbnail' ] ) ?>I also double checked the ID of the page and it is 110.
Many thanks again for your support.
Kindest Regards
Mick
July 26, 2023 at 10:29 PM in reply to: โ Single Image in settings page to be added to a page or post custom field. #42759[email protected]
ParticipantHello Peter,
Thanks for the quick reply!
Yes it seems the first example is the right solution, I did check the doc, but their is no example for updating other fields
Does this look ok to you?
// Hook into rwmb_after_save_field action add_action( 'rwmb_after_save_field', 'update_target_field', 10, 5 ); function update_target_field( $null, $field, $new, $old, $object_id ) { // Check if the saved field is 'image_of_town_1' and the object is a settings page if ( $field['id'] === 'image_of_town_1' && is_admin() && get_post_type( $object_id ) === 'settings_page' ) { // Update the target field (image_of_town) on the post/page with the image URL update_post_meta( 110, 'image_of_town', $new ); } }Many thanks
Mick
[email protected]
ParticipantThat worked perfectly Peter, thank you for pointing me in the right direction, much appreciated!
[email protected]
ParticipantHi,
It just refreshes with the toast bar as per screenshot, that is after I clicked publish.
As per your request, I deactivated all plugins, activated 2023 and it still does not work.
Here is the pastebin for the Location Fields that will not publish: https://pastebin.com/04fNmdK8
Here is the pastebin to Company Fields that do publish: https://pastebin.com/3iYA797b
Thanks
[email protected]
ParticipantHi Peter,
Thanks for the reply,
If it was not Bricks and I was applying it to say a Gutenberg loop, please could you let me know what the process would be? i.e. where to add the code you referenced in your last reply.
Many thanks
Michael
[email protected]
ParticipantChao Long,
I do not want to show only one of the Questions and Answers, I want to show the whole 5 Question and answer subfields from the fact post.
But I will have many FAQ Posts, One FAq post with 5 questions about plumbing, one Faq post that has 5 questions about electrician, One faq post that has 5 questions about gas heating.
One way to do it would be to add the Question and answer to every page instead of using a FAQ CPT. But because I have ten pages on electricans, 10 pages on plumbing, and 10 pages on gas heating, etc. Would mean I would have to copy and paste it 30 or 40 times. Instead, I would rather have the FAQs for each service have their own FAQ post, so I only have to add them to the site once and then query that Faq post using a custom field that is set on the page.
P.s. Bricks does support cloneable groups.
The only part I do not know how to configure is how the group is connected to the page by the value I enter in the custom field. Do I do this via a relationship or?
I hope that makes sense?
Many thanks Long
[email protected]
ParticipantChao Long,
Cam on for your reply.
Ah, I will not use the cloneable group to query; I will use Bricks builder to query the group, but I want to know how to use the custom field on the page to use the FAQ post that has the right question and answers.
For example, I have a template set up and the cloneable group FAQ Question & Answer selected with the subfields in a nestable repeater field (accordion, tabs, etc). On the individual pages where the template is applied, I have a custom field with the value of 'plumber' so I want it to choose the FAQ post in the FAQ CPT, which I have used to answer Plumber questions & answers.
So if I go to the page about plumbers, then the question and answers on the page will be about plumbers.
If I go to a page about Electricians, then the question and answers will be about Electricians.But not sure how to connect the two?
Many thanks
Michael
-
AuthorPosts