Support » Plugin: Genesis Simple Hooks » Conditionally unhook post content for certain post format

  • Love Simple Hooks,
    I have my own code in to show content/title etc for post format video. This works fine pasted into the genesis post_content hook with the condition

    <?php if ( has_post_format( ‘video’ )){
    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    echo get_post_meta(get_the_ID(), “youtubelink”, true);
    <td><header class=”entry-header”>
    <?php if ( is_single() ) : ?>
    <h3 class=”entry-title”><?php the_title(); ?></h3>
    <?php else : ?>
    <h3 class=”entry-title”>
    ” rel=”bookmark”><?php the_title(); ?>
    <?php endif; // is_single() ?>
    </header><!– .entry-header –>
    <div class=”entry-content”>
    <?php the_content(); ?>
    </div><!– .entry-content –></td></tr></table>
    <?php } ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry, a few sentences got skipped. I tried adding the code to remove the regular post content

    remove_action( ‘genesis_post_content’, ‘genesis_do_post_content’ );

    inside the conditional above, but it didn’t work.

    Plugin Author Ron Rennick


    MultiSite Guru

    Once WP starts processing a hook you cannot unhook anything for that hook. You were already in genesis_post_content when you tried to unhook genesis_do_post_content.

    You would be better to do that in your theme functions.php in a function hooked into genesis_meta.

    But can I do that based on the post_format of the specific post?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditionally unhook post content for certain post format’ is closed to new replies.