Hallo zusammen!
Mit Hilfe von ACF lasse ich bei Fotos den Namen und / oder die Organisation aus einer Auswahl als Copyright ausgeben.
Nun möchte ich, falls ein vorhandenes Auswahlkästchen (Funktion thumbnail copyright obs) angeklickt wird, den entsprechenden Text ausgeben lassen. Leider funktioniert das nicht wie gewünscht.
Der Code dafür ist folgender
PHP
$copyright = array();
/* thumbnail copyright */
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_meta = array();
$thumbnail_meta[] = get_post_meta( $thumbnail_id, 'name', true ) ?? NULL;
$thumbnail_meta[] = get_post_meta( $thumbnail_id, 'organisation', true ) ?? NULL;
if( count( array_filter ( $thumbnail_meta ) ) >= 1 ){
$thumbnail_copyright = implode( ', ', $thumbnail_meta );
$copyright[] = '<div>© ' . $thumbnail_copyright . '</div>';
}
/* thumbnail copyright obs */
$thumbnail_id_obs = get_post_thumbnail_id();
$thumbnail_meta_obs = array();
$thumbnail_meta_obs[] = get_post_meta( $thumbnail_id_obs, 'artikelfoto', true ) ?? NULL;
if( count( array_filter ( $thumbnail_meta_obs ) ) >= 0 ){
$thumbnail_copyright_obs = implode( ', ', $thumbnail_meta_obs );
$copyright[] = '<div>© ' . $thumbnail_copyright_obs . '</div>';
}
Alles anzeigen
Leider haut das mit der Ausgabe des Textes für die Checkbox nicht hin.