Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4948

    Hi,

    How can I use external links for portfolio items? I would like to implement a portfolio page and the portfolio widget “Latest Portfolio” in the footer.

    Portfolio page:

    The item image could be linked to external content by using “Link manually” in “Portfolio Entry – Featured Image”, but I don´t get a solution for the title of the item. How can I edit this link or refer to the link of featured image?

    Latest Portfolio widget:

    Out of the box image and text are refered to “…mysite…/portfolio/item”, but I want to refer either to an external content or to the portfolio page. As far as I know the link for the item is set in class-framework-widgets.php:

    echo "<a class='news-link' title='".get_the_title()."' href='".get_permalink()."'>";

    Is it possible to use the “external link of featured image” instead of permalink?

    Matthias

    #48257

    Hey,

    I’d use post meta instead of the external link field because of various reasons (the most imporrtant is that you can’t control the link output if you attach more than one image. You’d need to reorder the images when you want to change the link). To use post meta change following code in loop-portfolio.php (and the widget files if you like):

    <a class="more-link" href="<?php echo get_permalink(); ?>"><?php _e('Read more','avia_framework'); ?></a>

    to:

    <?php if ( get_post_meta($post->ID, 'external_url', true) ) { ?>
    <a class="more-link" href="<?php echo get_post_meta($post->ID, 'external_url', true); ?>"><?php _e('Read more','avia_framework'); ?></a>
    <?php }else{ ?>
    <a class="more-link" href="<?php echo get_permalink(); ?>"><?php _e('Read more','avia_framework'); ?></a>
    <?php } ?>

    and set a custom field with the name “‘external_url” for all items you want to link to a external url. For portfolio items you need to activate custom fields. Open up register-portfolio.php and replace:

    'supports' => array('title','thumbnail','excerpt','editor','comments')

    with:

    'supports' => array('title','thumbnail','excerpt','editor','comments','custom-fields')

    #48258

    Thank you very much! It works!

    regards

    Matthias

    #48259

    Glad that I could help you :)

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘External portfolio links’ is closed to new replies.