removing top padding from excerpt text

This commit is contained in:
Amine Ben hammou
2018-05-24 07:44:41 +00:00
parent 5b077cfb54
commit 2215b53141
2 changed files with 8 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ class PostContentManager {
}
}
function filterContent($content) {
function filterContent($content, $with_post_class = true) {
$content = self::convertEmbeddedContent($content);
// convert h4 h5 h6 to h3
@@ -49,7 +49,9 @@ class PostContentManager {
'<h2>', '<h3>', '<a>', '<ul>', '<ol>', '<li>', '<br>', '<blockquote>'
);
$content = strip_tags($content, implode('', $tags_not_being_stripped));
if($with_post_class) {
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS .'"', wpautop($content));
}
$content = trim($content);
return $content;

View File

@@ -37,7 +37,7 @@ class PostTransformer {
}
private function getStructure($post) {
$content = $this->getContent($post);
$content = $this->getContent($post, true);
$title = $this->getTitle($post);
$featured_image = $this->getFeaturedImage($post);
@@ -60,7 +60,7 @@ class PostTransformer {
}
private function getStructureWithLayout($post) {
$content = $this->getContent($post);
$content = $this->getContent($post, false);
$title = $this->getTitle($post);
$featured_image = $this->getFeaturedImage($post);
@@ -116,13 +116,13 @@ class PostTransformer {
return $this->imagePosition;
}
private function getContent($post) {
private function getContent($post, $with_post_class) {
$content_manager = new PostContentManager();
$meta_manager = new MetaInformationManager();
$content = $content_manager->getContent($post, $this->args['displayType']);
$content = $meta_manager->appendMetaInformation($content, $post, $this->args);
$content = $content_manager->filterContent($content);
$content = $content_manager->filterContent($content, $with_post_class);
$structure_transformer = new StructureTransformer();
$content = $structure_transformer->transform($content, $this->args['imageFullWidth'] === true);