Custom Page Hooks doesn’t seem to work
-
I understand it works with shortcodes so I thought perhaps it would work with custom pages. I've created custom pages at /topic/SomeTopic and I embedded a word that should link in the output text. But it doesn't get linked. Is there a way to tell the system to go ahead and link it? I don't think I can do this function with just shortcodes. here's my simply code: // Create a new rewrite rule that will capture /topic/{name} URLs add_action('init', 'add_topic_rewrite_rule'); function add_topic_rewrite_rule() { add_rewrite_rule('^topic/([^/]*)/?','index.php?pagename=topic&topic_name=$matches[1]','top'); } // Register the custom query var so WP recognizes it add_filter('query_vars', 'register_topic_query_var'); function register_topic_query_var($vars) { $vars[] = 'topic_name'; return $vars; } // Do the MongoDB query and output the results add_action('template_redirect', 'do_topic_search'); function do_topic_search() { echo "the text I want to have linked";
the word ‘linked’ should link to a post i designated to be the target for that word. the plugin definitely works, just not with this custom page.
Not only do i want links on these pages, I want these pages to be targets for my posts. IE: /target/JohnnyCakes should be linked from any of my blog posts that have ‘JohnnyCakes’ as text in them.
Hope you can help! It seems so promising.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom Page Hooks doesn’t seem to work’ is closed to new replies.