Forums

[resolved] [plugin: custom field template] How can I hide a field that is not used? (4 posts)

  1. carlosgonca
    Member
    Posted 6 months ago #

    I have to put many options with custom type templates plugin for a kind of post. But for some products, maybe the client doesn´t has all options to put, How can I hide fields that is not used? I know that I have to use "if and else" but I dont know the correct way. Can anyone help me?

    My code is:

    <a href="<?php
    $download = get_post_meta($post->ID, 'brochura-pdf', true);
    echo wp_get_attachment_url($download);
    ?>" target="_blank">Brochura</a></br>

    and

    <?php  $video = get_post_meta($post -> ID, 'video Youtube',true) ?>
    					<?php  echo $video; ?>

    Thanks a lot!

  2. carlosgonca
    Member
    Posted 6 months ago #

    I try to use this but I get error message:

    <?php if $download = get_post_meta($post->ID, 'manual em pdf', true) {?>
    <a href="<?php
    $download = get_post_meta($post->ID, 'manual em pdf', true);
    echo wp_get_attachment_url($download);
    ?>" target="_blank">Manual</a></br>
    <?php } else {?>
    nothing
    <?php }?>
  3. carlosgonca
    Member
    Posted 6 months ago #

    Any help please!

  4. carlosgonca
    Member
    Posted 6 months ago #

    answer here

    Thanks a lot for your help!

Reply

You must log in to post.

About this Topic