Changes to widget file do not take effect

Home Forums Jevelin Theme Changes to widget file do not take effect

Home Forums Jevelin Theme Changes to widget file do not take effect

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • laszlo_oe
    Participant

    Hi,

     

    I was trying to turn the email field into a mailto link within the “Shufflehound Contacts” widget, but none of my changes are taking effect.

    I followed your instructions from this post: https://support.shufflehound.com/forums/topic/change-widgets/#post-9266

    For your reference I attach a screenshot showing the entire path to my customized widget.php within my jevelin-child theme folder.

     

    Can you please help to confirm what is required for widget customization?

    I am using WordPress 4.9 and Jevelin theme 2.6.1.

     

    Thank you.

    Attachments:
    You must be logged in to view attached files.

    laszlo_oe
    Participant

    A quick update: I think there is an error in the widget PHP code. To link up the widget.php file, the class-widget-contacts.php builds up $filepath using the get_template_directory() function.

    line 23 of the class-widget-contacts.php:
    $filepath = get_template_directory() . ‘/inc/widgets/contacts/views/widget.php’;
    Based on WordPress documentation get_template_directory() will provide path to the main theme’s folder even if a child theme is used.

    Relying on the get_stylesheet_directory() function instead will correct $filepath and the widget.php that is located within the Child theme will be properly included.

    line 23 of the class-widget-contacts.php that works with child theme:
    $filepath = get_stylesheet_directory() . ‘/inc/widgets/contacts/views/widget.php’;
    Wordpress documentation reference:
    https://developer.wordpress.org/reference/functions/get_template_directory/
    https://developer.wordpress.org/reference/functions/get_stylesheet_directory/

    Attachments:
    You must be logged in to view attached files.

    Hi @laszlo_oe,

     

    I hope you are well today and thanks for posting here.

     

    You are customising it correctly but we can’t use get_stylesheet_directory function in place of get_template_directory function as it always returns path of current theme and if child theme is used then child theme path is always returned which causes problem if the user is not overwriting widget in the child theme.

     

    Please advise if you have more questions.

     

    Best regards,
    Shufflehound team

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