[resolved] 3.6b1 Adding theme compat handling for "the_post_format_" (2 posts)

  1. Christopher Anderton
    Posted 3 years ago #

    I'm working on a theme for a client, and is forced to support at least 3.5.1 (don't ask) when 3.6 is released. I was getting into some trouble with the backwards compatibility running the theme in 3.6b1 (23927).

    When using:

    <?php the_post_format_video(); ?>

    in my theme content-video.php file the output is as expected in the 3.6b1 install.

    However, in 3.5.1 it will just return nothing below the post title and breaks the theme output.

    As a designer and not a code wrangler (but i'm learning!), the only way i could think of to solve my problem was to replace:

    <?php the_post_format_video(); ?>


    <?php if ( function_exists('the_post_format_video') ) { echo get_the_post_format_media( 'video' ); } ?>


    It did work. However, i could not stop think if there are another way to do it. Any suggestions?

  2. The if check is right, since you're checking for a function that doesn't exist in pre 3.6. You can even lump it all together with an else if you wanted, so if the function doesn't exist, show something else.

Topic Closed

This topic has been closed to new replies.

About this Topic