Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Am newbie. I have a custom post type 'dogs' and i want just 2 custom fields in this type. A pic on the left and text on the right - repeatable fields. Anyone know how to do this? I've no clue of php but can copy and paste! Am using Suffusion Custom Post Types and Custom Field Suite - I tried doing the above but I think i need to put some code in some php file somewhere...but I don't know where? or what code?! Thanks

share|improve this question
1  
you can't do this without any clue of PHP –  JMau Jun 24 '13 at 19:16
add comment

1 Answer

Yes I see you're right JMa - thought there would have been a simple copy past solution. So I've been trying to get my head around php. I created a template_dogs.php which includes the below code.

I put this into my child suffusion templates folder. It's picking the alt text up but not the image or description (the image comes in as a small square). And my footer doesn't display properly. I used Active Custom Fields plugin.

<?php
/**
 * Template Name: Dogs
 */

get_header();
?>
<div id="main-col">
    <div id="content" class='hfeed content'>
      <?php if(get_field('dogs')): ?>
        <div id="dogs">
            <?php while(the_repeater_field('dogs')): ?>
            <?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
            <img src="<?php echo $image[0]; ?>" alt="<?php  the_sub_field('image_alt');?>" />
            <?php the_sub_field('description');?>
        <?php endwhile; ?>
    </div>
<?php endif; ?>
<?php get_footer(); ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.