- This topic has 8 replies, 2 voices, and was last updated 3 years, 3 months ago by Leo.
-
AuthorPosts
-
January 16, 2021 at 7:42 am #1621393Edgar
Hi…
I just started using GP last week for my blog, and I wanted a more conspicuous way for readers to add a comment after reading each post. So I added as the last line of the post, the following HTML link:
<p style="text-align:right"><a href=”https://www.mouseprint.org/2021/01/11/godaddy-offers-employees/#respond">Leave a comment</a></p>
Which renders like this at the bottom right of the post:
(My permalinks are of this style: https://www.mouseprint.org/2021/01/11/godaddy-offers-employees/ )
Rather than have to add this line manually to each post, and embed the new permalink each time in the HTML, is there some automated way to have this “add a comment” link added to each post as the last line?
Thanks,
EdgarJanuary 16, 2021 at 11:32 am #1621624LeoStaffCustomer SupportHi there,
You can try using a hook element:
https://docs.generatepress.com/article/hooks-element-overview/The hook you are after should be
generate_after_entry_content
.Let me know if this helps 🙂
January 16, 2021 at 11:37 am #1621631EdgarHi Leo…
I am a newbie, so I need more hand-holding and specific code. I have created hooks, but you need to tell which of the several varieties and options to choose. And I need the explicit code to enter there.
Hope you can help.
Thanks,
Edgar
January 16, 2021 at 4:42 pm #1621837LeoStaffCustomer Support– Create a new Hook element.
– Add this as content:
<a href="#respond">Leave a comment</a>
– Choose
generate_after_entry_content
under the Hook.– Go to display rules and select Post > All Posts.
January 17, 2021 at 4:22 am #1622145EdgarHi Leo…
Unfortunately that did not work.
Under Elements, add new element, I followed your instructions, but nothing new was displayed on existing posts on the website.
I even tried variations like “../#respond” and “/#respond” with no success.
Can I propose an easier solution to my problem? GP automatically puts a comment link and count at the end of each post. I used some custom CSS to move it to the right and make it slightly larger. What I am not able to do is make the font blue like all the other links using this code:
.comments-link { font-size: 22px; text-align: right; color: blue; text-decoration: underline }
Can you suggest a way to make the font blue?
Thanks,
EdgarJanuary 17, 2021 at 10:35 am #1622660LeoStaffCustomer SupportHmm my solution should work.
I actually tested it as seen here:
https://www.screencast.com/t/D4UyRGZiCan you make sure you did the same thing?
If this still doesn’t work then please link me to the page in question.
January 17, 2021 at 10:48 am #1622679EdgarHi Leo…
It absolutely did not work. In your demo, I think you may be just duplicating the already built-in “add a comment” feature and what you are seeing is the automatically generated one. If you change the wording of your hook, I don’t think you’ll see it come up anywhere.
In any event, I finally just figured out how to use that build-in add a comment by adding the following custom CSS:
.comments-link { font-size: 22px; text-align: right; color: #3274C0; } a:link { color: #3274C0; } a:visited { color: #3274C0;
I don’t want to go back and undo everything to demonstrate how the code you provided did not work. I appreciate all your efforts.
Edgar
January 17, 2021 at 11:10 am #1622690EdgarLeo…
Just as a demonstration, I just undid my changes and used your code instead… but I called the link “Don’t leave a comment”.
I activated it, and you will see that that new link did not appear anywhere.
See screen capture. This will download rather than display.
Hope this helps.
Edgar
January 17, 2021 at 7:13 pm #1622896LeoStaffCustomer SupportIf you change the wording of your hook, I don’t think you’ll see it come up anywhere.
The text can be whatever you want, the important part is the link which takes you to the reply section.
I thought that’s what you wanted but maybe I misunderstood.
Glad you found a solution for your need.
-
AuthorPosts
- You must be logged in to reply to this topic.