Adding custom links in portfolio widget

Hello Colorlib team,

First, thanks for the awesome Shapely theme!!!

I’m having an issue trying to create custom links in the portfolio widget.

What I did is I used your custom plugin 17 (the one removing the links of the portfolio items) here and added my custom hyperlink tag at the place it used to be:

while ($portfolio_query->have_posts()) : $portfolio_query->the_post();
                  if( has_post_thumbnail() ){ ?>
                    <div class="col-md-3 col-sm-6 masonry-item project fadeIn">
                        <div class="image-tile inner-title hover-reveal text-center">
                          <a href="[my custom link here]" title="<?php the_title_attribute(); ?>">
                            <?php the_post_thumbnail( 'full' ); ?>
...

However now that I’ve done that, the hyperlink tag that I added is also applied to every single HTML element of the following widget (a Parallax Section) in the homepage.

Am I doing anything wrong?

Thanks in advance for the help!

Cheers,
Mike

Hi Mike,

I hope you are well today and thank you for your question.

Please make sure that you close the anchor tag correctly as following.

while ($portfolio_query->have_posts()) : $portfolio_query->the_post();

                  if( has_post_thumbnail() ){ ?>
                    <div class="col-md-3 col-sm-6 masonry-item project fadeIn">
                        <div class="image-tile inner-title hover-reveal text-center">
                          <a href="[my custom link here]" title="<?php the_title_attribute(); ?>">
                            <?php the_post_thumbnail( 'full' ); ?>
                            <div class="title"><?php
                              the_title('<h5 class="mb0">','</h5>');

                              $project_types = wp_get_post_terms(get_the_ID(), 'jetpack-portfolio-type', array("fields" => "names"));
                              if( !empty( $project_types ) ){
                                echo '<span>'.implode(' / ',$project_types).'</span>';
                              }?>
                            </div>
                          </a>
                        </div>
                    </div><?php
                  }
                  endwhile; ?>

Best Regards,
Movin

Oh I see, rookie mistake :slight_smile: Thanks a lot for your help!

You are most welcome here :slight_smile:

I know this is an old thread, but I found this forum thread when searching for a solution. So I thought I’d add my own here. Instead of using custom code, I went with a slightly less intrusive solution. I installed the plugin Redirection. It allows to redirect your permalinks to different URLs. Just a 301 forward.https://wordpress.org/plugins/redirection/