Register custom view with extra_fields
-
Hi everyone,
I’m using the bbp_register_view_popular for the homepage of my offline website.Works pretty well to sort_by my meta_value.
What I’m trying to do is to return a custom field as the main title.
I’m already doing this on custom pages and it works like a charm, here is my code :$output .= '<li><a href="' . get_permalink() . '">' . get_post_meta(get_the_ID(), 'bbp_extra_field1', true) . '</a></li>';
How can I return the same thing in my custom_view for my homepage without actually changing permanently the_title from WordPress?
the_title
is absolutly needed andbbp_extra_field1
works a subtitle.Many thanks to anyone who could put me on the right way 🙂
-
To anyone who would come accross the same project, I added an action to the
bbp_theme_before_topic_title
hook.For now, it does not displays as I would like but some CSS will do the trick.
add_action('bbp_theme_before_topic_title', 'show_true_title'); function show_true_title() { $topic_id = bbp_get_topic_id(); $true_title = '<li><a href="' . get_permalink() . '">' . get_post_meta( $topic_id, 'bbp_extra_field1', true); '</a>'; echo $true_title ;
thanks for posting your solution.
you could do
add_action('bbp_theme_before_topic_title', 'show_true_title'); function show_true_title() { $topic_id = bbp_get_topic_id(); $true_title = '<li class="specstanza-title"><a href="' . get_permalink() . '">' . get_post_meta( $topic_id, 'bbp_extra_field1', true); '</a></li>'; echo $true_title ;
and then in css do
li.specstanza-title { color: blue; }
or
.specstanza-title { color: blue; }
or
.specstanza-title li { color: blue; }
one of those should let you style the title
Thank you @robin-w !
My first idea was todisplay:none
the_title but I’m definitely going to keep it.I found the solution by installing a plugin called Hookr. It gave me some informations I needed after hours reading Bbpress’ files.
The ouput is a bit strange though…
As if the voice-count moved somewhere. The author is also displayed twice – I don’t remember it was like that before. Changing the shortcode used doesn’t improve this.
I’m going to figure out what happened here and keep this thread updated if it’s usefull for someone. 🙂
do keep this updated – so many threads have the problem but authors don’t post their final solution – you are a star!!
- You must be logged in to reply to this topic.