[ad_1]
Hi there,
I’ve tried this code to no avail:
//* Shortcode to display the current year in WordPress
//* shortcode: [year]
add_shortcode( 'year' , 'current_year' );
function current_year() {
$year = date("Y");
return "$year";
}
//* Activate shortcode function in Post Title
add_filter( 'the_title', 'do_shortcode' );I’m thinking it might in conflict with another custom code to display the title in a page hero:
function my_custom_page_hero() {
// Check if it's not the homepage
if (!is_front_page()) {
// Output page or post title and post meta
add_action('generate_after_header', function() {
?>
<div class="page-hero">
<div class="container">
<h1><?php
if (is_category()) {
single_cat_title();
} elseif (is_author()) {
the_author();
} else {
echo get_the_title();
}
?></h1>Is there a way to fix this?
