[Resolved] Elements template tags

Home Forums Support [Resolved] Elements template tags

Home Forums Support Elements template tags

  • This topic has 7 replies, 3 voices, and was last updated 5 years ago by Tom.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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

    #851226
    David
    Staff
    Customer Support

    Hi 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

    #851501
    tobymiguel

    Hey David

    I edited my answer with an example url πŸ™‚

    #851879
    Tom
    Lead Developer
    Lead Developer

    Hi 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 πŸ™‚

    #852185
    tobymiguel

    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}} πŸ™‚

    #852641
    Tom
    Lead Developer
    Lead Developer

    Just 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 ) )
        );
    } );
    #858882
    tobymiguel

    Perfect !

    #859611
    Tom
    Lead Developer
    Lead Developer

    Awesome πŸ™‚

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