wordpresspastebin

Setting the height of an embedded pastebin item on a Wordpress site


I have this blog post that I have been authoring. At the very bottom is an Additional Information expandable link:

Example from blog post

Within there are two links to pastebin code:

[pastebin id="uSP54JHz"]
[pastebin id="5hv0vYxy"]

The article is on a Wordpress site and I have a plugin called Pastebin installed. I have tried following the advice to get the view of the pastebin code to use a smaller height instead of the full height for the code but I can’t get it to work.

Since WordPress 4.2, you can double click the embedded item to set max width and max height. It will add the WordPress [embed] shortcode:

[embed width=”600″ height=”400″]http://pastebin.com/hcv2WRnX[/embed]

Note: Doing it the WordPress way, using the [embed] shortcode, is backwards and forward compatible, and it works with all the themes.

To be honest, I don’t see the point in specifying in pixels anyway. I just wondered if it could be reduced somehow. Kind of like StackOverflow view behaves.


Solution

  • You can just set a max-height on the .embedPastebin in your CSS. I'm not sure about the embed shortcode (Note: the quotation marks in your example may not parse properly because they are and instead of ")

    Using the following CSS works pretty well:

    .embedPastebin {
        max-height: 300px;
    }
    

    enter image description here

    If you want the embedFooter to always remain at the top, you can instead limit the size of the ol and change the overflow on it:

    .embedPastebin ol {
        max-height: 300px;
        overflow-y: scroll;
    }
    

    Screenshot