WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Show thumbnail (4 posts)

  1. cannect
    Member
    Posted 1 year ago #

    This question may look a bit simple at first. But when I take a look at this Git ticket: https://github.com/pods-framework/pods/issues/971 then we can with version 2.3.1 do the following to get the thumbnail of an image field: https://github.com/pods-framework/pods/issues/903

    I use Pods 2.3.1, Pod Page and Pod Template to display the data.
    image.guid works fine, but thats the full image.

    I am in the ->fetch() loop, how to display a thumbnail of a file type field?

    Thank you.

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Try this:

    echo pods_image( $pod->field( 'your_file_field' ), 'thumbnail' );

  3. cannect
    Member
    Posted 1 year ago #

    Thanks for your reply. However, this does not work with my Pod Page / Pod Template setup. Its about your code above.

    My Pod Page:

    <?php
    $pods->find();
    
    echo $pods->template('categorie_block');
    while($pods->fetch()){
        echo $pods->template('categorie_block');
    }
    ?>

    Pastebin Variant: http://pastebin.com/r8UQWSns

    My Pod Template 'categorie_block':

    <div class="categorie-block-wrapper">
    	<div class="categorie-block">
            <h2>{@naam}</h2>
            <img border="0" src="<?php echo pods_image( $pods->field('afbeelding'), 'thumbnail' ); ?>" width="100" height="100"/> // does not work
        </div>
    </div>

    PasteBin variant: http://pastebin.com/naxLd8GR
    Of course I have tried different combinations:
    echo pods_image( $pod->field('afbeelding'), 'thumbnail' );
    echo pods_image( 'afbeelding', 'thumbnail' );
    echo pods_image( '{afbeelding}', 'thumbnail' );

    Btw: About this Pod Page and Pod Template combination is this bug report on Github: https://github.com/pods-framework/pods/issues/1244

  4. cannect
    Member
    Posted 1 year ago #

    Ah, I have found it with get_definded_vars().

    I can use the $obj variable.

    So my Pod Template code changes to:

    <div class="categorie-block-wrapper">
    	<div class="categorie-block">
            <h2>{@naam}</h2>
            <?php echo pods_image( $obj->field('afbeelding'), 'thumbnail' ); // WORKS ?>
        </div>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic