First of all, yes, its seems to be the right place to look.
get_the_ID()
gives you the ID of the current item in the loop.
Do you have the custom field so far?
If yes you can output the “Custom field – Title” with this lines of code:
$customTitle = get_post_meta( get_the_ID(), 'CustomFieldSlug', true );
if ( ! empty( $customTitle ) ) {
echo $customTitle;
} else {
echo wp_kses_post( avada_render_post_title( get_the_ID() ) );
}
I dont know what wp_kses_post()
and the avada_render_post_title()
function are actual doing. Maybe you have to surround the $customeTitle with these functions, too.
My code example should display the customField Title if its set. Otherwise it should use the normal post title.
EDIT:
If i understand the render_post_title correctly, you could make a different call to it in the blog-layout.php
function avada_render_post_title( $post_id = '', $linked = true, $custom_title ....
this part of the function tells us, that we can give a “custom_title” as parameter. Lets give it a try:
<?php // Render the post title. ?>
<?php echo wp_kses_post( avada_render_post_title( get_the_ID() ) ); ?>
replace this lines of code with following:
<?php // Render the post title. ?>
<?php
$customTitle = get_post_meta( get_the_ID(), 'short-title', true );
if ( ! empty( $customTitle ) ) {
echo wp_kses_post( avada_render_post_title( get_the_ID(), true, $customeTitle ) );
} else {
echo wp_kses_post( avada_render_post_title( get_the_ID() ) );
}
?>