Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1433535

    Hi Enfold,

    If I editing a post in wordpress backend with the Default Editor, I can choose on the Custom Field “Feature Image” between the options “Show on single entry” or “Hide on single entry”.

    GravityForms with the “Advanced Post Creation” Add-On, allows to create posts and insert Custom Files field into the form, so the user can choose between the various options.
    But the Custom Field “Featured Image” does not appear in the list of Custom Fields :(

    Can you tell me where I’m wrong?
    Why can I see the Enfold Custom Field “header_title_bar”, “header_transparency”, but not “Feature Image”?

    Best regards,
    Oriano

    #1433633

    Hey Oriano,

    Thank you for the inquiry.

    The Featured Image option is only available for posts or portfolio items. If you want to add this option to your own custom post type, you can use the avf_display_featured_image_posttypes filter in the functions.php file.

    add_filter('avf_display_featured_image_posttypes', function($post_types) {
       $post_types[] = 'your_post_type';
       return $post_types;
    }, 10, 1);
    

    Best regards,
    Ismael

    #1433706

    Hi Ismael, thanks for your answer.

    I entered your code, but inside the Gravity Post Creation I still only see this Custom Fields :(

      breadcrumb_parent
      filesize
      footer
      footer_behavior
      footnotes
      header_title_bar
      header_transparency
      layout sidebar

    I don’t see the Enfold Custom Field featured_image that should allow me to select between the option “Show on single entry / Hide on single entry”.

    Best regards,
    Oriano

    #1433771

    Hi,

    Thank you for the update.

    The Featured Image settings should display inside the Layout metabox just under the Header visibility and transparency settings. If you want to control it manually, you can add a new custom field called _avia_hide_featured_image and set the value to true or false.

    Best regards,
    Ismael

    #1433777

    Hi Ismael, thank you for your answer,

    The Featured Image settings should display inside the Layout metabox just under the Header visibility and transparency settings.

    yes I saw this.
    But I need to give the possibility to choose to show or hide the Featured image of the post also to the user who creates a new Post via Gravity Forms.

    I then entered on the child theme function the code:

    add_filter('avf_display_featured_image_posttypes', function($post_types) {
       $post_types[] = 'your_post_type';
       return $post_types;
    }, 10, 1);

    then I add the custom field “_avia_hide_featured_image” and edit Value “true”, but the response I get is “Please provide a custom field value.” :(

    Find some private data below.

    Best regards,
    Oriano

    #1433783

    Hi,

    But I need to give the possibility to choose to show or hide the Featured image of the post also to the user who creates a new Post via Gravity Forms.

    We are not entirely clear on how that works. Could you please explain further?

    Did you replace the placeholder “your_post_type” with the actual name of the post type?

    add_filter('avf_display_featured_image_posttypes', function($post_types) {
       $post_types[] = 'your_post_type';
       return $post_types;
    }, 10, 1);
    

    then I add the custom field “_avia_hide_featured_image” and edit Value “true”, but the response I get is “Please provide a custom field value.”

    Could you please provide a screenshot or a short clip of the error, or the input field where you entered the custom field?

    Best regards,
    Ismael

    #1433784

    Hi,

    Have you tried selecting Add New Custom Field Value Name from the dropdown (https://img.savvyify.com/image/9vVsp)? Then place true or false in the Value field.

    Best regards,
    Ismael

    #1433790

    Ismael, now this happens.
    I created a post via the Gravity Form (I choose the value “false” in the _avia_hide_featured_image custom field), submit the form, and the post is saved as a draft.
    Then from the Dashboard / Posts panel, I select “Preview” of the post, the browser one a page wiithe the preview of the post, an the Featured Image not displayed. Well.
    But, but… when I “edit” the Post to publish it online or to schedule it online on a specific date, and save the post, the featured image appears in the post view :(

    I hope I explained myself :(

    Could you please provide a screenshot or a short clip of the error, or the input field where you entered the custom field?

    Here the error

    Best regards,
    Oriano

    #1433795

    Hi Ismael,
    please see the screenvideo you find in Private Content.

    Best regards
    Oriano

    #1434019

    Hi,
    Thanks for the video, I’m not sure how your plugin works, but your test post is a Block Editor post on the backend, but if I publish it it seems to be a ALB post on the frontend, so I believe this causes an issue. Similar to if you try to switch editors after a post is created, this often causes errors with the content.
    If you don’t want the featured image to show you can use this css to hide it:

    .single-post .big-preview.single-big {
    	display: none;
    }

    This might be the best way to work around this.

    Best regards,
    Mike

    #1434060

    Hi Mike, thanks for help

    If you don’t want the featured image to show you can use this css to hide it:

    my problem is that the user who submits a post on the Enfold blog via Gravity Forms & Advanced Post Creation Add-On, should be able to choose whether the post should have the featured image or not :(

    Please also watch the video (see link on Private content), where if I try to add the costum field directly from the WordPress editor, I receive an error, so maybe I’m doing something wrong?

    Best regards,
    Oriano

    #1434076

    Hi,
    In my research I fould the custom fields that begin with an underscore are hidden custom fields and are not displayed in the WordPress edit post page and can only be updated programmatically.
    This is why you can not add it manually, I found and function that will allow the field to be shown, but you still can not manually update it:

    add_filter( 'is_protected_meta', function( $protected, $meta_key, $meta_type )
    {
        $allowed = array( '_avia_hide_featured_image', '_test', '_wp_page_template' );
        if( in_array( $meta_key, $allowed ) )
            return false;
    
        return $protected;
    }, 10, 3 );

    See these pages for reference:
    https://melapress.com/support/kb/wp-activity-log-log-changes-hidden-custom-fields/
    https://wordpress.stackexchange.com/questions/116534/how-to-allow-hidden-custom-fields-to-be-added-from-wp-admin-post-php

    Perhaps your best solution will be to create a new custom field that will add a custom class to the page body and then use css to hide the featured image when ever the class is on the page.

    Best regards,
    Mike

    #1434159

    Hi Mike, thanks for your help

    Perhaps your best solution will be to create a new custom field that will add a custom class to the page body and then use css to hide the featured image when ever the class is on the page.

    yes, I think I will try to implement this solution.
    Can you please tell me, if you know, where I can find instructions on how to do this, possibly without using a plugin.
    (If you can’t answer this question, I understand… it’s likely that this is not the scope of Enfold support).

    Best regards,
    Oriano

    #1434174

    Hi,
    I don’t know about your plugin so I don’t know how the form that you have created will be able to add to a custom field.
    But this post will explain how to use the add a custom field to add a custom body class.

    Best regards,
    Mike

    #1434268

    Hi Mike, thanks for your help,
    your “best solution” work fine.

    Perhaps your best solution will be to create a new custom field that will add a custom class to the page body and then use css to hide the featured image when ever the class is on the page.

    Best regards,
    Oriano

    #1434287

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Custom Field “Hide on sigle entry”, and Gravity Forms’ is closed to new replies.