Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Dynamic Links

Home / Forums / Kadence Blocks / Dynamic Links

This topic is: Awaiting Feedback
[Awaiting Feedback]
Posted in: Kadence Blocks
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=" . esc_attr($n1_url) . '" target="_blank" rel="noopener">' . esc_html($n1) . '</a>';
$n2_link = '<a href=" . 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');

  • The forum ‘Kadence Blocks’ is closed to new topics and replies.