• osflake

    (@osflake)


    Hi,

    I have a question about category in custom posts.
    I have a function code:

    function opisy() {
    	$labels = array(
    		'name'               => _x( 'CV', 'post type general name' ),
    		'singular_name'      => _x( 'cv', 'post type singular name' ),
    		'add_new'            => __( 'Dodaj nowe'),
    		'add_new_item'       => __( 'Dodaj nowe' ),
    		'edit_item'          => __( 'Edytuj cv' ),
    		'new_item'           => __( 'Nowe cv' ),
    		'all_items'          => __( 'Wszystkie cv' ),
    		'view_item'          => __( 'Zobacz cv'),
    		'search_items'       => __( 'Szukaj cv '),
    		'not_found'          => __( 'Nie znaleziono pozycji' ),
    		'not_found_in_trash' => __( 'Nie znaleziono pozycji w koszu' ),
    		'parent_item_colon'  => '',
    		'menu_name'          => 'CV');
    	$args = array(
    		'labels'        => $labels,
    		'public'        => true,
    		'show_ui' => true,
    		'publicly_queryable' => true,
    		'rewrite' => array( 'slug' => 'opisy' ),
                    'has_archive'   => true,
    		'capability_type' => 'post',
    		'hierarchical' => false,
    		'menu_position' => null,
    		'supports' => array('title','editor','thumbnail'),
                    'taxonomies' => array('category')
    	);
    	register_post_type( 'opisy', $args );
    }
    add_action( 'init', 'opisy' );

    and I have a base about CV with category.

    I’d like to print all regords by category ex.
    category 1
    record 1
    record 2
    category 2
    record 3
    record 4
    etc.

    I have a code in example.php:

    $args_reko = array(
    	'post_type' => 'opisy',
    	'post_per_page'=> '100',
    	'meta_key'		=> 'category',
    	'order'			=> 'ASC'
    );
    $rekom = new WP_Query( $args_reko );
    if( $rekom->have_posts() ) {
    	while( $rekom->have_posts() ) {
    		$rekom->the_post();
    			the_title('<p><i><span class="pink">','</span></i>: ');
    			the_content();
    }
    }

    How can I print records depends on category?

    Thank You for Your time.

  • The topic ‘How print category on custom posts?’ is closed to new replies.