You created a cpt named books.
When a book post is created, an entry is created in the activity stream.
When the book post is viewed, it used the single.php WP template.
Correct?
The book post and the activity entry are 2 different things.
Why would you want to use an activity template to show the content from an instance of a post type?
If you want to create a custom activity – then why create a custom post type?
How to add an activity entry:
bp_activity_add()
Thanks for the reply.
I have created cpt’s because I want to add custom activity types that have different fields and meta data.
Here is what I’m actually doing (the book was just an example):
I am creating a community where users can
- Post status updates
- Ask questions
- Post tips
I have registered questions and tips as ‘buddypress-activity’ so that they show up in the activity stream, for example
Adam posted an update 2 mins ago
Sebastian asked a question 6 mins ago
Shanebp posted a tip 10 mins ago
Adam posted an update 14 mins ago
The normal, built in, status updates links work fine but the custom ones link to
http://buddypress.dev/tips/name-of-the-tip/
instead of
http://buddypress.dev/members/membername/activity/544/
thus using the single.php template instead of the activity template that I want to use.
Have you tried changing the action
field of your custom activity types ?
Also look at the primary_link
field – you may have to use it as part of filtering the activity loop.
But it’d be better to create the activity entry as you want it, rather than filter on display.