I have a page called "News", and I have created a custom post type for news. In "News" page I need to show all news custom posts and they need to be clickable. "News" page url is http://example.com/media/lajmet. When I click on news it goes on url "http://example.com/news/article1". How to rewrite URL on custom post click to go in "http://example.com/media/lajmet/article1" ? Also I am using polylang for languages.
This is how I have create custom post type for news:
function news_custom_post() {
$labels = array(
'name' => _x( 'News', 'post type general name' ),
'singular_name' => _x( 'News', 'post type singular name' ),
'add_new' => _x( 'Add new', 'news' ),
'add_new_item' => __( 'Add new news' ),
'edit_item' => __( 'Edit news' ),
'new_item' => __( 'New news' ),
'all_items' => __( 'All news' ),
'view_item' => __( 'View news' ),
'search_items' => __( 'Search news' ),
'not_found' => __( 'No news found' ),
'not_found_in_trash' => __( 'No news found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'News'
);
$args = array(
'labels' => $labels,
'description' => 'Holds our media news data',
'public' => true,
'menu_position' => 6,
'supports' => array( 'title', 'editor', 'page-attributes', 'thumbnail'),
'has_archive' => true
);
register_post_type( 'news', $args );
}
add_action( 'init', 'news_custom_post' );