WordPress.org

Ready to get started?Download WordPress

Forums

Integrating Template Tags in Plugins (3 posts)

  1. cpoteet
    Member
    Posted 7 years ago #

    I want to use several template tags in my new plugin, but I'm having problems. I thought this would be a way to do it.


    echo "comments_popup_link('No Comments', 'Comments (1)', 'Comments (%)');";

    But that just prints the text and doesn't run the function. How would I do this? Do I need to set a variable and concatenate it?

  2. golddave
    Member
    Posted 7 years ago #

    You need to surround the template tags in <?php ?> tags. Like so:
    echo "<?php comments_popup_link('No Comments', 'Comments (1)', 'Comments (%)'); ?>";

  3. cpoteet
    Member
    Posted 7 years ago #

    I appreciate the response, but that's not working. I'm getting the following error:

    Parse error: parse error, unexpected $end

    I'm trying to use the template tag in a plugin inside a function. (If that makes a difference.)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags