• Resolved chris

    (@brokeup)


    I created this custom field:

    [Material]
    type = file
    label = Please upload PDF
    size = 30
    relation = true
    mediaLibrary = true
    mediaPicker = true
    mediaRemove = true
    multipleButton = true
    multiple = true

    I want to be able to upload a PDF in the admin and display it in a post. I am echoing the attribute with the following code, and all it does is output a number 103. So I know I am doing something wrong here, but I’m still a novice PHP guy. I am also having a problem with the checkbox’s and arrays. The output just prints “array”.

    <?php if(isset($attr['Material']) && !empty($attr['Material'])){
    	echo '<div class="instructor">',$attr['Material'], '</div>';
    }?>

    I should also note that I can not delete the file after it’s already been uploaded unless I delete the file from the library, i.e. the mediaRemove button is not working properly.

    http://wordpress.org/extend/plugins/custom-field-template/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter chris

    (@brokeup)

    Anyone have any insight on this?

    Thread Starter chris

    (@brokeup)

    Figured out my own problem so I wanted to post the solution incase anyone else has this issue. I was not properly calling the file. Make sure to change the attribute “Material” to whatever your attribute is called within the Template Content section of your Template.

    <?php if(isset($attr['Material']) && !empty($attr['Material'])){?>
    <a href="<?php
       global $post;
       $material = get_post_meta($post->ID, 'Material', true);
       echo wp_get_attachment_url($material);
       ?>">Download</a>
    <? } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Field Template] Getting PDF's to work’ is closed to new replies.