shows 3 custom fields with conditions

Asked

Viewed 25 times

-1

I got that code right here:

<?php if ( custom_get_meta( 'Plot') == true ) { ?> // campo principal
<?php echo custom_get_meta( 'Plot' ); ?> // campo principal a mostrar
<?php } else { ?>
<?php the_content(); ?> // se não existir o campo principal, mostrar "the_content"
<?php } ?>

but only gives for 2 custom fields, now I wanted to add another field as main...

will be custom_get_meta( 'synopsis' ); if you don’t have "synopsis" go get "Plot", if you don’t have "synopsis" or "Plot" you will find "the_content();"

1 answer

0

Follow the correct code:

<?php
if ( custom_get_meta( 'sinopse') ) {
    echo custom_get_meta( 'sinopse' );
} else if ( custom_get_meta( 'Plot') ) {
    echo custom_get_meta( 'Plot' );
} else {
     the_content();
} 
?> 
  • thank you very much, it works!

  • @jitas vote on my answer so please, I want to increase reputation, I started now.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.