• Dan

    (@reggie_bond)


    Hi Alan,
    fabulous plugin! Yet just try to solve one function without success.

    (=> Add ‘widget_content’ filter is checked)

    I want to display some text beneath one specific widget and only when user is logged in. Therefore I tried to adapt/evolve your snippets. Right now I have 2 versions appearing logical to me yet both are displaying the additional text beneath every widget (logged-in/non-logged-in)

    add_filter(‘widget_content’, ‘widget_footertext_ESL_Offer’, 1, 2);
    function widget_footertext_ESL_Offer ($content=”, $widget_id=”){
    if ( is_user_logged_in() || ($widget_id==’text-11′) ) {
    return $content.”

    THIS APPEARS AFTER WIDGET ESL

    “;
    }
    }

    OR

    add_filter(‘widget_content’, ‘widget_footertext_ESL_Offer’, 1, 2);
    function widget_footertext_ESL_Offer ($content=”, $widget_id=”){
    if ( is_user_logged_in() && ($widget_id==’text-11′) ) {
    return $content.”

    THIS APPEARS AFTER WIDGET ESL

    “;
    }
    }

    Any hint please?

    Thank you very much!
    Dan

    https://www.ads-software.com/plugins/widget-logic/

  • The topic ‘Filter Function: Content beneath a specific widget ID when logged in’ is closed to new replies.