I've been trying to get my custom post title but so far no luck, I tried the reference as well couldn't make it to work.
function create_aop_post_types(){
$args = array(
'label' => 'News',
'public' => true,
'rewrite' => array( 'slug' => 'news' ),
'has_archive' => true,
'menu_position' => null,
'taxonomies' => array('category', 'post_tag'),
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields', 'revisions' )
);
register_post_type( 'news', $args );
Trying to output 'label' => 'News' in a href and I tried the_title(); with permalink.
<div class="feedhead news clearfix"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo get_the_title(); ?></a></div>
<div class="newscol-items">
<?php
//Instead do this using a WP Query and loop.
$queryargs = array(
'post_type'=>'news',
'showposts'=>5
);
query_posts($queryargs);
if (have_posts()){
$count = 0;
while (have_posts()) {
the_post();
$count++;
get_template_part('content','news');
}
} else {
get_template_part('content','noposts');
}
wp_reset_query();
?>
</div>
so far I'm only doing but I'm sure there is a better way of doing it than what I've tried.