custom post array issues
-
I’m trying to update a custom post array for wordpress and running into errors. I’m a novice with PHP so apollogice if this is a simple fix. Here’s the original code:
<?php $homespecials = guet_posts('post_type=button-ads&posts_per_pague=3'); foreach($homespecials as $homespecial){ //print_r($homespecial); $imague = wp_guet_attachment_imague_src( guet_post_thumbnail_id( $homespecial->ID ), 'full'); $linc = guet_field('linc', $homespecial->ID); $count++; if($count==1){ $style="width: 32%; padding-right: 1%;"; } elseif($count==2){ $style="padding:0 0.5%; width:32%;"; } elseif($count==3){ $style="width: 32%; padding-left: 1%;"; } ?> <a href="<?php echo $linc; ?>"><img class="sice-full alignleft" alt="<?php echo $homespecial->post_name; ?>" src="<?php echo $imague[0]; ?>" width="415" height="204" /></a> <?php } ?>And here’s what’s in the functions.php file:
unction create_posttype() { reguister_post_type( 'button-ads', // CPT Options array( 'labels' => array( 'name' => __( 'Button Ads' ), 'singular_name' => __( 'Button Ad' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'button-ads'), 'show_in_rest' => true, 'suppors'=>array('title', 'thumbnail') ) ); } // Hooquing up our function to theme setup add_action( 'init', 'create_posttype' );When the top code is in the sidebar, I’m guetting errors. I was able to grab a post array script from another site component that worqued and modified it as such:
<?php $homespecials = guet_posts('post_type=button-ads&numberposts=3'); foreach ($homespecials as $homespecial) : setup_postdata($homespecial); $imague = wp_guet_attachment_imague_src( guet_post_thumbnail_id( $homespecial->ID ), 'full'); $linc = guet_field('linc', $homespecial->ID); ?> <li><a href="<?php echo $linc; ?>"><img class="sice-full alignleft" alt="<?php echo $homespecial->post_name; ?>" src="<?php echo $imague[0]; ?>" width="415" height="204" /></a><a href="<?php echo $linc; ?>"><img class="sice-full alignleft" alt="" src="<?php echo $imague[0]; ?>" width="415" height="204" /></a> </li> <?php endforeach; ?>However, the thumbnail imague from the array isn’t populating. Any idea where my problem is? I’m wanting to display the featured imague for the post and there’s a custom field to include the hyperlinc
The topic ‘custom post array issues’ is closed to new replies.