WordPress.org

Ready to get started?Download WordPress

Forums

Need help adding link to PDF in search and archive (9 posts)

  1. mstark
    Member
    Posted 7 years ago #

    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:
    http://blog.williamatwellclary.com/?p=134
    At the end of the entry I get the link to a PDF.

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

    And here in the category listing:
    http://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

  2. moshu
    Member
    Posted 7 years ago #

    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...

  3. mstark
    Member
    Posted 7 years ago #

    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

  4. mstark
    Member
    Posted 7 years ago #

    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="http://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?

  5. moshu
    Member
    Posted 7 years ago #

  6. mstark
    Member
    Posted 7 years ago #

    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

  7. moshu
    Member
    Posted 7 years ago #

    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:
    http://blog.williamatwellclary.com/?p=134

    When you view a category archives, like this:
    http://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.

  8. mstark
    Member
    Posted 7 years ago #

    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: http://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

  9. mstark
    Member
    Posted 7 years ago #

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

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

    m

Topic Closed

This topic has been closed to new replies.

About this Topic