Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Content filters in Simple:Press 5
Avatar
Chris Smith
Member
Free Members
sp_UserOfflineSmall Offline
May 11, 2012 - 5:37 pm

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 11, 2012 - 7:24 pm

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...

Avatar
Chris Smith
Member
Free Members
sp_UserOfflineSmall Offline
May 14, 2012 - 10:00 am

Thanks the sph_display_post_content_filter was exactly what I was looking for.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
May 14, 2012 - 12:11 pm

Excellent. Thanks for the update.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Aaron Wentzel
Member
Free Members
sp_UserOfflineSmall Offline
May 19, 2012 - 9:10 am

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,

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 19, 2012 - 9:35 am

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/.....d-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...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 617
Members: 17359
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10125
Posts: 79620