Skip to content

Instantly share code, notes, and snippets.

@aibrean
Created July 21, 2014 17:27
Show Gist options
  • Save aibrean/45a89fe49c7125c4d682 to your computer and use it in GitHub Desktop.
Save aibrean/45a89fe49c7125c4d682 to your computer and use it in GitHub Desktop.
Adds _blank target to PDF files in WP page content
echo str_replace('.pdf"', '.pdf" target="_blank"', get_the_content());
//may have a parameter in the get_the_content function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment