Add another Info to employer views

Hi,
I would like to add another information to the employer widget view. I have a single page that I set up with the page builder widgets. I added the employer widget and they are shown - even though the images are huge. However, I would like to add the email address or department information to it. What I have done so far is to create a new field in the Employee info section in the types add-on. But how can I display the additional field in the widget? Also is it possible to put the employees in a rotating carousel instead of a grid?
Thanks for your help.

Best,
Dominik

Hello,

This wouldn’t be possible without changing the widget’s code.
To get the value of your new custom field you’ll have to do it like this:
<?php $mail = get_post_meta( get_the_ID(), ‘wpcf-mail’, true ); ?> and replace mail with the slug you used. Then simply echo it in the form you want.

Thanks Vlad, that solved my problem.
Now my only problem is, that when put the changed file fp-employee.php in the widget folder of the child-theme it doesn’t overwrite the fp-employee.php file from the parent theme. When I replace the fp-employee.php in the parent theme, then it works fine. Since I won’t want to loos the update option, what do I have to do to make the changes in the child theme? Also, how can I display employees and services as a carousel?
Thanks for your help.

You cannot simply place widgets in your child theme because they are not part of the template hierarchy and they won’t get loaded. You first need to unregister the widget and then register it under a different name from the child theme. You can find some pointers here.

Again, for the carousel you would need to recode those widgets which is beyond the scope of this forum.

Thanks Vlad,

I followed the link and tried it out but when I do it, I just see a blank screen (front and backend) however if I replace the original fp-employee.php file with mine in the parent folder everything works well.

Here is the code that I tried:

functions.php

<?PHP

function moesia_child_widgets() {
     unregister_widget( 'Moesia_Employees');
     register_widget( 'Moesia_Employees_HUI' );
}
add_action( 'widgets_init', 'moesia_child_widgets', 99 );

require get_stylesheet_directory() . "/widgets/fp-employees-hui.php";
?>

moesia-child/widgets/fp-employee-hui.php

<?php

class Moesia_Employees extends WP_Widget {

// constructor
    function moesia_employees_hui() {
                $widget_ops = array('classname' => 'moesia_employees_hui_widget', 'description' => __( 'Display your team members in a stylish way.', 'moesia') );
        parent::WP_Widget(false, $name = __('Moesia FP: Employees HUI', 'moesia'), $widget_ops);
                $this->alt_option_name = 'moesia_employees_hui_widget';

                add_action( 'save_post', array($this, 'flush_widget_cache') );
                add_action( 'deleted_post', array($this, 'flush_widget_cache') );
                add_action( 'switch_theme', array($this, 'flush_widget_cache') );
    }
[...]

I just don’t understand what I do wrong.

You need to replace class Moesia_Employees with class Moesia_Employees_HUI. Not sure if this is the only issue though.

Ah I understand. Sorry for the stupidity. Now it seems to work. Thanks a lot for your help!