Direct featured images on homepage to external URL
-
Hi Guys,
I’ve been looking for a way to do the following underneath, but I didn’t succeed until so far. Perhaps anyone can assist? Thanks in forward!
I’m running the latest version WP together with the TwentyFourteen theme. On one of my WP websites on my homepage, I got these lovely featured images displaying. Now instead of being directed to the post-page after clicking on one of them, I want to set the images to an external URL in the same browser screen (right after clicking them in the grid).
Now I’ve read some solutions on other topics which involve the custom fields. I do believe this is a perfect way to get these featured images linked to external URL’s. But the examples in the other topics do not explain how it is done for the TwentyFourteen theme. So I was hoping one of you could help me out, since I don’t know to much about php-coding…
The following code is in my content-featured-post.php :
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
'?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a>"> <?php // Output the featured image. if ( has_post_thumbnail() ) : if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) { the_post_thumbnail(); } else { the_post_thumbnail( 'twentyfourteen-full-width' ); } endif; ?> </a> <header class="entry-header"> <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?> <div class="entry-meta"> <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span> </div><!-- .entry-meta --> <?php endif; ?> <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">','</a></h1>' ); ?> </header><!-- .entry-header -->'
Thanks very much guys!!!
Marc
- The topic ‘Direct featured images on homepage to external URL’ is closed to new replies.