Join our new community forum for support & discussion

Join Now

Home Support Extensions Social Links Disable social links extension for certain categories/subcategories

Disable social links extension for certain categories/subcategories

  • Author
    Posts
  • artshareco

    Hi Ihor,

    Is it possible to disable the extension for certain categories/subcategories? For instance, listings under the ‘Hosts’ category wouldn’t show Social Links but listings under ‘Artists’ would.

    ihor developer

    Hi,
    Yes, it’s possible to make links category-specific, replace 1,2,3 with category IDs:

    add_filter(
    	'hivepress/v1/models/listing/attributes',
    	function( $attributes ) {
    		$category_ids = [ 1, 2, 3 ];
    
    		if ( isset( $attributes['facebook'] ) ) {
    			$attributes['facebook']['categories'] = $category_ids;
    			$attributes['instagram']['categories'] = $category_ids;
    			// add more links in the same way
    		}
    
    		return $attributes;
    	},
    	1000
    );

    Please note that it includes categories instead of excluding them from categories, this is the easiest way.

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

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.