WordPress.org

Forums

Help with php pulling image from post (4 posts)

  1. sedentarygecko
    Member
    Posted 1 year ago #

    The following code is present in a theme I installed (Ophion) which is responsible for grabbing an image from a post and creating a slideshow on the front page.

    <?php $screen = get_post_meta($post->ID,'slide', true); ?>
                        <img src="<?php echo ($screen); ?>" alt="<?php the_title(); ?>"width="300" height="200"  class="">

    Despite including an image in the two posts I am trying to create a slideshow for and setting that image as the featured image, the slideshow is still not including the image.

    If anyone could help me to debug this, I would appreciate it.

    Thanks,

    Corey

  2. Caspar
    Member
    Posted 1 year ago #

    Assuming you've created a custom field named slidein your post and set your image's URL as its value, if that still doesn't work, you should go ahead and contact the theme author(s) for their support. From the piece of code you've included I can't see anything technically wrong. I wouldn't hard-code height and width, though.

  3. sedentarygecko
    Member
    Posted 1 year ago #

    I haven't created a custom field. My guess is the syntax would look like this:

    [slidein] url [/slidein]

    How am I doing?

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    http://wpcorner.com/ophion-theme/

    read this at all?

    It states

    HOW TO SET FEATURED SLIDER IMAGES: Use “slide” as key of the custom field.
    It’s value is the URL to the image you wish to display.
    Custom Field: slide
    Value: http:// (url of image)
    Recommended Image Dimensions: 300×200

    so you set that from within a post. If you don't see the custom fields area under your post editor, turn it on from screen options

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.