egiblock Posted August 20, 2010 Share Posted August 20, 2010 I've created the initial page, and got it to show up in the main plugin list, and can activate and deactivate it. Then I have a page with the code {GOLFSCORE} as the content of the page, and that's the only thing that shows when you click on that specific page (as it should). The code is supposed to replace the {GOLFSCORE} with my programming (in this code, it's the old 'Hello World'). But my code isn't doing anything and i can't see what's wrong with it. add_action('init','scoring_insert'); // Function to deal with loading the Golf Scoring Code into pages function scoring_insert($content) { if (preg_match('{GOLFSCORE}',$content)) { $golf_output = GolfScoringSystem(); $content = str_replace('{GOLFSCORE}',$golf_output,$content); } return $content; } function GolfScoringSystem() { $golf_body .= 'Hello World'; return $golf_body; } Link to comment https://forums.phpfreaks.com/topic/211324-wordpress-replacing-text-from-a-post/ Share on other sites More sharing options...
egiblock Posted August 25, 2010 Author Share Posted August 25, 2010 first line of code should read add_action('the_content','scoring_insert'); it's working now. Link to comment https://forums.phpfreaks.com/topic/211324-wordpress-replacing-text-from-a-post/#findComment-1103426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.