Custom Post Type with ACF single template file


Hi, very thank for the excelent work, i have an question. I have an group with 17 diferent field (Advanced Custom Field) and need display into a single post type in the frontend, what is the best practice for this?

The following code works file single-postName.php with this content, this it is correct?

<?php
function machos_area () {
    $image = get_field('foto_de_frente', false, true);
?>
<div class="uk-grid">
    <div class="uk-width-1-3">
        <img class="uk-thumbnail-small" src="<?php echo $image?>" alt="">
    </div>
    <div class="uk-width-1-3">
        <h1 class="uk-text-bold .uk-text-middle uk-text-left"><?php the_title()?></h1>
    </div>
    <div class="uk-width-1-3">
        <p class="uk-text-bold uk-text-center .uk-text-middle">Última actualización:<?php echo  the_modified_date();?></p>
    </div>
    <div class="uk-width-1-1" style="{padding:20px}">
        <hr/>
    </div>
    <div class="uk-width-1-2">
        <h4 class="uk-text-bold uk-text-center">Geneología</h4>
        <ul class="uk-list uk-list-line">
            <li> Nombre del Padre: <?php the_field('nombre_padre'); ?></li>
            <li> Nombre de la Madre: <?php the_field('nombre_madre'); ?></li>
        </ul>
        <h4 class="uk-text-bold uk-text-center">Información Productiva</h4>
        <ul class="uk-list uk-list-line">
            <li> Tipo de Nacimiento: <?php the_field('tipo_nacimiento'); ?></li>
            <li> Peso al nacer: <?php the_field('tipo_nacimiento'); ?></li>
            <li> Peso al destete: <?php the_field('peso_al_destete'); ?></li>
            <li> Peso a los 120 días: <?php the_field('peso_a_los_120_dias'); ?></li>
            <li> Peso a los 150 días: <?php the_field('peso_a_los_150_dias'); ?></li>
            <li> Coloración: <?php the_field('coloracion'); ?></li>
        </ul>
    </div>
    <div class="uk-width-1-2">
    <div class="uk-grid">
        <div class="uk-width-medium-1-2"><img class="uk-thumbnail" src="<?php echo  get_field('foto_lateral', false, true);?>" alt=""></div>
        <div class="uk-width-medium-1-2"><img class="uk-thumbnail" src="<?php echo get_field('foto_cabeza', false, true);?>" alt=""></div>
        <div class="uk-width-medium-1-2"><img class="uk-thumbnail" src="<?php echo  get_field('foto_lateral', false, true);?>" alt=""></div>
        <div class="uk-width-medium-1-2"><img class="uk-thumbnail" src="<?php echo get_field('foto_cabeza', false, true);?>" alt=""></div>
    </div>
    </div>
</div>
<?php

}
add_action( 'beans_post_body', 'machos_area' );
beans_remove_action('beans_post_navigation');
beans_remove_action('beans_post_title');
beans_load_document();

?>


Write a reply

Login or register to write a reply, it's free!