[Resolved] How to add Edit link to Blog Archives

Home Forums Support How to add Edit link to Blog Archives

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1063305
    Jim

    I’m guessing this might require editing a child theme template, but not quite sure which one or exactly how…

    How can I add and style an “Edit” link next to each post on the Blog Archives pages? This needs to only be visible to logged in Admin users. Clicking the link would open the post editor for that specific post, or page.

    Once logged in, the “Edit Post” link in the Admin Bar is fine for editing that post. Our previous theme, however, displayed an “Edit” link under the title of each post on the Blog Archives, tag/category listings, or Search Results page.

    Thanks!

    #1063533
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try this:

    1. Add a Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
    2. Give it this content:

    <?php edit_post_link( __( 'edit', 'textdomain' ), '<p>', '</p>' ); ?>

    3. Check the “Execute PHP” option.

    4. In the Display Rules, choose your archives/search results and make it so it only appears to logged in users.

    Hope this helps 🙂

    #1064287
    Jim

    Thank you!

    We have not yet activated the Elements module. Does that have any additional impact on PageSpeed performance? For example, are additional resources loaded on all pages, even if no custom elements are being called?

    #1064293
    Leo
    Staff
    Customer Support

    Should only have minimal impact.

    You can do a quick speed test before and after adding the code.

    #1064306
    Jim

    “minimal” is relative… 😉

    Thanks again.

    #1064307
    Leo
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.