[Resolved] GP Hooks – Before Content

Home Forums Support [Resolved] GP Hooks – Before Content

Home Forums Support GP Hooks – Before Content

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #497392
    Matt

    I’m currently using a hook for a category (18) for job posts.. that adds “Position Available” above the content…

    <?php if ( is_category( ’18’ ))
    {
    echo ‘Position Available’;
    }
    ?>

    it works fine on the category feed.. but “Position Available” doesn’t show up when posts are also displayed on the home page feed.. only in the category feed. Is there a way to have it displayed on both feeds.. but ONLY those category posts.. and not the other posts that appear on the home page feed?

    thx
    Matt

    #497766
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try:

    <?php if ( is_category( '18' ) || is_front_page() && is_home() && in_category( '18' ) ) {
        echo 'Position Available';
    }
    ?>
    #497773
    Matt

    thanks for the quick reply!
    unfortunately.. that didn’t work.

    #497864
    Tom
    Lead Developer
    Lead Developer

    I wonder if has_category() would work better?

    if ( has_category( '18' ) ) {
    
    }
    #498082
    Matt

    that did it.. thanks so much!

    it also displays on the actual post as well now.. whereas before it only displayed in the category feed (summary). it now displays everywhere for posts from that category.

    thanks for taking the time.. you guys are awesome!

    Matt

    #498328
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.