Home › Forums › Pro Support › Remove link of post title
- This topic has 6 replies, 2 voices, and was last updated 2 years, 8 months ago by
elvin.
-
AuthorPosts
-
January 7, 2021 at 8:38 am #25102
Silvano
ParticipantHi,
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-bcin accordion bellow (Nanaimo, Vancouver, Victoria)
January 7, 2021 at 4:49 pm #25122elvin
ModeratorHi,
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.January 7, 2021 at 5:51 pm #25129Silvano
ParticipantHi 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.January 7, 2021 at 6:09 pm #25137elvin
ModeratorI’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');
January 7, 2021 at 7:18 pm #25139Silvano
ParticipantI 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 ElvinJanuary 7, 2021 at 7:19 pm #25141Silvano
Participantforgot to mark as resolved. sorry.
January 7, 2021 at 8:05 pm #25143elvin
ModeratorI 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. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.