Home Forums Gutenberg Is it possible to style one custom field with another?


Is it possible to style one custom field with another?

  • I am creating an archive of my all the newspaper stories I wrote during my previous career as a journalist. I have created a custom ACF pro box in WordPress with all the relevant information for each article including headline, date and publication number etc.

    Each article also has a unique image as well as downloadable PDF.

    I would like to display the unique image for each article ($newspaper_clipping) and I would like that image to be linked to the downloadable PDF ($pdf_download) so that when you click on the image you are taken to the file.

    I think I could accomplish this by tweaking the PHP code in the ACF block file (shown below) but I’m not exactly sure how.

    I am hoping someone might be able to help me with this. Thank you in advance.

    /* Print Version Template */
    $title = get_field('publication_title') ?: 'Publication Title';
    $location = get_field('publication_location') ?: 'Publication Location';
    $issue = get_field('issueNumber') ?: 'Issue Number';
    $page_count = get_field('page_count') ?: 'Page Count';
    $pagination = get_field('pagination_') ?: 'Pagination';
    $pdf_download = get_field('pdf_download') ?: 'PDF Download';
    $newspaper_clipping = get_field('newspaper_clipping') ?: '';
    <div class="print-version"
      <p class="publication-title"> <?php echo $title ?> </p>
      <p class="publication-location"> <?php echo $location ?> </p>
      <p class="issueNumber"> <?php echo $issue ?> </p>
      <p class="page_count"> <?php echo $page_count ?> </p>
      <p class="pagination_"> <?php echo $pagination ?> </p>
      <p class="pdf_download"> <?php echo $pdf_download ?> </p>
      <img src=" <?php echo $newspaper_clipping ?> ">
    <a href="<?php echo $pdf_download; ?>"><img src=" <?php echo $newspaper_clipping ?> "></a>
  • Hi John. Thank you very much for your quick and refreshingly to-the-point response. It worked like a charm!

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.