[Resolved] Link Target Controller for Posts

Home Forums Support [Resolved] Link Target Controller for Posts

Home Forums Support Link Target Controller for Posts

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #277124
    Dave

    Hey Tom,

    I’m using a plugin called VK Link Target Controller that allows post links to open in another page instead of to the target post. I use this for displaying a news feed where some news items open in the post and others open in a PDF. You can see an example on the home page of dev.northwestfiretraining.com

    My problem is that there is a box to check in the plugin that allows the individual post to other in a new page or just open in the same window. I have the box checked for the ones opening with PDFs to open in a new box, however they still open in the current window.

    I checked the developers page and they show the following for a reason why this might happen:

    My link won’t open on a new window.
    VK Link Target Controller adds a filter on the the_permalink() WordPress function, which means the redirection won’t work if your theme uses another function, for example get_permalink() to display the links. In order to have the link opened in a new window VK Link Target Controller needs a theme with the post id as id on the <a> parent element.

    Your theme probably has it if it follows the WordPress Theme recommendations.

    Example:

    <div class="post-item post-block front-page-list">">
        <a>">
            <?php the_title(); ?>
        </a>
    </div>

    Is this the case with GeneratePress? And if so, are you aware of a way to make the target work properly?

    Thank you so much!

    – Dave

    #277176
    Tom
    Lead Developer
    Lead Developer

    GP uses get_permalink() as it’s inside the the_title() function and can’t directly call the_permalink().

    This is actually the “proper” way to do it, as seen in themes like TwentySeventeen.

    They might consider using one of the filters in the get_permalink() function instead of the_permalink() as it will make their plugin work with more themes.

    #277228
    Dave

    Ok perfect, I’ll see if I can get in touch with the plugin developer. Unfortunately, I have not found any developer as responsive to inquiries as you have been. Thanks again for the help!

    #277250
    Tom
    Lead Developer
    Lead Developer

    No problem! Sorry I couldn’t be more helpful.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.