We're merging with GenerateBlocks! Learn more here.

[Resolved] Selectively disable title link

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Selectively disable title link

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5023
    Jamal
    Participant

    Hi

    Anybody know how to selectively disable title link by targeting specific list id? Tried this

    //Disable wpsp title link
    add_filter( 'wpsp_disable_title_link', 'jam_no_title_link' );
    function jam_no_title_link()
    { 
      if ( 4911 == $settings[ 'list_id' ] ) {
        return 'true';
      }
      
    }
    #5031
    Tom
    Keymaster

    Try this:

    add_filter( 'wpsp_disable_image_link', 'tu_disable_links', 10, 2 );
    add_filter( 'wpsp_disable_title_link', 'tu_disable_links', 10, 2 );
    function tu_disable_links( $output, $settings ) {
        if ( 177 === $settings['list_id'] ) {
            return true;
        }
    
        return $output;
    }
    #5041
    Jamal
    Participant

    You are simply unbelievable ! Thanks so much

    #5047
    Tom
    Keymaster

    You’re welcome πŸ™‚

    #8106
    William
    Participant

    Instead of disabling, is there a way to use a custom field to link to? I would like to link to the post’s ACF custom field – file_upload instead; so that I can link directly to a PDF for press release listings.

    #8114
    Tom
    Keymaster

    Hi there,

    As of right now that’s not possible, but I like the idea. I’ll implement a filter in the next version πŸ™‚

    #12600
    William
    Participant

    Tom, any chance there’s an update to my request from 3/9/19. This need has come up again on another site build.

    Instead of disabling, is there a way to use a custom field to link to? I would like to link to the post’s ACF custom field – file_upload instead; so that I can link directly to a PDF for press release listings.

    Many thanks, Will

    #12644
    Tom
    Keymaster

    Hi there,

    Just committed this change: https://github.com/tomusborne/wp-show-posts/commit/5195d874dc9c71e61e2673f6f32d50ad7835700b

    You can add that to your current version, then you can do this:

    add_filter( 'wpsp_title_href', function( $href, $settings ) {
        if ( 123 === $settings['list_id'] ) {
            $field = get_post_meta( get_the_ID(), 'your_custom_field', true );
    
            if ( $field ) {
                $href = $field;
            }
        }
    
        return $href;
    }, 10, 2 );
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.