diff --git a/controller/header.php b/controller/header.php deleted file mode 100644 index 9e46d76..0000000 --- a/controller/header.php +++ /dev/null @@ -1,55 +0,0 @@ - -global $passInTitle; -$description = ''; -$image = ''; -$title = ''; -$url = get_bloginfo('wpurl'); -// - -// -if(isset($passInTitle)) { - $title = $passInTitle; -} -else { - $title = get_the_title(); -} - -if (strpos($title, 'Home') !== false) -{ - $title = ''; -} -else { - $title .= ' | '; -} -$title .= get_bloginfo(); -// - -// -$description = get_the_excerpt(); -if (empty($description)) { - - $content = get_field('subtemplate')[0]['content']; - if (!empty($content)) { - $description = substr(strip_tags($content),0,140)."..."; - - } -} -if (empty($description)) { - $description = get_bloginfo('description'); -} -// - -// -$image = get_field('header_image')['url']; -if (empty($image)) { - $image = WPTHEME_TEMPLATE_URL.'/images/ico/apple-touch-icon-152x152.png'; -} -// diff --git a/controller/init.php b/controller/init.php index d210a00..62bb62c 100644 --- a/controller/init.php +++ b/controller/init.php @@ -12,6 +12,17 @@ $description = ''; $image = ''; $title = ''; $url = get_bloginfo('wpurl'); +$permalink = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; +$twitter = '@ascribeio'; + +if ( has_post_thumbnail() ) { + $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' ); + $shareimage = $large_image_url[0]; +} else if ( get_field('header_background_image') != '' ) { + $shareimage = get_field('header_background_image')['url']; +} else { + $shareimage = WPTHEME_TEMPLATE_URL . '/images/ico/apple-touch-icon-180x180.png'; +} // // @@ -35,7 +46,15 @@ $title .= get_bloginfo(); // // + +// Heads Up! This doesn't work cause it's outside of loop. +// But the following functions should handle all other use cases. $description = get_the_excerpt(); + +if ( get_field('header_tagline') != '' ) { + $description = strip_tags(get_field('header_tagline')); +} + if (empty($description)) { $content = get_field('subtemplate')[0]['content']; diff --git a/header.php b/header.php index d53acd9..20cc15c 100644 --- a/header.php +++ b/header.php @@ -15,6 +15,9 @@ if (!isset($headColour)) { if (is_home()) { $title = "Blog | ascribe"; } +if ( is_category() || is_tag() ) { + $title = single_term_title( '', false ) . ' | Blog | ascribe'; +} ?> @@ -32,21 +35,22 @@ if (is_home()) { + - - + + - + - - + + - +