Support

Account

Forum Replies Created

  • Hi Wyclef,

    I’m looking to do the same thing and then add that to custom a post loop and single post template.

    Did you find a way to do this?

    Thanks

    Phil

  • Hi Scot,

    Not yet. TBH I haven’t spent much time on this since as another project has to be finished first. I’ll be picking it up again in a couple of weeks. Will let you know how I go.

  • Hi all,

    This has been really useful for me. I’ve been trying to find a way to use an ACF field as a CPT title and this works nicely for me

    `* add custom slug and title */

    function my_post_title_updater( $post_id ) {

    if ( get_post_type( $post_id ) == ‘venue’ ) {

    $my_post = array();
    $my_post[‘ID’] = $post_id;
    $my_post[‘post_title’] = get_field( ‘venue_name’, $post_id );

    wp_update_post( $my_post );

    }

    }

    // run after ACF saves the $_POST[‘fields’] data
    add_action(‘acf/save_post’, ‘my_post_title_updater’, 20);

    A couple of quick questions …

    How can I concatenate two variables so that I can use ‘venue_name’ and ‘venue_city’?

    Also, how can I expand this to update the slug to use the same title ‘venue_name’ and ‘venue_city’? I currently have http://localhost:8888/gigs/venue/auto-draft/ as the slug.

    Thanks all.

    Cheers

    Phil

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

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.