Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] Attachments

Home Forums Support Attachments

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #142892
    Francesca

    Dear All,
    I have two questions:
    1) is it possible to add pdf attachments to a “page” ? (e.g. a downloadable CV or a document)
    2) I have purchased all the add-ons and I would like to know is it is possible that the front page JUST show post in a Category instead of all the posts.

    Thanks for helping. I am having fun with GeneratePress but I still can not answer these two questions

    #142896
    bdbrown

    Hi Francesca.

    1) You can add an anchor tag with a URL to the document directly in the page content, like so:

    <a href="http://path-to-your-document.pdf" target="_blank">My Document</a>
    

    2) Add the following function to set the category on the home page:

    add_action( 'pre_get_posts', 'my_home_category' );
    function my_home_category( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'cat', '123' );
        }
    }
    

    Change “123” to the category ID you wish to display. Here is the Codex reference:
    https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Show_Only_One_Category_on_Home_Page

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    If you’re not yet using a child theme you can download one from the above link.

    #142945
    Tom
    Lead Developer
    Lead Developer

    1. You can also click the “Add Media” button (like when adding an image) and upload your PDF through there. Then when you click Insert it will insert a link to the PDF 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.