• Can I just add php code in custom field and get output as usual? I know it can recon html tags, so I guess php code might work as well?

    Some plugins can help doing this, but I really don’t need an additional plugin to do only an inputting job.

    Any advice?
    Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • popper

    (@julialasarte)

    I don’t think you can do that. What do you need to do? Maybe it can be accomplished with a short-code, or a theme function?

    Thread Starter imjscn

    (@imjscn)

    I made a customized template, grid style, the idea is to put in different content in the blocks on several pages.
    Your reply suggested me the idea– use conditional tags and functions in the template to get different output, right?

    popper

    (@julialasarte)

    Yeah, I’m still not sure what is exactly what you want to do, but you could easy set up a couple of functions in the functions.php of your theme, and use the custom field as a parameter to that function, or call a function depending on the value of the custom field, which could give you the same results as being able to code directly into the custom field.

    Thread Starter imjscn

    (@imjscn)

    I set up 6 blocks on this grid page by using custom field, for example:
    <div class="block-content"><?php if(function_exists('get_custom_field_data')) {get_custom_field_data('grid-1', true);} ?></div>
    If a page has a custom field value for “grid-1”, this block will print contents of “grid-1”.
    Then, I will use grid-1 for static content, grid-2 for slide show, grid-3 for member stats, grid-4 for featured post, grid-5 for forum recent activities, grid-6 for advertisment.
    In case I use this template for another page, I can use grid-1 for service-1, grid-2 for service-2, grid-3 for service-3, and so on…
    Am I using the correct method to implement this idea?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can I add php code in custom field?’ is closed to new replies.