Site logo

Reply To: How to add another field of text to a Post listing

Home Forums Support How to add another field of text to a Post listing Reply To: How to add another field of text to a Post listing

Home Forums Support How to add another field of text to a Post listing Reply To: How to add another field of text to a Post listing

#1210394
Tim

Hi David

The Element code now looks like this, please tell me if I can improve on that in some way:

<?php if( get_field('job_position') ): ?>
    <h2><?php the_field('job_position'); ?></h2>
<?php endif; ?>

<?php if( get_field('nationality') ): ?>
    <p>Nationality: <?php the_field('nationality'); ?></p>
<?php endif; ?>

<?php if( get_field('qualification') ): ?>
    <p>Qualification: <?php the_field('qualification'); ?></p>
<?php endif; ?>

<?php if( get_field('skills') ): ?>
    <p>Skills: <?php the_field('skills'); ?></p>
<?php endif; ?>

<div>
    <?php $portrait = get_field('portrait'); ?>
    <img src="<?php echo $portrait['url']; ?>" alt="<?php echo $portrait['alt']; ?>" />
</div>

<?php if( get_field('description') ): ?>
    <p><?php the_field('description'); ?></p>
<?php endif; ?>

<?php if( get_field('quote') ): ?>
    <blockquote><?php the_field('quote'); ?></blockquote>
<?php endif; ?>

<?php if( get_field('citation') ): ?>
    <cite><?php the_field('citation'); ?></cite>
<?php endif; ?>

All the elements display.

What I would like to do now is make the necessary changes to style them in the standard wp format which you can see below the custom entry.

Of particular note, the style required to float left the position, nationality, qualification, skills, and float right the portrait.

What I wonder about here with the img is that from the page source it is missing all the media query type stuff that wp puts in with media elements. Do you know how I can get that back with my custom image field ?

Also I notice the cite needs shoe horning into the blockquote somehow.