WordPress.org

Ready to get started?Download WordPress

Forums

Text formatting - custom theme (4 posts)

  1. LinePlaneVolume
    Member
    Posted 1 year ago #

    Hey guys,

    I am developing a custom theme and I am still pretty green at doing them, so I need help with a problem that I have come across more than once.

    If you look at this page:
    http://coylegraphics.com/wordpress1/category/about/team/

    You will see a white space above the name of each partner that I do not wish to be there. Each partner is a separate post called into the page. Each name is supposed to align with the top of each image. For the life of me, I can't figure out where this style is being designated because I did not put it in style.css. Any ideas? I've looked around for answers to this question, but can only find ones asking about removing the whitespace at the top of a default header, which is not the same issue.

    Thanks to anyone who deems it fit to help.

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    The images are inside paragraph tags - and those have these styles applied to them:

    #subContent p {
        padding-bottom: 23px;
    }
    .category-team p {
        margin-bottom: 0;
        padding-bottom: 52px;
    }

    The padding on the bottom is as wide as the content div -- that's the space you want to get rid of.

    Probably taking the images outside of the p tags is the easiest solution.

  3. LinePlaneVolume
    Member
    Posted 1 year ago #

    WPyogi,

    Thanks for the response. I see those <p> tags now... I should have thought to look at the source code.

    And, I now need to think about the formatting more, before I bang my head trying to figure out how to remove the post image from within the <p> tags, but this helps get me started.

    Many thanks!

  4. LinePlaneVolume
    Member
    Posted 1 year ago #

    And, if anyone else stumble across this question, you can place the following code in the functions.php file to remove the <p> tags from around post images.

    function filter_ptags_on_images($content){
        return preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '\1', $content);
    }
    add_filter('the_content', 'filter_ptags_on_images');

    I hope this helps someone else (found on css-tricks).

Topic Closed

This topic has been closed to new replies.

About this Topic