1

I've got a pretty unusual feature request or just don't know how to phrase it, since I couldn't find anybody else trying to do this.

In the editor of the front page I've added a custom meta box to select a title story from my posts. The title story is then displayed on the top of the front page with its featured image.

Now when I'm editing the title posts featured image I want to preview the changes on the front page before I save them. The preview obviously works on the post page, but thats not what I'm asking for.

Is there a way I could preview the changes to a post on the front page, where I show the featured image, title and excerpt of that post?

In case it helps, here is some the code I'm using to retrieve the title posts featured image on the front page:

$image_xs = wp_get_attachment_image_src(get_post_thumbnail_id($titleStoryID), 'image-size-small')[0]
2
  • Not 100% positive, but I don't think that's possible
    – Nate Beers
    Commented Feb 2, 2017 at 18:22
  • Yeah, I was afraid it wouldn't. I'll leave this here in case a Wordpress wizard comes along with a solution, though.
    – taymless
    Commented Feb 3, 2017 at 8:34

1 Answer 1

0

It is HTML and Javascript territory.

For the image preview, you may need a input type="file" with accept="image/*" and onchange event handler for the preview and the javascript getElementById to get the image id to display for preview. Have a look at these examples.

For the text preview part here is a fiddle link. It uses textarea for input, an empty html div with an id for the preview and the keyup javascript method as an event handler. For your title modify textarea with input type="text".

1
  • Hm.. I'm afraid we're not talking about the same thing here. I don't want to show a preview for an image upload, so there are no input fields. I want to preview the changes I've made to a post, but on the front page, where I'm showing that post.
    – taymless
    Commented Feb 3, 2017 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.