Extracting Group Forum Topic Info for Metatags
-
Hi folks…
I have a site set up with lots of bbpress based forums, each of which belong to a Buddypress group. I want users to be able to share each forum topic on Facebook, so I need to add the og metatags to the head of the topic pages, showing topic title, content, etc.
To do this, I need a function which can access the topic title and topic content. However, since the forums are part of groups, the topic pages appear only on group pages, where the title is the group title rather than the topic title. The content is absent from the page (the_content() returns nothing), unless I perform a loop… but that gives me two problems:
1) get_the_content() returns me nothing, even though the_content() will output the entire page content
2) Having done the loop before the page loads, the actual page then has no content!So how can I extract the topic title and topic content information in a function which I pass to add_action(‘wp_head, …) for a topic of a bbpress forum which is associated with a buddypress group?
I am using WP 4.0.8, Buddypress 2.3.5 and bbpress 2.5.8 and you can see a link to a page I want to do this for at
http://lacomunidadconsciente.es/groups/mente-y-cuerpo-mind-and-body/forum/topic/sound-bowl-meditation/Thanks!
- You must be logged in to reply to this topic.