• Hello.

    1.
    I tried without success to check if there is any data inside some filed and if there is to show it, and if there is no to show some other text for example:

    check if there is caption and show it if it is there, else, echo some other text?

    2.
    Also I noticed that if “Automatically display exif” is checked you can control which fields should be shown at the end of post, but if I use php function inside theme files to show for example caption:

    echo exifography_display_exif(‘caption’);

    if there is caption added it will show it even if I checked-out that field on that post from wp edit post page.

    Is there any function to check first if that field should be displayed, and if it shout to display it, of course if exist?

    Best regards.

    https://wordpress.org/plugins/thesography/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author kristarella

    (@kristarella)

    Hi,

    1. For this you could do it on a site-wide scale using a PHP filter, I have a tutorial with multiple filter examples; the ‘Change an EXIF item’ one would be closest to what you want. It wouldn’t be suitable for a per-image basis though.

    2. What you put in the shortcode or template tag will override any of the global or per-post settings. So if you use the code echo exifography_display_exif('caption'); in your theme it will only show the caption in that place and it will always show the caption in that spot if there is one. If you want to use the global and per-post settings to control which fields are displayed you would need to leave the parameters of the tag empty. I.e., echo exifography_display_exif();
    The plugin already only displays a field if it exists, if it doesn’t exist there is nothing to display.

    So, if I understand what you are trying to do I think you should use echo exifography_display_exif(); in your theme file and then check ‘caption’ in the main Exifography settings, and then if you don’t want it to display for a particular post you can uncheck it when editing that post.

    Thread Starter Advanced SEO

    (@jole5)

    What I am trying to do is next:
    I wish to echo each exif field separately, where I wish to appear on page. That is why I use echo exifography_display_exif('caption'); for example to echo that field if exist where I wish it.

    Since of nature of exif data stored in image before uploading, and without ability to edit them after uploading (at least I do not know how, and where to edit exif fields per post after upload) there is chance that some exif fields be misused, populated with practically any kind of text (inappropriate, offending).

    I wish option to check if some field is checked for display on current post, and if it is, to check if exist and to display it?

    Thread Starter Advanced SEO

    (@jole5)

    I hope you understand what I wish to achieve?

    Plugin Author kristarella

    (@kristarella)

    Yes, I did understand what you were trying to do. Please implement it the way I suggested before.

    Thread Starter Advanced SEO

    (@jole5)

    You suggested me this:

    So, if I understand what you are trying to do I think you should use echo exifography_display_exif(); in your theme file and then check ‘caption’ in the main Exifography settings, and then if you don’t want it to display for a particular post you can uncheck it when editing that post.

    I think that using that method I will be able to uncheck per post field(s) I do not wish to display, and using echo exifography_display_exif(); I will automatically display all checked fields all together. But, that is not what I wish, that way I would not be able to separately display each field in different positions in my single.php template.

    Or, maybe my thinking is not correct?
    Please correct me if I am wring and show me how to do it.

    Plugin Author kristarella

    (@kristarella)

    No, it won’t show all the fields. If you have actively unchecked the fields on a per post basis then echo exifography_display_exif(); should not show anything for that particular post.

    If that is not the case let me know, but I believe what I said before will do what you want.

    Thread Starter Advanced SEO

    (@jole5)

    If I unchecked just one field on some post it will not display that particular field, but echo exifography_display_exif(); will display any other checked field(s) for that post.

    It will display all fields (all fields that are checked) together (one after another).

    Plugin Author kristarella

    (@kristarella)

    Yes, if you have other fields checked it will display them, but if you use echo exifography_display_exif('caption'); it will display the caption whether it’s checked or not.

    You could test for the checked option using the following:

    global $post;
    $post_options = get_post_meta($post->ID, '_use_exif', true);
    if (strpos($post_options,'caption') !== false) {
      echo exifography_display_exif('caption');
    }

    Thread Starter Advanced SEO

    (@jole5)

    Thank you very much, it works. That is exactly what I wish.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to check if there is any data imported inside field?’ is closed to new replies.