Home>Support>Comments count in Portal Theme

Comments count in Portal Theme

By Olaf Knoth, 11 years ago. Last reply by Andrew Misplon, 11 years ago.
Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hi,
thanks for the great portal theme.

But is there a way to add the numbers of comments for each article on the main page and archives?

Thank you

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 11 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Hi Olaf

    This would usually be a custom development task but let me see if I can help out:

    1. You need a child theme: https://codex.wordpress.org/Child_Themes. If aren’t running one check that link. Your style sheet in the child theme can look look as follows:

    /*
     Theme Name:   Portal Child
     Author:       SiteOrgin
     Template:     portal
     Version:      1.0.0
    */
    
    @import url(“../portal/style.css”);

    We now need to add to the portal_post_on function, to do that we need to pass it through functions.php in the child theme. So create a blank file in your child theme, name it functions.php and paste the following in:

    <?php
    
    if ( ! function_exists( 'portal_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     *
     * @since portal 1.0
     */
    function portal_posted_on() {
    	printf( __( 'Posted on <a href="%1$s" title="%2$s" rel="bookmark" rel="nofollow"><time class="entry-date" datetime="%3$s">%4$s</time></a><span class="byline"> by <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author" rel="nofollow">%7$s</a></span></span>‘, ‘portal’ ),
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( ‘c’ ) ),
    		esc_html( get_the_date() ),
    		esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
    		esc_attr( sprintf( __( ‘View all posts by %s’, ‘portal’ ), get_the_author() ) ),
    		get_the_author()
    	);
    
    	if ( comments_open() ) { 
    		echo ‘<span class="comments-link">‘;
      		comments_popup_link( __( ‘ Leave a comment’, ‘portal’ ), __( ‘ 1 Comment’, ‘portal’ ), __( ‘ % Comments’, ‘portal’ ) );
      		echo ‘</span>‘;
    	}
    
    }
    endif;

    comments_popup_link is my addition there.

    ZIP your portal-child folder and install via Appearance > Themes > Add New. You will need to redo any Appearance > Customize settings you may have been using.

    If you want the finished child theme you can find it here: https://siteorigin.com/wp-content/uploads/2014/06/portal-child.zip

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More