0

I have been trying to find the answer to this. I want to use the best method performance wise, but also want to make this solution portable as possible.

I have created a plugin that adds multiple post types and custom meta fields for each of these post types. Reviews is an example of this. I have a large database that isn't a part of wordpress that contains lots of video game information. When writing a review I have a box to add the name of the game being reviewed.

I have written a function displayGameInfo($gameID) as part of my plugin. In single.php i have the following code.This will output some information for the game just after the end of the main text body of a post.

 $postid =  get_the_ID();                   
 $gameid = get_post_meta($postid,'nb_gameids_key', true);               

 if(function_exists("displayGameInfo")) echo displayGameInfo($gameid);

People seem to be discouraging this method though and I agree with them in a way as this requires me to place a lot of custom programming within the theme. I would like if this was more portable across themes.

How should I approach this?

1 Answer 1

1

Use the_content filter to add data to a post's content without having to touch the template.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.