• Resolved dickli

    (@dickli)


    Hello,

    I use custom fields to create a custom title, which is stored in the database. How do I use qtranslate X to translate the custom title? Here’s my snippet for creating the title. Thanks!

    function aggregate_title($post_id) {

    if (‘post’ == get_post_type()) {

    global $wpdb;
    $my_day = get_field(‘day’);
    $my_title = get_field(‘title’);
    $title = ‘Day ‘ . $my_day . ‘: ‘ . $my_title;
    $where = array( ‘ID’ => $post_id );
    $wpdb->update( $wpdb->posts, array( ‘post_title’ => “” ), $where );
    $wpdb->update( $wpdb->posts, array( ‘post_title’ => $title ), $where );

    }

    }

    add_action(‘save_post’, ‘aggregate_title’, 10);

    https://ww.wp.xz.cn/plugins/qtranslate-x/

Viewing 1 replies (of 1 total)
  • Thread Starter dickli

    (@dickli)

    Nevermind, the same logic for custom fields applies to mine, as long as I format the field before it becomes saved in the database.

Viewing 1 replies (of 1 total)

The topic ‘Translate custom title from database’ is closed to new replies.