View subtitle (custom field) in homepage
-
I have created a Subtitle custom field and added this code in functions.php, but this way I can’t see the subtitle on the homepage, only on each individual post. Any ideas?:
add_action( 'wp_print_footer_scripts', function () { if (is_singular()): $subtitulo = get_post_meta(get_the_ID(), 'Subtitulo', true); if ( $subtitulo ): ?> <script> (function( $ ) { let str = '<span class="dcms-subtitle">'; str += '<?= $subtitulo ?>'; str += '</span>'; $(str).insertBefore('.entry-title'); })( jQuery ); </script> <?php endif; endif; } );
The page I need help with: [log in to see the link]
- The topic ‘View subtitle (custom field) in homepage’ is closed to new replies.