• In the template I am using, there is a link to pdf at the end of each entry on the single post page. It seems to be accomplished with the following code:

    `<div class=”entrytext”>

    <?php the_content(‘<p class=”serif”>Read the rest of this entry »</p>’); ?>

    <?php link_pages(‘<p>Pages: ‘, ‘</p>’, ‘number’); ?>’

    When I try to carry over the relevant piece from the above code, it only works if I bring over the entire entry as well as the link to PDF.

    See here:
    https://blog.williamatwellclary.com/?p=134
    At the end of the entry I get the link to a PDF.

    But here in search results:
    https://blog.williamatwellclary.com/?s=pie

    And here in the category listing:
    https://blog.williamatwellclary.com/?cat=18

    I can’t get the link to PDF to appear under the entry title, like this:

    White Chocolate Pecan Truffles
    Download PDF: White Chocolate Pecan Truffles.pdf

    Chocolate Truffles
    Download PDF: Chocolate Truffles.pdf

    Another issue: there seems to be a limit on the # of items returned in a search or a category archive on a given page. I want to make that unlimited. Help?

    Thanks,

    m

Viewing 8 replies - 1 through 8 (of 8 total)
  • 1. There is nothing in your code at the top that links to a pdf file :0

    2 & 3. You have quite a customized archive.php and search.php – displaying only the titles. Who did that if not you?
    (archive.php is displaying your categories)

    Edit the file and add the_content

    4. The # of posts displayed is set by you: Options > Reading: Show at most…

    Thread Starter mstark

    (@mstark)

    Thanks for solving the # of posts displayed problem.

    re: 1, i am sure that code delivers the PDF. If you view source on one of the single entry pages, you can see that the php rendered the link to the pdf.

    re 2&3 I have been tinkering with the default template. But I don’t understand your comment, “Edit the file and add the_content”

    please explain.

    Thanks,

    m

    Thread Starter mstark

    (@mstark)

    This:
    <div class="entrytext">
    <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    <?php link_pages('<p>
    Pages: ', '</p>', 'number'); ?>'

    Produces this:
    <p>Download PDF: <a id="p276" href="https://blog.williamatwellclary.com/wp-content/uploads/2006/12/Bourbon%20Pumpkin%20Cheesecake.pdf">Bourbon Pumpkin Cheesecake.pdf</a>
    </p>

    But only on the single post page. Why can’t I get this to work on the search or category page?

    Thread Starter mstark

    (@mstark)

    I read through that and another page dedicated to categories. Maybe I am just dumb as a post…but I don’t see a solution in there.

    Can you elaborate?

    Thanks,

    m

    Different views in WP are shown by using different template files from your theme.

    You are showing/quoting above the code from your signle.php file which is used to display this:
    https://blog.williamatwellclary.com/?p=134

    When you view a category archives, like this:
    https://blog.williamatwellclary.com/?cat=18
    the template file in action is archive.php.
    That one, obviously does NOT have the code youo are claiming it has.
    Hmmm… on a closer look: it has but it is commented out by certain individual named “Matt”. Talk to him.

    Thread Starter mstark

    (@mstark)

    exactly! We aren’t communicating very well here. If I uncomment that bit it will show:

    1) the entire entry; and
    2) the link to the PDF

    I don’t want the category or search pages to show the entire entry, just a title (linking to full entry) and the link to the PDF.

    When I uncomment that bit of text you saw here: https://blog.williamatwellclary.com/?cat=18
    AND also remove the code that seems to render the full entry, I also lose the link to the PDF. Its as if the link to the PDF is dependant on showing the full entry as well.

    I don’t get it.

    Thanks for hanging in there helping me.

    Best,

    m

    Thread Starter mstark

    (@mstark)

    update: I have moved the sit to a new URL:
    https://www.tinboxrecipes.com

    Also, I still don’t have any idea why this isn’t working. Please help!

    m

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Need help adding link to PDF in search and archive’ is closed to new replies.