Support Forum

Content filters in Simple:Press 5

CS Chris Smith
Chris Smith
Member

I’m new to Simple:Press and am trying to figure out how I can add content filters to posts and topics. I saw this in some documentation, but it didn’t seem to work when I used it to call the function “sf_custom_show_post” that did a str_replace:

add_filter('sf_show_post_content', 'sf_custom_show_post');

Any help on where I would find the documentation on this, or a quick explanation would be appreciated.

5 Answers

New Answer

MP Mr Papa
Mr Papa
Member

rather than that hacky one off filter we now allowing have tons of filters in place through the code for filtering content much akin to available standard wp filters…

what are you trying to do?  filter on display?  edit?  save?  guessing on display, in which case you can filter the content with the filter:

sph_display_post_content_filter

which runs after all of our various display filters have run…  or use

sph_display_post_content_pre_filter

which runs before all of our various display filters have run…

if other, please come back with what you are trying to do…

CS Chris Smith
Chris Smith
Member

Thanks the sph_display_post_content_filter was exactly what I was looking for.

AW Aaron Wentzel
Aaron Wentzel
Member

Where can i find a list of these filter, hooks, etc?  I’d like to show a list of the latest new topics on my home page.  Thanks,

MP Mr Papa
Mr Papa
Member

well, there in lies part of the problem with a small 3 man team…  the codex is where we want to document the complete list…

you can find a partial list at:  http://codex.simple-press.com/codex/api/actions-filters-and-classes/ but its already out of date…

the easiest way to look for our actions, hooks and filters is in the code itself…  do a search for do_action or apply_filters…

if you have content and you want to filter it some way, we may have a function for that already… all of those kind of filters (unfortunately, name confusion), you can look in our filter api file simple-press/sp-api/sp-api-filters.php

but…  if you just want to display the latest topics on your home page, you dont need a filter for that… you want a template tag or widget…  so grab the template tags plugin and see if the included widget or one of the template tags will do what you want…  see our footer for couple examples…