• Resolved zdzich

    (@hydrax)


    I trying to add category name after datetime and user name, on the blog list and singel threat but I now idea how to do this.

    I want to make it look:

    TITLE NAME (post title)
    bellow
    DATE , AUTHOR, CATEGORY
    bellow
    the content

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    For adding category to your blog list and single threat you have to customize the dellow_posted_on function which is define under theme inc/template-tags.php file.
    You can replce your function with these..

    function dellow_posted_on() {
    	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) )
    		$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
    
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    	);
    
    	printf( __( '<span class="posted-on"><i class="icon-time"> </i> %1$s</span> <span class="byline"> <i class="icon-user"> </i> %2$s</span><span >%3$s </span>', 'dellow' ),
    		sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>',
    			esc_url( get_permalink() ),
    			$time_string
    		),
    		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			esc_html( get_the_author() )
    		),
    	sprintf( ' | <span class="cat ">'.get_the_category_list( _x( ',' ) ).'</span>')
    	);
    }

    I think it will work for you. Check it..

    Thread Starter zdzich

    (@hydrax)

    It’s works but i have error information

    Warning: Missing argument 2 for _x(), called in /home/…/wp-content/themes/dellow/inc/template-tags.php on line 222 and defined in /home/…/wp-includes/l10n.php on line 246

    Line 222 on template-tags.php its:

    sprintf( ‘ | <span class=”cat “>’.get_the_category_list( _x( ‘,’ ) ).'</span>’)

    You can replace

    sprintf( ‘ | <span class=”cat “>’.get_the_category_list( _x( ‘,’ ) ).'</span>’)

    these with below code:

    sprintf( ‘ | <span class=”cat “>’.get_the_category_list((‘,’)).'</span>’)

    Thread Starter zdzich

    (@hydrax)

    Yahh ?? Its works fine, thats great thanks so much ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category name after user’ is closed to new replies.