Support » Fixing WordPress » Custom Post Types and titles

  • Resolved bobquznie


    OK. Having trouble here. Below, bold part in the code, is where I’m having troubles. I have a section that needs to pull the 4 latest posts from an array of custom post types. On top of the image I need it to say what “category,” custom post type, that post is in. Right now, it doesn’t pull any information with the code I have inserted. I am searching the Codex for any answer and am trying whatever I find but if anyone has any input, it would be very helpful. Thank you!

    <section class="info">
                                    'post_type' => array('infographics','ebooks','whitepapers','case-studies'),
                                    'posts_per_page' => 4,
                    <?php if(have_posts()):?>
                    <header class="title">
                            <div class="title-holder">
                                    <h2>Latest Retail Info & Resources</h2>
                                    <p>The latest in our original research. All for you.</p>
                            <?php if(function_exists('get_field')):?>
                            <div class="btn-holder">
                                <?php if(function_exists('get_field')):?>
                                <?php $category = get_the_category();
                                $value = get_field('see_our_full', 'category_2'); ?>
                                 <a href="">See our Full Library of Resources</a>
                                 <?php endif;?>
                            <?php endif;?>
                    <div class="post-list">
                    <?php while(have_posts()): the_post();?>
                            <article class="post">
                                    <div class="image-holder">
                                        <?php if(has_post_thumbnail()):?>
                                            <a href="<?php the_permalink();?>">
                                                    <?php the_post_thumbnail('home-post-thumbnail_148_137');?>
                                        <?php endif;?>
                                            <span class="add"><strong><?php post_type_archive_title(); ?></strong></span>
                                    <div class="description">
                                            <h3><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
                                            <?php the_excerpt(); ?>
                    <?php endwhile;?>
                    <?php endif;?>
                    <?php wp_reset_query();?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Post Types and titles’ is closed to new replies.