Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug fixing
  • Loading branch information
Roy committed Jul 21, 2016
1 parent 83d7017 commit 3fde69a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 21 deletions.
20 changes: 20 additions & 0 deletions content-presspage-small-image-and-headline.php
Expand Up @@ -22,6 +22,26 @@
}
?>
</h4>
<?php
$categories = get_the_category(get_the_ID());
$authors = array();
foreach($categories as $cat){
$parent = get_category($cat->parent);
if($parent->slug == 'authors'){
$authors[] = '<a href="'.esc_url( get_category_link($cat->term_id) ).'" title="'.$cat->name.'">'.$cat->name.'</a>';
}
}
if(count($authors) > 0){
$by = implode(', ', $authors);
}
else {
$by = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s">%2$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
);
}
?>
<p class="post-authors">By <?php echo $by; ?></p>
<?php press_source(get_the_ID());?>
<p class="text-muted"><?php the_time('F j, Y'); ?></p>

Expand Down
20 changes: 10 additions & 10 deletions content-single.php
Expand Up @@ -25,17 +25,19 @@

<div class="entry-content clearfix subpage">
<div class="sharelines">
<div class="shareline-twitter">
<?php
$shareline = get_post_meta( $post->ID, 'shareline', true);
if(empty($shareline)) $shareline = get_the_title();
$twittershareline = get_post_meta( $post->ID, 'twittershareline', true);
if(empty($twittershareline)) $twittershareline = get_the_title();
$facebookshareline = get_post_meta( $post->ID, 'facebookshareline', true);
if(empty($facebookshareline)) $facebookshareline = get_the_title();

?>
<a href="#" onclick="window.open('https://twitter.com/intent/tweet?text=<?php echo urlencode(preg_replace("/&#?[a-z0-9]+;/i","",html_entity_decode($shareline)));?>&url=<?php echo urlencode(get_permalink()); ?>&via=UConnBusiness', 'Twitter', 'width=500,height=500');"><span class="social social-twitter"></span> <span><?php echo $shareline; ?></span></a>
<div class="shareline-twitter">
<a href="#" onclick="window.open('https://twitter.com/intent/tweet?text=<?php echo urlencode(preg_replace("/&#?[a-z0-9]+;/i","",html_entity_decode($twittershareline)));?>&url=<?php echo urlencode(get_permalink()); ?>&via=UConnBusiness', 'Twitter', 'width=500,height=500');"><span class="social social-twitter"></span><span><?php echo $twittershareline; ?></span></a>
</div>

<div class="shareline-facebook">
<a href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><span class="social social-facebook"></span><span><?php echo $shareline; ?></span></a>
<a href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><span class="social social-facebook"></span><span><?php echo $facebookshareline; ?></span></a>
</div>
</div>

Expand Down Expand Up @@ -112,12 +114,10 @@
</div>
</div>

<?php
$printthis = get_post_meta( $post->ID, 'printthis', true);
if(strlen($printthis) > 0 || $printthis == 'false') echo '<form>

<form>
<input class="printbutton" type="button" value="Print this page" onClick="window.print()">
</form>';
?>
</form>
<hr />
<div class="related-wrap clearfix">
<h4>You might be interested in:</h4>
Expand Down
40 changes: 33 additions & 7 deletions functions.php
Expand Up @@ -203,13 +203,39 @@ endif;

add_filter('protected_title_format', 'protected_wrapper');
function protected_wrapper($title) {
return '<span class="protected">Protected: </span>%s';
return '<span class="glyphicons glyphicons-lock"></span>%s';
}
function print_shortcode( $atts ) {
return '<form>
<input class="printbutton" type="button" value="Print this page" onClick="window.print()">
</form>';
}
add_shortcode( 'printthis', 'print_shortcode' );

function fb_opengraph() {
global $post;

if(is_single()) {
if(has_post_thumbnail($post->ID)) {
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'medium');
$img_src = $img_src[0];
}
if($excerpt = $post->post_excerpt) {
$excerpt = strip_tags($post->post_excerpt);
$excerpt = str_replace("", "'", $excerpt);
} else {
$excerpt = get_bloginfo('description');
}

$facebookshareline = get_post_meta( $post->ID, 'facebookshareline', true);
if(empty($facebookshareline)) $facebookshareline = get_the_title();
?>

<meta property="og:title" content="<?php echo $facebookshareline; ?>"/>
<meta property="og:description" content="<?php echo $excerpt; ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="<?php echo the_permalink(); ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:image" content="<?php echo $img_src; ?>"/>

<?php
} else {
return;
}
}
add_action('wp_head', 'fb_opengraph', 5);
?>
4 changes: 0 additions & 4 deletions header.php
Expand Up @@ -14,10 +14,6 @@ include 'inc/vars.php';
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.ico" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
$ogtitle = get_post_meta( $post->ID, 'ogtitle', true);
if(strlen($ogtitle) > 0) echo '<meta property="og:title" content="'.$ogtitle.'" />';
?>
<title>
<?php wp_title( '|', true, 'right' ); ?>
</title>
Expand Down

0 comments on commit 3fde69a

Please sign in to comment.