custom field File or link type

Home Forums Product Support Forums Ajax Search Pro for WordPress Support custom field File or link type

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #32233

    Hi there.

    I’m trying to pull a custom field that is a group — a link and a file, one or the other is filled out always.

    I want to build a button on the results page that will pull either the link when filled out or the file download right on to the results. this is how its working on the single-posttype.php file:

            <?php if( have_rows('file_upload_or_direct_link') ): ?>
                <?php while( have_rows('file_upload_or_direct_link') ): the_row(); 
                   $file = get_sub_field('file_upload');
                   $url = get_sub_field('file_link');
                  if( $file ): ?>
                  <a class="articleFileDownload" href="<?php echo $file['url']; ?>">Download PDF</a>
                <?php endif; ?>
                  <?php if ($url): ?>
                    <a href="<?php echo $url; ?>" class="outwardLinkArticle" target="_blank">Follow Link to Access document</a>
                  <?php endif; ?>
                 <?php endwhile; ?>
            <?php endif; ?>

    any suggestions on how to incorporate this into the $r->content; or otherwise just pull it in to the results page?


    Ernest Marcinko
    Ernest Marcinko


    Sure! Use the asp_results filter for that.
    Keep in mind, that it is not a posts loop, so you may have to change some of the functions there to pass the post ID argument via the $r->id variable in the foreach loop or use the setup_postdata function if that works.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.