Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author finnj

    (@finnj)

    Hi,

    I am not sure which post count you are referring to…..

    And why do you wan’t to show it in the header ?

    Thread Starter Anggriyawan Nugraha

    (@anggriyawan)

    Plugin Author finnj

    (@finnj)

    You can enter the below code, but be aware that it will execute a sql every time the page is loaded:

    if	( is_user_logged_in() )
    		{
    		global $current_user, $wpdb;
    		$author_id		= (int) $current_user->ID;
    		$author_name	= $current_user->display_name;
    		$tmp_count	= $wpdb->get_var("SELECT count(ID) AS tmp_post_cnt FROM $wpdb->posts WHERE post_author = ".$author_id." AND post_status = 'publish' AND post_type = 'post'" );
    		if (intval ($tmp_count) > 0)
    			echo "<br>You have publised ".$tmp_count." posts<br>";
    		else
    			echo "<br>You haven't publised any posts yet<br>";
    
    		}

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Post Count in Other Places’ is closed to new replies.