After read a lot in a lot of sites, finally I was able to do something similar what I was trying (read a lot because I don't know code at all), is the follow:
I want to use a background image for my custom fields.
I did this in single.php
:
<div class="post-meta">
<h3>
<?php $firstCF = get_post_meta($post->ID, 'firstCF', true);
if ($dorigen) { ?>
My text: <?php echo $firstCF; ?></br></br>
<?php }
else { ?> </h3><?php } ?>
<h3>
<?php $secondCF = get_post_meta($post->ID, 'secondCF', true);
if ($dorigen) { ?>
Other Text: <?php echo $secondCF; ?></br></br>
<?php }
else { ?> </h3><?php } ?>
</div>`
CSS:
.post-meta {
text-shadow: 0 1px 0 #252525;
color: #f2f6d7;
padding-top: 22px;
padding-left: 190px;
float: left;
height: 150px;
width: 600px;
background-image: url(../images/fondo-campos-personalizados.gif);
background-repeat: no-repeat;
}
The problem is that will not use always firstCF
and/or secondCF
in all my post and the background image always is there.
Another Q: I use h3
, but when I see source in browser I can't find </h3>
, but the size and characteristics of the text are really those of my css h3
. I don't know if Google and others, will understand that they are really h3
.
Is there a way to do something like this?
background-image
... Also, you tagged the Q with Advanced Custom Fields, what does it has to do with this? :::: Please, add more details to the Q itself, you are free to edit it whenever needed.