given the speed of most servers, I doubt that you would notice any time delay in processing the code in is a few lines of many thousand that get processed on each page load and one DB call.
best solution would be to time with and without and see if you can spot anything – but run it many times to get an average
Hi Robin. Yes, you have a good point. My functions.php file is filling up with these and it’s making no difference on load times. TBH I’m not sure how I would edit the above function to pull the correct forum ID as this one seems to deal with topic ID instead. Does it treat topic ID and forum ID as the same? As in, can I just change the ID number within this part:
if (( $topic_id == 123)
you need to pick up the forum id
so
$forum_id = bbp_get_forum_id();
if (( $forum_id == 123) or ( $forum_id == 456)){
etc…
and then you would add the
Custom action hook to add in the template file where the div shall be displayed:
<?php do_action( 'different_div' ); ?>
in the appropriate forum template
Hi Robin,
Using your prompt I hacked something that removes the action altogether and just uses the if statement. On the loop-single-forum.php file I started with this:
<?php $forum_id = bbp_get_forum_id();
if (( $forum_id == 40250) ){
?>
<li class="bbp-forum-info-40250">
<?php
}
else {?>
<li class="bbp-forum-info">
<?php
}?>
where I set the CSS selector ‘bbp-forum-info-40250’ width to 100%. At the end of the template I then added this:
<?php $forum_id = bbp_get_forum_id();
if (( $forum_id == 40250) ){
?>
<?php
}
else {?>
<li class="bbp-forum-topic-count"><?php bbp_forum_topic_count(); ?></li>
rest of the normal template follows
</li>
<?php
}?>
where nothing appears for forum id 40250 and the rest of the template displays as normal for all other forums. So now my first forum description is 100% width without topic counts/views/freshness, whilst the rest of the forums display as normal.
If interested you can see the result here.
great – lots of ways to do it 🙂