Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Brilliant solution to bbPress SEO! Page number to title!

@_ck_

Participant

Hey good work.

Let me make a strong suggestion in your code technique.

All those variable names being tossed around as globals is somewhat dangerous – someone is going to accidentally “step” on one someday.

Instead how about an array or object instead?

ie.

$topic_add_quotes=blah;
$topic_add_sticky=blah;
$topic_add_sticky_label=blah;
etc.

and

global $topic_add_quotes;
global $topic_add_sticky;
global $topic_add_sticky_label;
etc.

instead becomes

$kjg_seo->topic_add_quotes=blah;
$kjg_seo->topic_add_sticky=blah;
$kjg_seo->topic_add_sticky_label=blah;
etc.

and then no matter how many items you just pass one pointer in your functions

global $kjg_seo;

The added benefit is you can later loop through all the elements if you make an admin menu.

Also, when switching based on page type, constantly calling all the different functions, ie is_forum, is_front, is_topic etc is “expensive” because of how bb_get_location works

Instead just $location=bb_get_location();

and then look at what it sends you in the string which is ultra fast for each of the comparisons.

Skip to toolbar