WordPress.org

Ready to get started?Download WordPress

Forums

podPress
Display player in short version of posts (6 posts)

  1. jumust
    Member
    Posted 3 years ago #

    Hi,
    is it possible display the player not only in the full post page but in the short version of the posts, like in a category page?
    http://screencast.com/t/5ygYm8cN
    I tried to edit the php category page and inserted a code like <php do_shortcode('[display_podcast]');> but it didn't work.

    How can I do?

    Thanks

  2. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    podPress inserts the player (or the player preview) in the_content(); and in the_excerpt(); by default with the WP filter hook of the same names.
    You can alter the position of the player by inserting the shortcode into the post content and the excerpt of a post. But the using the shortcode [display_podcast] outside these to section will have no effect. Because podPress looks only the content and the excerpt for this place-holder.
    A different possibility to adjust the position of the player is the option at the General Settings page of podPress.
    What is your 'Location:' setting? Start? End? (Try End.)

    Without knowing the source code of the theme of your blog, I can only guess why the shortcode does not get replaced.

    • maybe this post or excerpt is displayed with the help of a custom function or db query (and not with the_content(); or the_excerpt();)
    • maybe the filter action gets removed by a different plugin or theme (Is there a call of remove_filter(); in the files of the theme or an other plugin?)
    • or maybe it is something else which is specific to your theme.

    Regards,
    Tim

  3. jumust
    Member
    Posted 3 years ago #

    Hi ntm and thank you very much for your explanation!
    I think you are totally right about the reasons why it happens even though I'm not so good at php.

    Maybe it's because there is a strange function to get the excerpt I'm not sure, you can see the line 174 in the file of my theme here

    Do you think it's something I can solve with this theme?
    In the full post page it's displayed well (I set up the location settings to show at the end)

    Thanks

  4. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    You are right. Line 174 is the critical line. echo strip_tags($post->post_excerpt); takes the excerpt from the $post object directly. That is basically okay. But it bypasses the the_excerpt filter hook and all plugins which are designed to influence the excerpt of a post are unable to fulfill their goal.

    You might try to replace echo strip_tags($post->post_excerpt); with the_excerpt();. Using the_excerpt(); solely would always print an excerpt. If you have not written an excerpt for a post then WP will generate automatically one from the content of the post.
    But you could add a little filter to the functions.php file of your theme: http://pastebin.com/5XgYscVL which filters automatic excerpts but prints manually written excerpts.

    Regards,
    Tim

  5. jumust
    Member
    Posted 3 years ago #

    Thanks it works though if I don't write the excerpt it doesn't get it automatically, but if I write it I'll get the audio player without I need to use the [display_podcast]

    For me it's enough!

    Thank you so much

  6. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    it works though if I don't write the excerpt it doesn't get it automatically

    If you are using the filter then that is how it should be.

    You should have always a player whether you right an excerpt or not and regardless of the usage of [display_podcast].
    The filter prevents WP from generating an excerpt (WP generates always automatically an excerpt if you haven't written one and the template uses the_excerpt.)
    If you like to have an automatically generated excerpt in the same view as in the screenshot then don't use the filter.

    I'm glad that it works.

    Regards,
    Tim

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags