Skip to:
Content
Pages
Categories
Search
Top
Bottom

Any way for Buddypress Topics to have header or extra description or WP shortcode fields that always

  • @balirakhra

    Member

    I need to add a shortcode to certain topics. I have managed to get the add_shortcode filter to the posts, which is great. But, the problem is that I want the shortcode to display its content at the top of the topic, but at the same time I need the posts to be displayed sort-DESCENDING. And this pushes my post with the shortcode further and further down the page, so nobody will see it.

    At the moment the shortcode is used to display important topic-sensitive information, eg news scrollers or polls etc that need to be displayed at the top,

    To summarise I need to do both these:
    1. Keep the post replies in Sort descending order
    2. Whilst maintaining specific topic content to the TOP of each topic (This content includes a descriptive text, and WP shortcode functionality). I wouldn’t mind including this in a post which works, so then I would need some php code that would keep the topic’s initial post at the top. However, as this would not be required for EVERY topic, I would need some way of selecting which topics need this extra information and shortcodes, and which ones don’t.

    What I’ve tried so far:
    For the topic’s initial post, I placed the shortcode right at the beginning followed by the introduction text.

    I then tried using php functions to cut the relevant shortcode-string out of bp_get_the_topic_text() and then feed that shortcode-string into a php function (that I would hard code into the topic header) to run that shortcode. But this didn’t work as bp_get_the_topic_text() didn’t seem to allow any php string functions to extract to affect the topic_text string in any way, and would still just echo the whole topic-text post in its entirety.

    Even that was just a workaround. Ideally, I’d prefer to create some custom fields for each topic apart from title, content and tags.
    The first of these custom fields would house a shortcode, and the second would be a textarea for some introductory text for a topic should it be so required.
    Both these custom fields should display in the header for the topic (above the list of posts, sorted DESCending.)

    My client’s website will be going live soon, but I just can’t get this to work. I’ve reached the limit of my own skills (I’m just starting out as a web designer) and
    have spent days on this and got nowhere.

    Could somebody please advise me of ANY way to achieve these 2 ends?

  • The topic ‘Any way for Buddypress Topics to have header or extra description or WP shortcode fields that always’ is closed to new replies.
Skip to toolbar