Translate custom title from database
-
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);
The topic ‘Translate custom title from database’ is closed to new replies.