vschipper
Member
Posted 4 months ago #
Hello, I hope no one has already posted answering this question, either way I haven't been able to find it yet.
My problem is pretty straight forward. I am feeding all post content into sidebars that are 235px wide. This all works fine but only if the images in the post are then also 235px.
So the question is: How do I make it so that all media (images or embedded video) that are not posted as width: 235px; are then resized as 235px; for the sidebar. (And have this happen automatically)
I hope there is a solution for this.
please post a link to your site to illustrate the problem.
vschipper
Member
Posted 4 months ago #
Problem solved: though not in the manner I had hoped.
vschipper
Member
Posted 4 months ago #
What I had tried to do is to do something with the php:
// WIDGET CODE GOES HERE
query_posts( array( 'category_name' => attribute_escape($title), 'posts_per_page' => -1 ) );
if (have_posts()) :
echo "<ul>";
while (have_posts()) : the_post();
echo "<li><br><a href='".get_permalink()."'>".get_the_title()."</a></li>";
echo the_content();
<strong>//$content = the_content();
//echo preg_replace('/(<img .* alt).*>/', '$1 width="235px" height=auto>', $content);</strong>
however: this was easily solved by making on:
.sidebar img {
width: x;
height: auto;
}
vschipper
Member
Posted 4 months ago #
This also works with .sidebar iframe { width: x; height: auto;}