- This topic has 7 replies, 3 voices, and was last updated 3 years, 11 months ago by
Tom.
-
AuthorPosts
-
March 26, 2019 at 5:12 pm #850888
tobymiguel
I have two problems with elements template tags I hope you can help with.
I use this function made by tom to display number of comments in the header:
add_shortcode( 'comment_number', 'tu_comment_number_sc' ); function tu_comment_number_sc() { ob_start(); comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); return ob_get_clean(); }
The problem is that it links to #respond or #comments, and when I click the link nothing happens. It does not go to the comment section. I am using Disqus with Disqus Conditional Load plugin, I am not sure if this is why or if it is possible to fix. Even after making sure comments are loaded it doesn’t work.
Next thing is when I use
{{post_author}}
, it will link to the Author archive. Is it possible to disable this?Thank you so much, I really love this theme and the support I get here
GeneratePress 2.2.2GP Premium 1.7.8March 27, 2019 at 5:02 am #851226David
StaffCustomer SupportHi there,
any chance you can link us to the site? You can edit your original topic and use the Site URL field for privacy. Not sure on the first issue as its not using the standard comments but we can look.
The author link we can disable with some CSS
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 27, 2019 at 7:26 am #851501tobymiguel
Hey David
I edited my answer with an example url π
March 27, 2019 at 3:36 pm #851879Tom
Lead DeveloperLead DeveloperHi there,
You could try this:
add_filter( 'respond_link', function() { return get_permalink() . '#disqus_thread'; } ); add_filter( 'get_comments_link', function() { return get_permalink() . '#disqus_thread'; } );
Let me know π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 28, 2019 at 2:26 am #852185tobymiguel
Hi Tom
It works if there are no comments, if there is more than 0 comments the link doesn’t change π
Also, was it possible to disable the Author archive link when using
{{post_author}}
πMarch 28, 2019 at 8:48 am #852641Tom
Lead DeveloperLead DeveloperJust updated the code above.
As for the post author, try this:
add_filter( 'generate_page_hero_post_author', function() { global $post; $author_id = $post->post_author; return sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author"><span class="author-name" itemprop="name">%s</span></span>', esc_html( get_the_author_meta( 'display_name', $author_id ) ) ); } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 3, 2019 at 5:20 pm #858882tobymiguel
Perfect !
April 4, 2019 at 8:13 am #859611Tom
Lead DeveloperLead DeveloperAwesome π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.