Forum Replies Created
-
AuthorPosts
-
October 4, 2022 at 11:04 PM in reply to: โ CPT with taxonomy, custom field with image attached to taxonomy #38537
Joe
ParticipantHi,
just found out how it works, if you have a better solution, please let me know :
<?php //$terms = get_the_terms($post->ID, array('label', 'week', 'formate', 'pack'), $terms = get_the_terms($post->ID, array('label'), array( 'hide_empty' => true, 'posts_per_page' => null ) ); foreach($terms as $term) { $image_id = get_term_meta($term->term_id, 'label_image_upload', true); $image_url = wp_get_attachment_image_src($image_id, 'full'); ?> <img src="<?php echo $image_url[0]; ?>" width="<?php echo $image_url[1]; ?>" height="<?php echo $image_url[2]; ?>" /> <?php } ?>October 4, 2022 at 9:42 PM in reply to: โ CPT with taxonomy, custom field with image attached to taxonomy #38532Joe
ParticipantSo far I have accomplished this
<?php //Getting the term by name $terms = get_the_terms($post->ID, 'label'); print_r ( $terms ); //Retrieving images from taxonomy by term id foreach($terms as $term) { echo $term->term_id; ?>the print_r($terms) function gives me the following:
Array ( [0] => WP_Term Object ( [term_id] => 53 [name] => Dog Art [slug] => dog-art [term_group] => 0 [term_taxonomy_id] => 53 [taxonomy] => label [description] => [parent] => 0 [count] => 7 [filter] => raw ) ) 53which is great because this is the label, that is attached to the CPT, the term_id is also correct
now I just need the image ...
How do I get to the image of the custom field ?September 29, 2022 at 6:55 PM in reply to: โ How to display attachments of CPT in Admin Edit Screen #38480Joe
Participantok, thank you for your time and effort. ๐
September 29, 2022 at 2:00 AM in reply to: โ How to display attachments of CPT in Admin Edit Screen #38469Joe
ParticipantHello,
for all images I have used the Media Library and attached the image to the post, they are all attachments
thank youJoe
ParticipantHi,
had the same problem , try using MB Views works great with no problems
regards
Joe
ParticipantExcellent, thank you very much
Joe
ParticipantI am really sorry to bother you again ...
I also have a checkbox List that has an ID team_member_position
This does not work :
<?php $values = rwmb_meta( 'team_member_position' ); ?> <ul> <?php foreach ( $values as $value ) { ?> <li><?php echo $value; ?></li> <?php } ?> </ul>I have checked the docs, and basically none of the solution fits, because this is a list of multiple choices AND cloneable values, can you pls help me one more time.
Joe
ParticipantThank you very much, it works, i had the same line of code, i think , duhhh
cool thanks ๐
-
AuthorPosts