From 4c555240a1ec98bb69ec1c9d5e0aa42adb61063a Mon Sep 17 00:00:00 2001 From: Dominik Date: Sat, 2 Jan 2016 12:16:53 +0100 Subject: [PATCH] Fixing Post-Name + Category improvement I noticed that if you access a Post, it'll say Blog-Post instead of the Post-Title. With this work-around it'll write the Title of the Post and the (first) Category if it finds any. --- includes/theme/theme-function.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/theme/theme-function.php b/includes/theme/theme-function.php index 4e5e9b8..2aa108c 100644 --- a/includes/theme/theme-function.php +++ b/includes/theme/theme-function.php @@ -1001,7 +1001,15 @@ function anaglyph_get_page_title() { if ( ! function_exists( 'anaglyph_get_post_additional_title' ) ) { function anaglyph_get_post_additional_title() { global $anaglyph_config, $prefix; - $add_title = get_post_meta(get_the_ID() , $prefix . 'image_title_text', true); + $add_title = get_post_meta(get_the_ID() , $prefix . 'image_title_text', true); + if (get_post_type() == "post") { + $cs = wp_get_post_categories(); + if (empty($cs)) { + $add_title = get_the_title(); + } else { + $add_title = get_category($cs[0])->name . ": " . get_the_title(); + } + } $add_img = get_post_meta(get_the_ID() , $prefix . 'image_title_img', true); $def_img = esc_url(get_template_directory_uri() . '/includes/theme/assets/bgs/title-background.jpg'); ?> @@ -1821,4 +1829,4 @@ function anaglyph_compress_code($code) { return $code; } -} \ No newline at end of file +}