0

I spent my afternoon as a graphic designer trying in vain to find the right grammar for a damn php code that will probably look childish to some. I'm trying to put a file upload ACF block in a shortcode, but I obviously don't have the right wording

add_shortcode('delib-fichier', function($atts, $content)
{
    $delib_fichier = get_field( 'delib-fichier' );
    
      $output="";
      $url = wp_get_attachment_url( $file );
      if($delib-fichier){
      $output .= <a href="<?php echo esc_url( $delib_fichier['url'] ); ?>"><?php echo esc_html( $delib_fichier['filename'] ); ?></a>
      }
      return $output;
});

I now the $output line contains a pure piece of nonsense, but I'm like a kid in front of a Rubiks tonight.

Thanks for your help!!

Calikyo
  • 1
  • 2
  • 1) The whole string needs to be quoted. 2) You're already in a PHP block, so remove all of the opening and closing PHP codes in that line. – aynber Jun 03 '22 at 15:51

0 Answers0