• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Ambiance Pro, adding the feature image to custom post type.

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Ambiance Pro, adding the feature image to custom post type.

This topic is: resolved

Tagged: ambiance pro, Custom Post Type, feature image

  • This topic has 5 replies, 2 voices, and was last updated 11 years, 2 months ago by David Chu.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • January 28, 2015 at 12:08 am #138819
    duellingpixels
    Participant

    Hi All,

    I am after a bit of guidance, as I am a bit of a hacker when it comes to php. I am tying to replicate the feature image above the post for a custom post type. I have the custom post type to the following functions which I thought would be controlling this image (rpr_recipe is the custom post type):

    //* Localize backstretch script
    add_action( 'genesis_after', 'ambiance_set_background_image' );
    function ambiance_set_background_image() {

    if ( is_singular( array ('post', 'page', 'rpr_recipe' ) ) ) {
    $image = array( 'src' => has_post_thumbnail() ? genesis_get_image( array( 'format' => 'url' ) ) : '' );

    wp_localize_script( 'ambiance-backstretch-set', 'BackStretchImg', $image ); }

    }

    //* Hook entry background area
    add_action( 'genesis_after_header', 'ambiance_entry_background' );
    function ambiance_entry_background() {

    if ( is_singular( array ('post', 'page','rpr_recipe' ) && has_post_thumbnail() ) ) {

    echo '<div class="entry-background"></div>';
    }

    }

    This generates the space above the recipe output, but no image is generated. Would any one have further suggestions of what I could do to generate the image?

    Cheers,

    Nick

    http://syd.creativeplatoon.com/food-demo-three/recipe/seasoning-mix/
    January 28, 2015 at 10:20 am #138849
    David Chu
    Participant

    Hi,
    That's an interesting idea, using Backstretch for that. I can give you a lead, but that's about it without being in there.

    When you define your Custom Post Type, you'll need to give it thumbnail (aka Featured Image) support. If you're using a CPT interface, check there, or have a look at the documentation, doing a find on "thumbnail".

    Good luck,
    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    January 28, 2015 at 4:39 pm #138890
    duellingpixels
    Participant

    Hi David,

    Thanks for your response.

    Yes, the cpt has thumbnail support already. The images are displaying without any issues on the recipes archive page. It is just on the singular page that the feature will not display. This is why I am a bit lost on the cause of the problem.

    Thanks

    Nick

    January 28, 2015 at 6:32 pm #138894
    David Chu
    Participant

    You're on the case, then! I've got a couple of last thoughts. Beyond a typo, which is possible in that fairly complex code, all those nested structures....

    I wonder if "is_singular" may not be working in the context of your code, such as its location relative to the loop. Maybe test that specifically. A longshot.

    Cheers, D


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

    January 28, 2015 at 6:55 pm #138896
    duellingpixels
    Participant

    Hi David,

    I worked it out, it looks like it is bug in the recipe plugin and basically a feature image does not show if the instructions field have not been created.

    Thanks for offering your assistance!

    Cheers,

    Nick

    January 28, 2015 at 9:38 pm #138916
    David Chu
    Participant

    Nick,
    Good sleuthing! With your willingness to write code, you'll go far!

    I hadn't seen that recipe plugin. Here's some gossip for you.... I was working with Easy Recipe Plus the other day, and it's quite nice, but a funny thing about it is that it can be a bit of a resource hog.

    If I were doing anything hardcore with recipes, I might just use straight Custom Post Types and template them myself. 🙂

    Dave


    Dave Chu · Custom WordPress Developer – likes collaborating with Designers

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble