WordPress.org

Ready to get started?Download WordPress

Forums

Blubrry PowerPress Podcasting plugin
[resolved] Add code to template instead of using shortcode in post (8 posts)

  1. tessina
    Member
    Posted 3 years ago #

    Is there a way to add some php code to call the podcast in the single.php theme template, instead of using the [powerpress] shortcode when making the post?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    try

    <?php do_shortcode('[powerpress]'); ?>

    http://codex.wordpress.org/Function_Reference/do_shortcode

  3. tessina
    Member
    Posted 3 years ago #

    Doesn't work unfortunately :(

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    sometimes, a plugin uses a filter instead of 'real' shortcode; then, unfortunately, this code will not work.

    you may need to 'hack' into the plugin code and try to find the function, that the plugin calls for [powerpress].

    do you have the download link for the plugin?

  5. tessina
    Member
    Posted 3 years ago #

    Hi again :)
    This is the plugin I am looking at: http://wordpress.org/extend/plugins/powerpress/

    I'm hoping to be able to insert the equivalent php code of the [powerpress] shortcode into my theme's single.php file, so my authors don't need to keep adding the shortcode into the post editor while they write their content (they tend to forget this too often).

    Any help would be MOST helpful! :)

  6. tessina
    Member
    Posted 3 years ago #

    Hey whatya know, I found the code I needed on the developer's website:
    http://help.blubrry.com/blubrry-powerpress/customizing-with-your-wordpress-theme/

    The code to use in template files is
    <?php the_powerpress_content(); ?>

    Yay it works now! :)

  7. Angelo Mandato
    Member
    Plugin Author

    Posted 3 years ago #

    PowerPress does correctly process the shortcode "powerpress". The example <?php do_shortcode('[powerpress]'); ?> does work, as long as you are inside "the loop". If you're outside of the loop, or you've already made a call to the_content/the_excerpt(), then PowerPress will not re-add the player. You can force PowerPress to add a player using the same option for fixing poorly developed themes, go to PowerPress settings > Appearance tab and select the "Fix issues with theme" option.

    To explain further, PowerPress only adds a player once to a post/page. PowerPress will not re-add a player for repeated calls to the_content (remember the_excerpt will call the_content and then strip out objects/flash). The way around that is to select the "fix issues with theme" option, which then aggressively adds the player to all calls to the_content filter.

    The other solution to this problem is to directly use the the_powerpress_content() as you are now.

    One other suggestion, wrap the call to the_powerpress_content() with a if function_exists check, this will prevent errors form displaying on your site if for some reason PowerPress were to be disabled, like during a plugin upgrade.

    <?php if( function_exists('the_powerpress_content') ) the_powerpress_content(); ?>

  8. tessina
    Member
    Posted 3 years ago #

    Now that's a thorough explanation. Thanks amandato, I appreciate it. I've added the function_exists check as adviced :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags