Share on facebook
Share on twitter
Share on linkedin

How to add a specific WhatsApp number for a WordPress category page


You can do it adding a bit of code in your theme functions.php:

add_filter ( 'whatsappme_get_settings', function ($settings, $obj) {
    // In a custom category archive page
    if (is_a( $obj, 'WP_Term' ) and $obj->slug == 'nails') {
        $settings['telephone'] = '99999999999'; // your category phone
    }
    // In a post of custom category
    if (is_a( $obj, 'WP_Post' ) and has_term('nails', 'job_listing_category', $obj)) {
        $settings['telephone'] = '99999999999'; // your category phone
    }

    return $settings;
}, 10, 2 );

This for your your example. In other cases you need to replace 'nails' with the target category slug and 'job_listing_category' if need to target other taxonomy.

Please contact us for more information or support.

5/5

80.000 + users love WAme for Wordpress

Add a WhatsApp chatbox to your WordPress site

Invitar a un amigo

Share on email
Por Email
Share on whatsapp
Por WhatsApp