August 29, 2024 at 2:36 am
Have a good morning,
and another question from me: I would like to know whether it is possible to dynamically assemble a link from the cf. So the value of the cf location should get the link from a given url plus a dynamic part. So far I have done this with the following shortcode, but I think it would be great if you could do it without a shortcode:
function nachbarn_bawue_shortcode() {
// Custom Variablen auslesen
$n1 = get_post_meta(get_the_ID(), 'n1', true);
$n2 = get_post_meta(get_the_ID(), 'n2', true);
$n1_url = get_post_meta(get_the_ID(), 'n1_url', true);
$n2_url = get_post_meta(get_the_ID(), 'n2_url', true);
// URLs erstellen
$n1_link = '<a href="*Login to see link . esc_attr($n1_url) . '" target="_blank" rel="noopener">' . esc_html($n1) . '</a>';
$n2_link = '<a href="*Login to see link . esc_attr($n2_url) . '" target="_blank" rel="noopener">' . esc_html($n2) . '</a>';
// Ausgabe des Textes mit Links
return 'Auch in ' . $n1_link . ', ' . $n2_link . ' ist das gültig.';
}
add_shortcode('nachbarn-bawue', 'nachbarn_bawue_shortcode');