Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress: extract & resize post attachment
    primarykey
    data
    text
    <p>I know this question belongs in the wordpress forum, but I've posted about a half dozen questions there and have never gotten any responses - I like the community here much more, please don't move this question to wordpress. </p> <p>I'm looking for a way to extract the attachment (could be a photo, youtube vid, or soundcloud song) of a category's most recent post, resize it, and then display it on my homepage. Check out my site at <a href="http://beachief.com/" rel="nofollow">http://beachief.com/</a> to see what I mean - the "Daily Chief" and "Tribal Music" sections are where I want to do this. I successfully resized the images above those two sections with this code: </p> <pre><code>&lt;img src="&lt;?php bloginfo('template_url'); ?&gt;/images/philadelphia.jpg" alt="Featured picture" class="scaled"/&gt; </code></pre> <p>But that only works for images that I have an exact file location to. This is the code I'm using to get my most recent posts and display some of their contents: </p> <pre><code>&lt;ul class="link-item"&gt; &lt;?php $feature_post = get_posts( 'category=4&amp;numberposts=1' ); ?&gt; &lt;?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?&gt; &lt;li&gt;&lt;h2 class="link-item"&gt;&lt;?php the_category(' '); ?&gt;&lt;/h2&gt;&lt;/li&gt; &lt;?php endforeach; ?&gt; &lt;?php $feature_post = get_posts( 'category=4&amp;numberposts=1' ); ?&gt; &lt;?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?&gt; &lt;li class="list-time"&gt;&lt;?php the_time('d'); ?&gt;.&lt;?php the_time('M'); ?&gt;&lt;/li&gt; &lt;li class="list-title"&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;li class="link-item"&gt;&lt;?php the_excerpt(); ?&gt;&lt;/li&gt; &lt;?php endforeach; ?&gt; &lt;/ul&gt; </code></pre> <p>I want to get rid of the excerpt and display the posts attachment, resized to match the columns width. How can I do this? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload