Support » Plugin: Social » Customize the Broadcast Message with Category Token

  • Is there any way to add the ability to include the category in the broadcast message? It would also need to include an option to remove the trailing “s” from the category name in order to make it singular.

    For instance, I have two categories named “Articles” and “Videos” and I would like to do something like this:

    “New {category}: {title} {url}”

    …and have it come out like:

    “New Video: This Video’s Title

    Looking at the plugin code, I think adding a case to the format_content function like the following:

    case '{category}':
      $category = get_the_category($post->ID);
      $content = htmlspecialchars_decode($category[0]->cat_name);
      $content = substr($content,0,-1);

    …and adding a default value to the broadcast_tokens function like:

    '{category}' => '',

    …should work. Right? Can you confirm if this would work (for me)?

    Of course my method of using substr to remove the “s” is definitely not the proper way to handle this, but it would work for my category names. This should probably be done with a regular expression and should have a checkbox in the admin panel to turn this functionality on.

    It would also be nice to have the links shortened for Twitter, or does Twitter do this already?

  • The topic ‘Customize the Broadcast Message with Category Token’ is closed to new replies.