• Resolved Morris Gilles

    (@morris-gilles)


    Hi there,

    first of all, thanks for your amazing plugin!!!

    I am experiencing some trouble implementing the “before content” filter. Basically, if you open a PDF on my website (https://easteuropeanfilmbulletin.com/dancer-in-the-dark/?pdf=120), it will show the title of the PDFed post on ALL PDF pages. I want to change this to have it show only on the FIRST page of the PDF. I have two questions:

    1. Can I have the title show only on the first page by using the “before content” filter?
    2. If so, could you roughly tell me how I can do this? I saw that you have a documentation regarding your filters, but I don’t know where to enter them… (I have experience working with php on my website, but haven’t ever added filters or altered plugins, so I don’t know which php files I need to add/alter to make the title disappear on all but the first page of the PDF.)

    Thanks in advance!!!!!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Morris Gilles

    (@morris-gilles)

    I have found an inelegant php solution (see PDF link above), would still appreciate general advice on the possibility of working with filters (as mentioned, I just want to know WHERE I have to add the filters). Thanks!

    Plugin Author dinamiko

    (@dinamiko)

    Hi Morris Gilles,

    you can add the filter in your theme (or child theme) functions.php

    to show the post title before the content you can use something like this:

    function custom_dkpdf_before_content() {
       $output = '<h1>'.get_the_title().'</h1>';
       return $output;
    }
    add_filter( 'dkpdf_before_content', 'custom_dkpdf_before_content' );

    Thanks,
    Emili

    • This reply was modified 8 years, 8 months ago by dinamiko.
    Thread Starter Morris Gilles

    (@morris-gilles)

    Awesome, thanks Emili.

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

The topic ‘Before Content’ is closed to new replies.