0
votes
0answers
17 views

how to get wordpress categories list with thumbnails?

i am trying to get thumbnails list with their thumbnails images .i tried code below but it only gives categories list . i know there a could do using feed_image but i can't figure out how to do it ...
0
votes
2answers
728 views

How do I change/modify the_post_thumbnail(); html output?

I'm working on building out a custom theme and have been struggling with this one for a bit. I am trying to modify the HTML output of the_post_thumbnail(); function. I need to do this because I am ...
0
votes
1answer
43 views

Overwriting a Shortcode

I have a theme that extends the Visual Composer plugin with a slider on the front page. The slider will show five testimonials from five different customers. I want to add the featured image of each ...
0
votes
1answer
41 views

featured post as div background

Ok I didn't find an answer yet.. because my code is different.. I want to set the featured image as the div's background but I don't know how to do that.. html, php and css collide in one line.. This ...
0
votes
1answer
73 views

How to add a featured image to a existing post via php?

I'm having trouble to add a featured image to an existing post via PHP. The image resides on wp-content/upload folder. The script i'm doing, is not a plugin, theme, or something like that. It's just ...
0
votes
1answer
34 views

How to display thumbnail if post is assigned one otherwise not

I would like to display the most recent post in a block, and if the post is assigned with a thumbnail I would like it to be shown on the left to the post content. This is my code that I have been ...
0
votes
1answer
249 views

Post Thumbnail on Single (if elseif else)

I have the following news articles on the frontpage of a website I'm currently working on: For this I'll need to write two simple PHP if statements, which I've already done successfully, but on the ...
0
votes
2answers
103 views

How can i give a download link to the thumbnail or featured image

I am using the code below to give users download the thumbnail image, as i have a wallpapers site: <a class="downloadbutton" href="<?php echo $src[0]; ?>" download="imageName">Download ...
-1
votes
1answer
33 views

add if statement to the featured image

I have a featured image. I want to add an if statement to the size. For example, if the featured image height exceeds 500px I want to add something. Is that possible ?
0
votes
1answer
205 views

Random Category with Recent Post Title and Thumbnail

This code below works perfect to pull the title of five random categories, the issue is for each random category I want the latest post title and thumbnail but where and how do I add the post query? ...
0
votes
0answers
47 views

How to set a Maximum Image size to a Field in WordPress

I have a customized frontend form in WordPress that allows to set a featured image to a post before publishing it. I want to set a maximum-allowed "width" as well as a "height" to the "upload image" ...
0
votes
2answers
214 views

Get the alt text of the image in a array

I have a php code. That put the thumbs on the screen. I have this: <?php if (has_post_thumbnail()) : ?> <div class="image"> <?php $attachment_id = get_post_thumbnail_id(); ...
0
votes
1answer
511 views

Display post thumbnail in foreach loop

I am trying to display a thumbnail in a foreach loop. The thumbnail is a new image size I have added called "plant-thumb". I have all the desired elements displaying properly except for the thumbnail. ...
0
votes
1answer
73 views

the_post_thumbnail unless video id is added

I have 2 choices on the edit post page to insert an video ID from either vimeo or youtube. The user needs to select, with a select field (channel), if he wants to embed video from one or the other. ...
0
votes
1answer
652 views

How to get Poster (thumbnail) Image of Video

I'm getting all videos using the function below and it's working fine. Now I want to get the videos Poster Image (Thumbnail Image) from that video. How can I get the video Image as thumbnail? I've ...
1
vote
1answer
1k views

How to scale image with equal width and height without distortion?

I have a section on my frontpage that querys through recent posts and grabs the title and thumbnail of each. In my functions.php, I've specified a width and height for the thumbnail using: ...
0
votes
3answers
442 views

Setting post thumbnail sizes in template file and functions.php

For my post I have a box for the post image and the size of the box is 214 x 73. I want the image to fit the width of the box and have it cropped at 73px height. This is what I have so far in my ...
1
vote
1answer
188 views

Echo URL of large version of Featured Image

I use this plugin to echo the URL of a post's featured image in the header: <?php /** Plugin Name: Post Thumbnail FB header */ function fb_header() { // Not on a single page or post? Stop ...
0
votes
1answer
152 views

is it possible to force wordpress to always save thumbnails as 'jpg' not 'png'

I cant see any settings and cant see much in the php api docs regarding this? for instance if the original file upload is a png wordpress converts to jpg
0
votes
1answer
215 views

Trying to change featured image from 180x180 to full width on home page

Right now my theme puts a 180x180 square image to the left of the title on the home page for each blog post. I'd like to change that to be full width of the content area and below the title. I'm using ...
0
votes
1answer
505 views

Apply class to every third list item? [duplicate]

Possible Duplicate: How to mark every 3rd post I'm trying to give a class to every third list item on my page. I know how to give a class to every item, but not to specific items in a row, ...
0
votes
1answer
387 views

Why use foreach to get attachment_id if numberposts is equal to 1?

I needed to pass an image to a Pinterest plugin in posts without a Featured Image so I wrote a little function to get the id of the first picture in a post. This code is in the loop-single.php where ...
0
votes
2answers
1k views

Show different size featured images (the_post_thumbnail) for 1st, 2nd and 3rd posts?

I file all the galleries on my blog under the 'gallery' tag. I use the following code (via) to display the latest 7 gallery posts after the 8th latest post on home page: <!-- Featured post ...
0
votes
1answer
121 views

Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out

In short, Im not a master of PHP yet and Im not entirely sure how to place a series of checks (if statements) in my template so that it will know what to display depending on what the client ...
1
vote
1answer
410 views

How to Display Image Meta underneath EVERY image in EVERY post

First off, I want to say thank you for taking the time to even read this, I really do appreciate the help this site and it's community has given me thus far. i have looked forever to be able to ...
3
votes
2answers
348 views

PHP/Manual use of images? - 2 Questions

I've made a quick PHP script/page that uses the wp_insert_post() function to insert a post directly. And this works great. The post I am manually adding has an image in it, so I firstly ...
8
votes
3answers
2k views

What's the best way to use the Featured Image for responsive web design?

I have a brilliant idea and since WordPress already takes care of some of the work, I just need to find a good method to make this work. I am working on a project that needs to be responsive to all ...
0
votes
1answer
1k views

Show post thumbnail only if it exists using timthumb

I am using timthumb as the image size management script throughout my wordpress site but I just noticed that an empty image tag shows up even when there is no thumbnail. <?php ...
0
votes
1answer
753 views

Three Questions with Twenty Eleven theme

I have a few things that I need help with in Twenty Eleven. The logo I put in the header is resized to 578px by 160px, when it is supposed to be 326px by 90px. I would like to simply the php code ...
1
vote
1answer
672 views

Adding featured image via PHP

Currently I'm working on a project where site is driven by user articles, how it works: Any user goes to compose post page and writes post along with few details, has upload file option for image ...
2
votes
2answers
2k views

WP Insert Post function - Insert Post Thumbnail

Whilst performing wp_insert_post, how would one insert the post thumbnail. I tried the code below to no avail. $postit = array( 'post_title' => $itemtitle, 'post_content' => '', ...
1
vote
1answer
374 views

How can I show the post thumbnail from the most recent of a certain post type, in widget?

I'm using the excellent PHP Code Widget plugin, and want to create a widget that displays the post thumbnail (aka featured image) for the most recent 'project' post. Here's the code I have so far, but ...
2
votes
1answer
846 views

Display All Post Attachments and Assign Class to the Last Image?

I have a function get_images() in which I would like to display all image attachments for the current post (or page) in a list with the last image having a class="last" attribute to mark it as the ...