WordPress.org

Ready to get started?Download WordPress

Forums

Genesis Simple Hooks
Conditionally unhook post content for certain post format (4 posts)

  1. kastriebel
    Member
    Posted 6 months ago #

    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(); ?>>
    <table><tr><td><?php
    echo get_post_meta(get_the_ID(), "youtubelink", true);
    ?></td>
    <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(); ?>
    </h3>
    <?php endif; // is_single() ?>
    </header><!-- .entry-header -->
    <div class="entry-content">
    <?php the_content(); ?>
    </div><!-- .entry-content --></td></tr></table>
    <?php } ?>

    http://wordpress.org/plugins/genesis-simple-hooks/

  2. kastriebel
    Member
    Posted 6 months ago #

    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.

  3. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 6 months ago #

    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.

  4. kastriebel
    Member
    Posted 6 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.