• Resolved Ryan Scott

    (@ryandev99)


    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)
  • Thread Starter Ryan Scott

    (@ryandev99)

    To make it so that my blog post links direct to these topic pages, I guess I can use custom links, which then becomes a manual process, right?

    And it still wouldn’t allow me to use your plugin to link from these pages.

    Plugin Support markilj

    (@markilj)

    Thank you for contacting us.

    Currently, our plugin only reads content from the default wordpress “the_content” field or in our premium version you can define any custom fields to it, but as I see in your code the content is from a “template_redirect” hook right? Unfortunately, our plugin is not able to read that content.

    Is your custom page also registered as a post post type of wordpress is it also saved in the database? If not it will also not be included in the index build as currently our plugin only links posts/pages that are in found in the database as we loop thru the post ids.

    Yes you are correct you can manually create custom links to link directly to your custom pages, add keywords and it should be able to find matches of those keywords other posts(which are made from the default WP editor) and it should link to that custom page.

    Regarding linking from these custom pages, you are correct there is no possibility from our plugin to link from these pages, as you can’t add keywords to these custom pages if they are not saved in the database.

    I hope this helps, let us know if you need anything else.

    Thank you

    Thread Starter Ryan Scott

    (@ryandev99)

    I guess if I wanted to use it I could simply make posts or pages for these types of content.

    Thanks for explaining how it works a bit but I have one more question. Does it actually embed those links directly in the post text? And if we turn off the plugin for some reason, those links will remain because they aren’t tracked to be removed and they aren’t added/removed dynamically on page load?

    Just so I’m totally clear how it works when the boss asks. ??

    Thread Starter Ryan Scott

    (@ryandev99)

    I think I would probably make a custom content type in order to keep track of these Topic pages and it sounds like the premium version would let me add links to those pages via your plugin, right?

    Plugin Support markilj

    (@markilj)

    Our plugin does not edit or update your original text or content, we only generate our links upon page load via filter, so when you deactivate our plugin, the links will not appear on your page’s front-end, as they are dynamically added only to preserve your original post content.

    I think I would probably make a custom content type in order to keep track of these Topic pages and it sounds like the premium version would let me add links to those pages via your plugin, right?

    Yes, you can add a custom post type for those to keep easily keep track of the topic pages, but I think you won’t need our premium version if it’s for that purpose only. Our free plugin should be able to generate links to those custom contents as they are now saved in the database, you would just need to add them to the whitelist of post types you want to link.

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Page Hooks doesn’t seem to work’ is closed to new replies.