• Resolved strarsis

    (@strarsis)


    On events archive page I want to assign each month (group) title element an ID (month name) so I can directly link to it (anchor).
    However, but apparently these variable placeholders (e.g. #F) are escaped / not interpolated when being used in HTML attribute values (e.g. <h2 id="#F">).
    How can I achieve these IDs so that I can link to each month (group) in events archives?

Viewing 5 replies - 1 through 5 (of 5 total)
  • #F is not a shortcode… Try #_{F} instead.

    Thread Starter strarsis

    (@strarsis)

    Thank you for the quick response!
    Is it also somehow possible to make the name of month lowercase?

    Not easily, because the names of the months are controlled by the WordPress text domain. My own problem: In Dutch we spell months lower case, but if it’s a single word we use a capital. WP just does not get that… ??

    You could try and make a custom placeholder…
    #_MONTH (or something) and in that functions use strtolower()

    Here you go ??
    Use #_MONTH to display the month in lowercase in your own locale.

    Add this to your functions.php:

    function stonehenge_em_lowercase_month($replacement, $EM_Event, $result) {
        if($result === '#_MONTH') {
            $replacement = strtolower($EM_Event->output("#_{F}"));
        }
        return $replacement;
    }
    add_filter( 'em_event_output_placeholder','stonehenge_em_lowercase_month',1,3);
    
    Thread Starter strarsis

    (@strarsis)

    @duisterdenhaag: Awesome! There is an issue though that this filter doesn’t seem to be used for the group title in events page. For debugging I used echo $result; but no placeholder names used in the group title are listed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unintended escaping of variables’ is closed to new replies.