2015-09-18 02:13:03 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: sarahetter
|
|
|
|
* Date: 15-09-17
|
|
|
|
* Time: 4:48 PM
|
|
|
|
*/
|
|
|
|
|
|
|
|
//<editor-fold desc="Init">
|
|
|
|
global $passInTitle;
|
|
|
|
$description = '';
|
|
|
|
$image = '';
|
|
|
|
$title = '';
|
|
|
|
$url = get_bloginfo('wpurl');
|
2016-01-07 16:39:52 +01:00
|
|
|
$permalink = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
2016-01-07 14:40:06 +01:00
|
|
|
$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';
|
|
|
|
}
|
2015-09-18 02:13:03 +02:00
|
|
|
//</editor-fold>
|
|
|
|
|
|
|
|
//<editor-fold desc="Get Title">
|
|
|
|
if(isset($passInTitle)) {
|
2015-12-17 15:55:34 +01:00
|
|
|
$title = $passInTitle;
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-12-17 15:55:34 +01:00
|
|
|
$title = get_the_title();
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
|
|
|
|
2015-09-26 04:08:27 +02:00
|
|
|
|
|
|
|
|
2015-09-18 02:13:03 +02:00
|
|
|
if (strpos($title, 'Home') !== false)
|
|
|
|
{
|
2015-12-17 15:55:34 +01:00
|
|
|
$title = '';
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-12-17 15:55:34 +01:00
|
|
|
$title .= ' | ';
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
|
|
|
$title .= get_bloginfo();
|
|
|
|
//</editor-fold>
|
|
|
|
|
|
|
|
//<editor-fold desc="Get Description">
|
2016-01-07 15:31:33 +01:00
|
|
|
|
|
|
|
// Heads Up! This doesn't work cause it's outside of loop.
|
|
|
|
// But the following functions should handle all other use cases.
|
2015-09-18 02:13:03 +02:00
|
|
|
$description = get_the_excerpt();
|
2016-01-07 15:31:33 +01:00
|
|
|
|
|
|
|
if ( get_field('header_tagline') != '' ) {
|
|
|
|
$description = strip_tags(get_field('header_tagline'));
|
|
|
|
}
|
|
|
|
|
2015-09-18 02:13:03 +02:00
|
|
|
if (empty($description)) {
|
|
|
|
|
2015-12-17 15:55:34 +01:00
|
|
|
$content = get_field('subtemplate')[0]['content'];
|
|
|
|
if (!empty($content)) {
|
|
|
|
$description = substr(strip_tags($content),0,140)."...";
|
2015-09-18 02:13:03 +02:00
|
|
|
|
2015-12-17 15:55:34 +01:00
|
|
|
}
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
|
|
|
if (empty($description)) {
|
2015-12-17 15:55:34 +01:00
|
|
|
$description = get_bloginfo('description');
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
|
|
|
//</editor-fold>
|
|
|
|
|
|
|
|
//<editor-fold desc="Get Image">
|
|
|
|
$image = get_field('header_image')['url'];
|
|
|
|
if (empty($image)) {
|
2015-12-17 15:55:34 +01:00
|
|
|
$image = WPTHEME_TEMPLATE_URL.'/images/ico/apple-touch-icon-152x152.png';
|
2015-09-18 02:13:03 +02:00
|
|
|
}
|
2015-09-22 01:02:29 +02:00
|
|
|
//</editor-fold>
|
|
|
|
|
|
|
|
//<editor-fold desc="Get Links">
|
|
|
|
$signInLink = get_field('sign_in_link','option');
|
|
|
|
$signUpLink = get_field('sign_up_link','option');
|
|
|
|
//</editor-fold>
|