Forum Replies Created
-
AuthorPosts
-
December 2, 2021 at 4:22 AM in reply to: ✅Creating a custom field with value from other custom fields #32340
[email protected]
ParticipantHello
Yes the 1st code is implemented on the single post template (cpt) (php code block in oxygen builder).
The 2nd Code is in a code snippet and should update the field 'fg_taxo_object_artist_names' after saving a post in the editor (no frontend submission).
But the field is not updatet. I guess the field values of the taxonomies are not fetched?
(why is it working on frontend but not on backend?)Hope I was able to explain more clear.
November 29, 2021 at 7:56 PM in reply to: ✅Creating a custom field with value from other custom fields #32260[email protected]
ParticipantHello
I was basicly succesfull with your help. One thing is not working though:
When using this code on frontend of the post, it is working fine and showing the first name of the artist (fetched from custom taxonomy field):
<?php
$terms = get_the_terms( get_queried_object_id(), 'artists' );foreach ( $terms as $term ) {
$term_name = rwmb_meta( 'fg_meta_artist_name', ['object_type' => 'term'], $term->term_id );
$term_name_first = rwmb_meta( 'fg_meta_artist_name_first', ['object_type' => 'term'], $term->term_id );$value $term_name_first;
echo $value;
}?>
When trying to fill an empty custom field (text) with the same value, the field it not filled up:
<?php
add_action( 'rwmb_after_save_post', function( $post_id ) {< code from above (without echo) >
update_post_meta( $post_id, 'fg_taxo_object_artist_names', $value );
} );?>
Both fields are text fields.
Do you see any reason why this is not working?Thanks a lot in advance.
Regards, FrançoisNovember 24, 2021 at 2:53 PM in reply to: ✅Showing Custom Fields of related Terms in Single Post #32134[email protected]
Participantthanks a lot. that was very helpful.
November 9, 2021 at 1:26 AM in reply to: ✅Creating a custom field with value from other custom fields #31808[email protected]
Participantgreat, I'll try. Thanks a lot !
-
AuthorPosts