How do you use WP slugs for PDF files / media?

In my opinion it is best to add an endpoint of the form mysite.com/pdf/<id> or something similar to your like. That way you avoiding attaching the attachments to posts/pages or create a page for each pdf file with is redundant imo for your needs. This is a very small and basic guide. You can modify … Read more

Open Custom Post Type as PDF

You may want to try a few PDF generation plugins out there. I did some quick Googling and found https://wordpress.org/plugins/wp-pdf-generator/ (but I would recommend searching for others). Once installed, you can directly link your users to the “generate pdf” link instead of the Custom Post Type permalink, generating the PDF automatically for them. You can … Read more

Make page tab link to pdf

If you are talking about menus and your theme uses the Menu API, then upload the PDF to a publicly accessible server– doesn’t have to to be the one your site uses– then go to Appearance -> Menus, Navigate to a menu, or create one find the “Links” dialogue, input the URL and the link … Read more

List and show uploaded pdf files dynamically

Possibilities to fetch attachments WordPress saves files not only to a physical disk, but as well as attachment post type into your MySQL/MariaDB database. This means you have two possibilities to query for uploaded files and you have to chose what you need in which scenario/context. Filesystem only To loop through all files or a … Read more

Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]

I’ve found what’s been missing in the code. You have to add this also: add_filter( ‘wpcf7_mail_components’, ‘mycustom_wpcf7_mail_components’ ); function mycustom_wpcf7_mail_components( $components ) { $components[‘attachments’][] = get_template_directory().’/pdf/test.pdf’; return $components; } Now everything is working fine and the file is attached to email without the need to add fields in the contact form.

Force PDF download from custom menu?

If you don’t mind all PDF attachments been forced to be downloaded then you can use something like this: <?php if (have_posts()) : while (have_posts()) : the_post(); $pdf_title = $post->post_title; $uploads_dir = wp_upload_dir(); $attachment_src = get_post_meta( $post->ID, ‘_wp_attached_file’, true ); $pdf_src = path_join( $uploads_dir[‘basedir’], $attachment_src ); header(“Pragma: public”); // required header(“Expires: 0”); header(“Cache-Control: must-revalidate, post-check=0, … Read more

how do i embed the pdf gallery in wordpress post

You can use the Custom URL field, to modify the attachment link for each one of your gallery images: where this is supported by the following plugin: <?php /** * Plugin Name: Custom Attachments Links * Description: Adds a new media field, to override the default attachment links. * Plugin URI: http://wordpress.stackexchange.com/a/176668/26350 * Plugin Author: … Read more