The syntax for get_post_meta that you are using in incorrect. It is documented here.
You need to pass a string for the second parameter. So, for example, use
$icon = get_post_meta( $post->ID, 'apaitei_logariasmo_facebook', true );
Instead of
$icon = get_post_meta( $post->ID, apaitei_logariasmo_facebook, true );
In addition, string literals must be between the quotes in PHP.
if( $icon == esc_attr( 'Ναι' ) ) :
So, the solution is:
<?php
$icon = get_post_meta( $post->ID, 'apaitei_logariasmo_facebook', true );
if( $icon == esc_attr( 'Ναι' ) ) : ?>
<span class="facebook-badge"></span>
<?php endif; ?>
Related Posts:
- Regenerate missing _wp_attachment_metadata
- Retrieving an alt tag from a custom field
- Get thumbnail url of custom meta image?
- Dynamic tagged image galleries
- Generate images to be associated for tag and category?
- Remove “%” from strings in serialized arrays in wp_postmeta
- Can wp_get_image_editor convert to icon?
- Image not showing using a custom function and get_post_meta
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- Hover a css icon width other color inside wp_get_attachment_image
- Widget Style – Icon Type
- How to Display Image Caption but Not Alt Text
- get_post_meta returning broken path in image src
- Adding Image Description below Images Inserted into Posts
- get_post_custom: get image URL instead of image ID
- How to change image type for specific size?
- What’s the proper way to find and remove duplicate images from posts and the media library?
- get_post_gallery with Gutenberg
- Mixed content warnings after changing site adress from HTTP to HTTPS
- add_image_size() zoom-crop
- Insert an image into a post by API
- Creating a rotating header /image slider using theme customization
- Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms…)
- Double thumbnails?
- No srcset for hard-cropped thumbnails
- Slider image issue in wordpress
- Getting custom size image URL
- Retrieving images from a NextGEN gallery
- Query for recent images across multiple posts
- Getting alt text of featured image
- Get image alt attribute just by image URL
- Is there a way to get attachment data?
- How to resolve – IE 6 ignores img “width” properties
- WordPress is stripping the Alt tag’s quote marks from images where Alt is not set, but leaving the word ‘alt’ creating problems for ADA compliance
- WordPress reduces the full size image and uses it as the original
- Show taxonomy list with taxonomy images ( SOLVED)
- get_children() not working properly – Only on one post?
- Warning: getimagesize() [function.getimagesize]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 [closed]
- Is There A Way Of Using the_post_thumbnail() to Pull In A Specific Image From The Media Library
- How to add data attribute to all images in posts [closed]
- List all images from a single post meta value
- Output random (custom) image size
- WordPress crops images differently on retina screens?
- Image thumbnails not available post migration, but still accessible via direct URL – DB issue
- How do I create an alternate RSS feed for tags with custom image sizes for MailChimp?
- Exclude images from “inserted into post” when trying to get attachments
- Set jpeg_quality for certain post-types
- WordPress automatically downscaled images larger that original
- Move Image Captions Inside Link ( tag) if Added
- Sharing images to social media – issue with aspect ratio
- How to add custom classes to figure element only if image has caption?
- I got an issue after i migrated a site
- How to add an image to a custom url?
- 409 error (Conflict) when trying to insert an image into a post
- Exclude image titles from search results
- Facebook og:image issues after https change [closed]
- Does WP create multiple images?
- I have no images in an activated wp theme
- Understanding WordPress image sizes and responsive images
- Image large size [closed]
- Media gallery images url instead of ID on WP API Response
- css to fit image by HEIGHT
- Alt Image WordPress [closed]
- Some Images Disappeared from Media Library?
- Get an image from url, resize it, and save on a custom folder (not the media library)
- Get all custom sizes in srcset attribute
- Why isn’t add_image_size(‘event-secondary-image-thumbnail’, 250, 150) working?
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- How do I implement an image viewer and rotator? [closed]
- Upload images – Theme options
- Is it possible to modify default image name suffix?
- How to replace post image url before posting using api?
- Background Image Does Not Display on Page
- Can’t fix corrupted images
- WordPress Single Post image gallery as slider
- There is an image embedded on my page that I can’t locate in order to delete. Please help me!
- Could creation of various image sizes cause slow form submission response?
- How to add featured image use HTML
- Correct color profile and saving? Thumbnail creation?
- Allow users to upload attachments to certain posts
- WordPress and Advanced Custom Fields and Flickity
- How to get image ID based on get_theme_mod image URL?
- How to bulk update then save images in wordpress posts
- stop wordpress from resizing feature gif images
- Change wordpress default upload path to another domain
- Modify media file markup output
- Responsive images in Bootstrap 4 slider
- WPML – Change media uploader language
- How can I add an “Attach image to this post/page” link on the Add Media lightbox?
- WordPress Is Saving Original Image Only
- Display images from JS?
- Create slider option in editor
- How to make an image bigger with wp_get_image_editor
- Assign one featured image to multiple posts?
- An image on my site is showing as the wrong image [closed]
- Set padding for all content except images and few more elements
- Orientation of featured image in post?
- Uncaught Error: Call to undefined function file_is_valid_image()
- Remove one srcset entry from wp_get_attachment_image
- The uploaded images are only full-size (original)