Datefilter

Forums › Forums › Search & Filter Pro › Datefilter

Viewing 10 posts – 11 through 20 (of 32 total)
  • Trevor
    #238589

    A coder (such coding is outside the scope of our technical support, but it can be done) could automate the filling of this newly required field, but that would only work as you edit/save a post.

    Anonymous
    #238592

    So what should I do?

    Trevor
    #238596

    We can, together, explore going down that route. The first thing I think you CAN do, is to create the ACF field. I would suggest making a dropdown field, where you specify the choices. Open ONE post and manually set the value (correctly), and then we can add that to the form.

    Then we can see if we can code it together.

    BTW, are you using a child theme?

    Anonymous
    #238598

    Thank you for your help.
    OK. Let’s do it like this.
    Yes I am using a child theme.

    Trevor
    #238600
    This reply has been marked as private.
    Anonymous
    #238602

    what would the field do? to name it in a suitable name

    Trevor
    #238604
    This reply has been marked as private.
    Anonymous
    #238607
    This reply has been marked as private.
    Trevor
    #238609

    I found a post that will help us:

    https://support.searchandfilter.com/forums/topic/author-field-not-honouring-auto-count-setting/#post-223172

    The code used there was this:

    // save Author to author 
    function event_author_on_save( $post_id ) {
      $post_type = 'event'; //custom post type - change to post if you're just working with posts
    
      //Check if we are saving correct post type
      if( get_post_type( $post_id ) != $post_type)
        return;
    
      //Check it's not an auto save routine
      if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 
        return;
      
      // get the author ID of the post
      $author_id = get_post_field ('post_author', $post_id);
      // get the display name of that author
      $author = get_the_author_meta( 'display_name' , $author_id );
    
      // update the custom field value 
      update_field( 'acf_event_author', $author, $post_id );
    }
    add_action('save_post', 'event_author_on_save');
    Trevor
    #238611

    Which event did you (also) edit, or did you not edit any yet?

Viewing 10 posts – 11 through 20 (of 32 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.