We're merging with GenerateBlocks! Learn more here.

[Resolved] Remove link of post title

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Remove link of post title

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #25102
    Silvano
    Participant

    Hi,
    I use WpShoPost to show posts on an accordion inside another post. I need the post title to have no link. Do you have a filter that allows you to do this?

    you can see a template of the page here:
    https://gotour.com.br/canada/?location=ca-bc

    in accordion bellow (Nanaimo, Vancouver, Victoria)

    #25122
    elvin
    Moderator

    Hi,

    You can use the wpsp_disable_title_link for this.

    Here’s the PHP snippet:

    add_filter( 'wpsp_disable_title_link', 'tu_disable_links', 10, 2 );
    
    function tu_disable_links( $output, $settings ) {
        if ( 4447 === $settings['list_id'] ) {
            return true;
        }
    
        return $output;
    }

    Replace 4447 with the list ID of your WPSP list that you want title links disabled.

    #25129
    Silvano
    Participant

    Hi Elvin, thank you for you feedback

    This worked but the problem is that each item of the accordion is a list, so with this snippet I would have to filter several ID’s … is that possible?
    Or… Would it be possible, maybe turn off the post link title in the class “wp-show-posts-entry-title”?
    Initially I had done this directly in the plugin, but I know it is not the correct one.
    In my case, the title in the post title is not necessary.

    #25137
    elvin
    Moderator

    I’m not exactly sure I get what you’re trying to do.

    But here’s a few things:

    If you want to disable the title link on multiple WPSP lists, you can add in more IDs to the snippet’s condition.

    Example:

    add_filter( 'wpsp_disable_title_link', 'tu_disable_links', 10, 2 );
    
    function tu_disable_links( $output, $settings ) {
        if (4590 || 4447 === $settings['list_id'] ) {
            return true;
        }
    
        return $output;
    }

    4590 and 4447 are list IDs. || is PHP operator “or”. So basically, the condition means, if list_id is 4590 or 4447, do “return true”. You can add in more IDs separated with ||.

    Alternatively, if you want ALL of the WPSP list on your site to have their title links disabled, you can simply do this:

    add_filter( 'wpsp_disable_title_link', '__return_true');

    #25139
    Silvano
    Participant

    I swear, I had tested it with OR operator and returned an error! oh my sweet typing. : /

    These two options work for me. 🙂 Case closed!
    Thanks Elvin

    #25141
    Silvano
    Participant

    forgot to mark as resolved. sorry.

    #25143
    elvin
    Moderator

    I swear, I had tested it with OR operator and returned an error! oh my sweet typing. : /

    lol. yeah that happens to all of us.

    No problem. Glad you got it sorted. 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.