Adding custom link to employee photo


#1

Hi,
When a user clicks on the employees photo, I want it to direct to a custom link. Bear in mind that the employees are actually “Workshops” on this page. I’ve filled in the ‘custom link’ field in the edit employee page but still no luck.

website: ritukabra.com

Kindly help.

Thanks


#2

Hi laconic,

you can follow this link to enable the custom link for the employees


#3

@Awan Isn’t that for the Sydney theme?

@jocoumbe: No, again you’re in the wrong forum. You’re using Sydney, this is Moesia. You should open your own topics anyway when you have questions.

#4

@Awan I made all the changes to my custom theme, but I’m not able to get what I wanted. Could you please help further?

I created a child theme directory called moesia-child in ‘wp-content/themes’ and added a widgets folder inside the child theme folder.
I went ahead and created the functions.php, styles.css and fp-employees.php (placed in the widgets folder) files.

Contents for each of the files:
a. styles.css

/*
 Theme Name:   Moesia
 Theme URI:    http://ritukabra.com/wp-content/themes/moesia-child/
 Description:  Moesia Child Theme
 Author:       Laconic
 Author URI:   http://laconic.in
 Template:     moesia
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, two-columns, three-columns, right-sidebar, fluid-layout, responsive-layout, custom-colors, custom-background, custom-header, custom-menu, featured-images, sticky-post, theme-options, threaded-comments, translation-ready
 Text Domain:  moesia-child
*/

b. functions.php

<?php

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style )
    );
    
function moesia_child_widgets() {
	unregister_widget( 'Moesia_Employees' );
	register_widget( 'Moesia_Workshops' );
}
add_action( 'widgets_init', 'moesia_child_widgets', 99 );
//Load the new widget
require get_stylesheet_directory() . "/widgets/fp-workshops.php";
}

c. fp-workshops.php (renamed from fp-employees.php)

<?php while ( $r->have_posts() ) : $r->the_post(); ?>
					<?php //Get the custom field values
						$photo = get_post_meta( get_the_ID(), 'wpcf-photo', true );
						$position = get_post_meta( get_the_ID(), 'wpcf-position', true );
						$facebook = get_post_meta( get_the_ID(), 'wpcf-facebook', true );
						$twitter = get_post_meta( get_the_ID(), 'wpcf-twitter', true );
						$google = get_post_meta( get_the_ID(), 'wpcf-google-plus', true );
						$linkedin = get_post_meta( get_the_ID(), 'wpcf-linkedin', true );
						$custom_link = get_post_meta( get_the_ID(), 'wpcf-custom-link', true ); 
<div class="employee col-md-4 col-sm-6 col-xs-6">
						<?php if ($photo != '') : ?>
						<?php if ( $custom_link != '' ) : ?>
 							<a href="<?php echo esc_url($custom_link); ?>" target="_blank">
 						<?php endif; ?>
							<img class="employee-photo wow zoomInDown" src="<?php echo esc_url($photo); ?>" alt="<?php the_title(); ?>">
						<?php if ( $custom_link != '' ) : ?>
 							</a>
 						<?php endif; ?>
						<?php elseif ( has_post_thumbnail() ) : ?>
							<div class="employee-photo wow zoomInDown"><?php the_post_thumbnail('moesia_workshops-thumb'); ?></div>
						<?php endif; ?>

#5

@laconic can you send an admin account of your to my email? you can send it to awan.rimbawan101 at gmail. Hope I can help you further


#6

@Awan I sent you an email. Just wanted to know if you want me to share the wordpress credentials or the cpanel login.

Awaiting your response.


#7

@laconic just reply your email. I need your wp credential only, not the cpanel account.


#8

@Awan just responded with the details :slight_smile:


#9

Hello @laconic , seems this topic already resolved.
please change your wp admin and cpanel credentials that you gave to me :slight_smile:


#10

@Awan, certainly. Thanks for all your help! :slight_smile: