diff --git a/wp-content/themes/aktiv2014/functions.php b/wp-content/themes/aktiv2014/functions.php index c3c9deb..6ac6d4e 100644 --- a/wp-content/themes/aktiv2014/functions.php +++ b/wp-content/themes/aktiv2014/functions.php @@ -374,7 +374,7 @@ function restricted_image($image){ // get URLs for each image $image = array(); foreach ( $image_ids as $id ) { - $thumbnail = wp_get_attachment_image_src( $id, 'full'); + $thumbnail = wp_get_attachment_image_src( $id, 'medium'); if ($thumbnail) { $image[] = $thumbnail[0]; } @@ -396,4 +396,24 @@ function restricted_url($url){ } add_filter('opengraph_url', 'restricted_url'); +function restricted_description( $description ) { + $post = get_restricted_post(); + if($post == null) { + return $description; + } + + if (is_singular()) { + if (!empty($post->post_excerpt)) { + $description = $post->post_excerpt; + } else { + $description = $post->post_content; + } + } + + $description = wp_trim_words($description); + + return $description; +} +add_filter('opengraph_description', 'restricted_description'); + ?>