Support » Plugin: Pods - Custom Content Types and Fields » magic tag to string.

  • Resolved gooss007

    (@gooss007)


    For so far I got everything setup.

    I am having trouble to find a solution to the following.

    In my template I use.
    $urllong = “{@component_table}”;
    echo fileSize($urllong);

    Now when using the function fileSize()
    I need to clip the first 7 characters from this variable.

    When doing so I get “nent_table}”

    What I need is to get the value of {@component_table} to be put in the string, instead of the magic tag.

    Gerard

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    It looks like you are combining two different things.
    Magic tags can be used in Pods templates and shortcodes. Not in theme templates.
    PHP can only be used in theme templates and not in Pods templates.

    For PHP (theme templates) please see this page:
    https://docs.pods.io/displaying-pods/wordpress-theme-templates/

    In short, please look into the get_post_meta function from WordPress:
    https://developer.wordpress.org/reference/functions/get_post_meta/

    Cheers, Jory

    Thread Starter gooss007

    (@gooss007)

    Hello Jory,

    I have this in my template:

    <?php
    $urllong = "{@component_table}";
    echo $urllong;
    ?>

    This shows the information stored in {@component_table}
    But when clipping the left 2 characters it will show “component_table}”.

    What I need is to get the value from {@component_table} directly into the string $urllong.

    Can this be done in a function?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @gooss007

    Please re-read my comment 😉
    You cannot use magic tags in a PHP template. See get_post_meta().

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘magic tag to string.’ is closed to new replies.