• 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

Mocha Image Help

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 › Design Tips and Tricks › Mocha Image Help

This topic is: not resolved

Tagged: featured image, images, Mocha, thumbnails

  • This topic has 4 replies, 4 voices, and was last updated 9 years, 9 months ago by Kelli.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • March 12, 2013 at 2:39 pm #25713
    sallyuk
    Member

    Hi

    I just added Mocha child theme to my blog (www.whosthemummy.co.uk) having previously used Fabric.

    What I've noticed is my posts don't display the image - in fabric you upload an image to the post and tick 'set as featured image' and the image displays on both the home/category page, and inside the post at a pre-defined size.

    In Mocha, the image is attached when you upload it. I can display thumbnails in category pages by selecting this option in theme settings, but on the home page and subsequent archive pages there is no image visible - can someone tell me how I can make the images I've previously uploaded visible? Ideally I'd like a large featured image on the top post, and thumbnail images on the other posts.

    I am REALLY not technical so simple advice would be so appreciated, thanks - I tried to understand the fix for the wonky menu and it went completely over my head!

    March 13, 2013 at 7:40 pm #26091
    Charlie
    Member

    I just spent 30 mins trying to work out a solution to this, read some tutorials, wrote some code, got something kind of working, wrote it all out here, then looked at your site, realising that I hadn't actually done that yet, and saw, to my horror, that you've already solved this!

    Can you please tell me how? There must be a better way than the one I came up with, ha.

    March 14, 2013 at 3:26 am #26147
    sallyuk
    Member

    Ah, in the end I asked our developer at work to do it for me!  I will ask him what he did and come back to share 🙂

    March 28, 2013 at 9:29 am #31761
    thedarkmist
    Member

    This should work:
    // Add support for featured image in pages and single posts
    add_action( 'genesis_post_content', 'insert_featured_image', 5, 0 );
    function insert_featured_image() {
    if (is_single() || is_page()) {
    if (has_post_thumbnail( $post->ID ) ) {
    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
    $full = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    $alt = get_post_meta( get_post_thumbnail_id( $post->ID ), '_wp_attachment_image_alt', true);
    ?>
    <a href="<?php echo $full[0]; ?>" class="lightbox"><img src="<?php echo $image[0]; ?>" width="<?php echo $image[1]; ?>" height="<?php echo $image[2]; ?>" class="alignleft post-image" alt="<?php echo $alt; ?>" /></a>
    <?php
    }
    }
    }

    June 1, 2013 at 6:43 am #43451
    Kelli
    Member

    @sallyuk - I'd love to know how you did this, too. Please share when you can!

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ 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

© 2023 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