• I’m trying to change some theme short-code to pull thumbnail images from a custom field instead of a thumbnail id (because the custom field images are in place), and am getting super confused.

    Anyone know how to do this?

    global $FRONTEND_STRINGS;
            $count = 0;
            while (have_posts()) {
                the_post();
                $count++;
                $subtitle = get_post_meta(get_the_ID(), '_prime_page_subtitle', true);
                $thumb_id = get_post_meta(get_the_ID(), '_thumbnail_id', true);
                $preview_image_url = prime_attachment_image_url(array(
                                                                     'att_id' => $thumb_id,
                                                                     'width' => 206,
                                                                     'height' => 139
                                                                ));
                ?>
    
                <div class="<?php echo $column_class; ?> text-align-left <?php if ($count == $num_posts) echo 'last'; ?>">
    
                    <?php if ($show_image && !empty($preview_image_url)) { ?>
                    <img src="<?php echo $preview_image_url; ?>" width="100%" class="styled-image"/>
                    <?php } ?>
                    <h4><?php the_title(); ?></h4>
    
                    <p><?php prime_recent_posts_excerpt(); ?></p>
                    <a class="continue-link" href="<?php the_permalink(); ?>">
                        <?php echo $FRONTEND_STRINGS['continue_reading'];?></a>
                </div>
                <?php
    
            }
            ?>
            <div class="clear"></div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘PHP: Using custom field instead of thumb id’ is closed to new replies.