WordPress.org

Ready to get started?Download WordPress

Forums

Display Posts Shortcode
[resolved] Display video from original post? (4 posts)

  1. integritydesigns
    Member
    Posted 1 year ago #

    I have a blog category that is only for youtube videos and I'd like to display the most recent video in a div built into the site's footer.php file.

    I have the youtube video displaying fine in the post itself, but the shortcode does not display the video in the footer. It only displays the posts title.

    Also, the site is being maintained upon completion by a school and they needed a simple solution to displaying a youtube video in the site's footer. I'd love for them to be able to simply add a new youtube video post to the videos category and it display wherever I have the shortcode. Is this possible?

    Thanks ahead of time!

    (If it helps, here is the test sites url: powhatan.idtestsite.com/about. It's in development so please excuse the mess. The home page is not done yet, but you can view the row in the footer of any other page.)

    http://wordpress.org/extend/plugins/display-posts-shortcode/

  2. Bill Erickson
    Member
    Plugin Author

    Posted 1 year ago #

    You'll need to write a custom output filter to adjust what is displayed on output. The plugin lets you display the title and optional excerpt.

    If the video code is dropped in the post content, you just need to turn on full post content.

    If it's in a custom field or you're using oEmbed to convert a URL to video, you'll need to write some code to display it.

  3. integritydesigns
    Member
    Posted 1 year ago #

    Where would I add this code? If I add it will it make every post display the full content or just the one I want? Sorry not a PHP guru yet :) Thanks!

    Here is the code I have thus far within my footer.php file:
    <?php echo do_shortcode('[display-posts category="videos" posts_per_page="1" wrapper="div"]'); ?>

  4. Bill Erickson
    Member
    Plugin Author

    Posted 1 year ago #

    You would place the full post output filter in functions.php.

    If you only want to use it on some uses of the shortcode, change the output filter to this: https://gist.github.com/91cf54bf66e2435e916d

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic