Display an icon with get_post_meta?
-
I want to display an icon in the post meta data in the loop.php, for each post have a specific meta_value!
To be more specific i use this code to display an icon when a new posts has been published and this lasts for 24 hours:
<?php if( date(‘U’) – get_the_time(‘U’, $post->ID) < 24*60*60 ) : ?>
<span class=”new-post”></span>
<?php endif; ?>`And here is the code in style.css:
`.item-list span.new-post {
padding-left: 20px;
width: 20px;
height: 18px;
background: 0px 0px url(https://www.e-win.gr/wp-content/themes/e-win/images/new-post.png) no-repeat;
}`What exactly i want is display an icon when a post has a specific meta_value. Here is the code i am trying to reach it but with no results:
`<?php $icon = get_post_meta(apaitei_logariasmo_facebook); ?>
<?php if( ! $icon == attr_esc(Ναι) ) ?>
<span class=”facebook-badge”></span>
<?php endif; ?>`And here is the code i use in style.css to insert the icon:
`.item-list span.facebook-badge {
padding-left:20px;
width: 20px;
height: 14px;
background: 0px 0px url(https://www.e-win.gr/wp-content/themes/e-win/images/facebook-badge.png) no-repeat;
}`What do i have to do to make the code work and display the icon for the specific meta_value?
P.S. I am using this
attr_esc(Ναι)
because i use Greek chars in the meta_value.
- The topic ‘Display an icon with get_post_meta?’ is closed to new replies.