Last active
July 20, 2022 14:04
-
-
Save frontend-coder/4b700fbc1a3d580a918fdc45d32e23a4 to your computer and use it in GitHub Desktop.
40. Вивід заголовка в залежності від вида поста або таксономії #wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1> | |
<?php | |
if(is_category()) { | |
echo esc_html_e('Category: ', 'domain') . single_cat_title("", false); | |
} elseif(is_author()) { | |
echo esc_html_e('Author: ', 'domain') . get_the_author(); | |
} elseif(is_tag()) { | |
echo esc_html_e('Tag: ', 'domain') . single_tag_title("", false); | |
} elseif( is_search()) { | |
echo esc_html_e('Search for: ', 'domain') . get_search_query(); | |
} elseif(is_post_type_object('gallaries')){ | |
$gal = get_post_type_obgect( 'gallaries' ); | |
echo esc_html($gal->labels->name); | |
} elseif(is_archive()) { | |
if(is_day()) { | |
echo sprintf(esc_html__( 'Daily Archive: %s','domain'), get_the_date() ); | |
} elseif(is_month()) { | |
echo sprintf(esc_html__('Monthly Archive: %s', 'domain'), get_the_date(_x('F Y', 'monthly archives date', 'domain' ) ) ); | |
} elseif( is_year() ) { | |
echo sprintf(esc_html__('Yearly Archive: %s', 'domain'), get_the_date(_x('Y', 'yearly archives date form', 'domain' ) ) ); | |
} else { | |
echo esc_html__('Archive', 'domain'); | |
} | |
} elseif(is_404) { | |
echo esc_html__('404', domain); | |
} else { | |
echo domain_wp_kses( wp_title('') ); | |
} | |
?> | |
</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment