Support » Plugin: Simple Staff List » How add additional information to Position field

  • Hello,

    Is there a way to add multiple lines instead of one long line or sentence in the position field under Staff Member Info? Some of our staff have multiple positions and it would be nice to have each position on its on line.

    We used to be able to add <br> tag in this field but now it doesn’t work.

    example: Position: Financial Planning Manager <br> Chief Compliance Officer
    Financial Planning Manager
    Chief Compliance Office

    But now the field doesn’t recognize the <br> tag. Please advise us on the best way to handle multiple positions. Thanks@

Viewing 1 replies (of 1 total)
  • Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi @jhoward33

    This latest update included lots of data sanitization and escaping which is why your <br> tags are no longer working. The title field is now being run through esc_html() (link) before it’s printed on the screen. This would prevent any potentially dangerous content in a Staff Member field from being outputted. You can read more about escaping output here.

    To be honest, I hadn’t envisioned someone using the title field like this. 🙂

    One work around I came up with is to use some other kind of unique separator between the positions in the field that wouldn’t normally show up in content on your website. You could use a vertical pipe character |, for example. So in your Staff Member edit screen, their position field would look like:

    
    Financial Planning Manager|Chief Compliance Officer
    

    Then, somewhere in your theme’s functions.php file or in a custom plugin, you could use this to transform the | character into <br />:

    
    add_filter( 'esc_html', 'simple_staff_list_multiline_position_field', 10, 1 );
    function simple_staff_list_multiline_position_field( $output ) {
    	return str_replace( '|', '<br />', $output );
    }
    

    That would restore the functionality to how you had it before.

    Let me know if that works for you or if you have any questions.

    Thanks!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.