WordPress.org

Support

Support » Alpha/Beta » [Resolved] 3.6b1 Adding theme compat handling for "the_post_format_"

[Resolved] 3.6b1 Adding theme compat handling for "the_post_format_"

  • 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(); ?>

    with

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

    Pastebin

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

Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] 3.6b1 Adding theme compat handling for "the_post_format_"’ is closed to new replies.
Skip to toolbar