• Resolved havidz

    (@havidz)


    i was create CPT called ‘Artikel Komunitas’
    But the posts not appear in post count in users list
    also, not appear when we click on author archieve page

    can you tell me hoow to appear it without any code?
    i have read forum, need to click on checkbox of all of taxonomies but its not work

    please, thanks

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure on the post count portion, that’d be something that should be getting handled by WordPress core, and it’s not a setting/detail we’ve intentionally prevented from working.

    Regarding authors, sadly there’s going to need to be some code for this. The snippet below will fetch all the post types registered with CPTUI and include them in the author archive query

    function my_cptui_add_post_types_to_archives( $query ) {
    	// We do not want unintended consequences.
    	if ( is_admin() || ! $query->is_main_query() ) {
    		return;    
    	}
    
    	if ( is_author() && empty( $query->query_vars['suppress_filters'] ) ) {
    
    		// Replace these slugs with the post types you want to include.
    		$cptui_post_types = cptui_get_post_type_slugs();
    
    		$query->set(
    	  		'post_type',
    			array_merge(
    				array( 'post' ),
    				$cptui_post_types
    			)
    		);
    	}
    }
    add_filter( 'pre_get_posts', 'my_cptui_add_post_types_to_archives' );
    Thread Starter havidz

    (@havidz)

    sorry, where i add this code sir? thanks

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The best place is likely going to be your active theme/child theme’s functions.php file. However, we can also provide a quick plugin with just this code in it as well, if you prefer something you can install and activate instead.

    Thread Starter havidz

    (@havidz)

    so, tell me the plugin, sir
    thanks

    Thread Starter havidz

    (@havidz)

    sir that code is fully inserted to theme function.php?
    full of that code? or any something have to modify?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I have created a quick plugin for you to activate and install that has all and only the code I provided above. You can find a zip copy of it at https://www.dropbox.com/scl/fi/zsdoruipkcpslupbk2mw9/havidz-cptui-posts-in-author-archives.zip?rlkey=ydy76wqqnwvmoqvxrapvt601l&dl=0

    This should save you from having to copy/paste/save to a functions.php file.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sir, How to showing post author for CPT’ is closed to new replies.