Skip to content

Namespace #22

Description

@mrleblanc101

Hi,
I was using this in the template:

{% set buttonLink = function('get_page_url_for_custom_post_type', 'recette') %}

But I get this warning:

Deprecated: La fonction get_custom_post_type_for_page est obsolète depuis la version 1.0.0 ! Utilisez \n5s\PageForCustomPostType\get_custom_post_type_for_page() à la place.

I wasn't sure how to use namespace directly inside Twig because when I tried it didn't work.
Then I asked Claude and it gave me this. Apparently I needed to escape the backslash by using double backslash.

The chance of collision are pretty small.

{% set buttonLink = function('n5s\\PageForCustomPostType\\get_page_url_for_custom_post_type', 'recette') %}

Is there a reason why we absolutely NEED to include the namespace when inside template ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions