Support

Account

Forum Replies Created

  • I get it. Thank you for replying.
    I’m doing trials right now using wpdb.
    I’m struggling to filter repeater data this way but looks promising.

    Silly idea:
    Is it possible to create an ACF object from data on the fly (in memory) then use ACF methods on it?

  • Hello John, thank you to be here.

    It’s not a multisite installation.
    There are two distinct websites (A.org and B.A.org) and two distinct directories on the same server. B is on a subdomain.

    Some ACF fields will be populated on the admin side in posts (a repeater and few booleans) on website A.org.
    I have to get the values of these fields to include them in a form to be filled by visitors on website B.A.org.

    The form on B.A.org will be the same for every post except for the few fields coming from A.org which will be specific to each post.

    Does that make sens?

  • Not able to set the previous post ‘public’. Don’t know why.
    Here it is:

    Native WordPress hook:
    add_filter( 'ajax_query_attachments_args', 'show_audio_attachments', 10, 1 );
    Media Library Assistant hook:
    add_filter( 'mla_media_modal_query_filtered_terms', 'show_audio_attachments', 10, 1 );

     function show_audio_attachments( $query=array() ) {
    	if( $_POST['query']['_acfuploader'] && $_POST['query']['_acfuploader'] == 'field_589471f6b171a' ) {
    		$query['post_mime_type'] = 'audio';
    	}
      return $query;
    }
  • This reply has been marked as private.
  • Yup!
    For Media Library Assistant users, the call is not in
    ajax_query_attachments_args
    but in
    mla_media_modal_query_filtered_terms

    All is ok for me.
    John, thank you again for your help.

  • Many thanks for the info.
    The following works perfectly:

    add_filter( 'ajax_query_attachments_args', 'show_audio_attachments', 10, 1 );
    function show_audio_attachments( $query=array() ) {
    	if( $_POST['query']['_acfuploader'] && $_POST['query']['_acfuploader'] == 'field_589471f6b171a' ) {
    		$query['post_mime_type'] = 'audio';
    	}
      return $query;
    } 

    The downside may be is that it relies on hard coded field reference, but if I’m to change the fields structure I’ll have other problems to deal with anyways.

    Also I have to make it work with Media Library Assistant plugin.
    I’ll keep you posted…

  • Hi John, thanks for your reply.
    It works pretty well, yes.
    The nice thing with the gallery field is that it lets you pick all the playlist tracks at once.

    I’d definitely use a real Playlist plugin though; it would filter out non-audio files first. I don’t have the skill to write one :'(

  • I think I found a reliable way by using gallery field:

    $audio_playlist = get_field( ‘audio_playlist’ ); //gallery field
    $playlist = array();
    foreach ( $audio_playlist as $audio ){
    array_push ( $playlist, $audio[“ID”] );
    }
    echo ‘<div class=”audio-container”‘.do_shortcode(‘[playlist ids="'.implode(',',$playlist).'"]‘).'</div>’;

    What do you think?

Viewing 9 posts - 1 through 9 (of 9 total)