• Resolved billjwordpress

    (@billjwordpress)


    Can someone help me to know where and how to add the code below? “To the bottom of current theme Functions.hph file – I have no idea where that is or how to do that. Thank you

    ————-

    7. Bonus! If you have a sharp eye, you probably thought: “Okay, but the old Unsubscribe page contained an Undo Unsubscribe link, how can I add it to this new Unsubscribe page?”
    The old Unsubscribe page
    Here’s how to do it: add the following code to the bottom of your current theme’s functions.php file (wp-content/themes/your-theme/).
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    /**
    * function to return an undo unsbscribe string for MailPoet newsletters
    * you could place it in the functions.php of your theme
    * @return string
    */
    function mpoet_get_undo_unsubscribe(){
    if(class_exists(‘WYSIJA’) && !empty($_REQUEST[‘wysija-key’])){

    $undo_paramsurl = array(
    ‘wysija-page’=>1,
    ‘controller’=>’confirm’,
    ‘action’=>’undounsubscribe’,
    ‘wysija-key’=>$_REQUEST[‘wysija-key’]
    );

    $model_config = WYSIJA::get(‘config’,’model’);
    $link_undo_unsubscribe = WYSIJA::get_permalink($model_config->getValue(‘confirmation_page’),$undo_paramsurl);

    $undo_unsubscribe = str_replace(
    array(‘[link]’,'[/link]’),
    array(‘‘,’‘),
    ‘<p><b>’.__(‘You made a mistake? [link]Undo unsubscribe[/link].’,WYSIJA)).'</b><p>’;

    return $undo_unsubscribe;
    }
    return ”;
    }

    add_shortcode(‘mailpoet_undo_unsubscribe’, ‘mpoet_get_undo_unsubscribe’);
    Then add this shortcode to your newly created Unsubscribe page: [mailpoet_undo_unsubscribe]
    New shortcode

    Tip: If you are using a custom Page Template you can “echo” the Undo link directly into your .php template:
    1
    echo mpoet_get_undo_unsubscribe();
    Here’s what it’s going to look like now:
    New unsubscribe page

    https://www.ads-software.com/plugins/wysija-newsletters/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undo Unsubscribe Link’ is closed to new replies.