Close

Account

Documentation

Forum

Menu

Get featured image

  • Post count: 57
    z4m3
    July 2, 2014 at 7:58 pm #1026

    Hello,

    I tried to make a custum archive porfolio template based on the original archive and did well untill I met this:

    How can i get the featured image of aportfolio?

    Here is my portfolio archive:

    Best,
    Hans

    Post count: 2684
    Rai
    July 3, 2014 at 4:35 am #1047

    Hi Hans,

    Portfolio is different from other post type. It is not using default WordPress Featured Image but Image Cover. You can grab cover image/featured image of portfolio using this code:

    $coverimage = jeg_get_image_attachment(get_post_meta($post->ID, "coverimage", true));

    Thank you

    Post count: 57
    z4m3
    July 4, 2014 at 3:13 pm #1147

    Thanks Rai! That works like a charm!

    One more question: how to get the categories belong to that portfolio post?

    Post count: 2751
    Jegbagus
    July 5, 2014 at 7:42 am #1156

    Hi Hans,

    you can use bellow code :

    $termlist = get_the_terms($value->ID, JEG_PORTFOLIO_CATEGORY);

    it will return array of term object.

    Thank you

    Post count: 57
    z4m3
    July 5, 2014 at 9:52 am #1163

    Thanks, but the code does not work:
    $termlist = get_the_terms($value->ID, JEG_PORTFOLIO_CATEGORY);
    echo $termlist;
    I got only a word read: Array

    But so far I can obtain the list by using: jeg_side_bottom_navigation();

    Another quetion: How to obtain names of current categories of a portfolio?

    Post count: 2684
    Rai
    July 6, 2014 at 6:18 am #1180

    Hi Hans,

    You can use this code to display categories of a portfolio:
    <?php the_terms( $post->ID, JEG_PORTFOLIO_CATEGORY, 'Category: ', ', ', ' ' ); ?>

    Best regards,
    Rai

You must be logged in to reply to this topic.