Home › Forums › Pro Support › Option to disable permalinks
Tagged: options permalinks
- This topic has 10 replies, 5 voices, and was last updated 2 years, 4 months ago by
elvin.
-
AuthorPosts
-
June 12, 2017 at 9:58 am #2136
Addison
ParticipantHey, Tom. This is merely a suggestion, or at least something that I would find useful. Sometimes I like to use custom post types for simple lists — like a staff directory. In these cases I’ll set ‘publicly_queryable’ to false and disable archives so that the content is only available where I specify with WP Show Posts. It would be great to have a “Disable Permalink” option for times like this when I want to show a simple list without links… Or at least disable permalinks when ‘publicly_queryable’ is set to false. Just my two cents… Thanks!
June 14, 2017 at 12:02 am #2140Tom
KeymasterThere’s actually a filter to disable the title link in the dev version: https://github.com/tomusborne/wp-show-posts/commit/f78b93421b82e5e235e04a38cdecb896966f5611
If you’d like to try the new beta versions, shoot me an email and I’ll send them over: https://wpshowposts.com/contact/
June 16, 2017 at 11:41 am #2146Addison
ParticipantJust wanted to report back and say that the
wpsp_disable_image_link
filter in the dev version worked great. Here’s what I did in my functions.php to target my shortcode:add_filter( 'the_content', 'gpc_alter_wpshowposts' ); function gpc_alter_wpshowposts( $content ) { if ( strpos( $content, '[wp_show_posts id="1746"]') !== false ) { add_filter( 'wpsp_disable_image_link', 'gpc_disable_wpshowposts_link' ); } return $content; } function gpc_disable_wpshowposts_link() { return true; }
I’d love to see additional filters to shut off all links, or perhaps a disable-all-links filter down the road… Thanks!
December 2, 2017 at 9:24 am #3069Addison
ParticipantTo anyone else needing this option, I worked up a script to add to your functions.php (or wherever you prefer to add your php) that you can use to fully disable permalinks until Tom creates a built-in option:
https://gist.github.com/addisonhall/a9d6756de4835018e6ac80a2531e754a
Thanks!
December 5, 2017 at 12:35 am #3083Tom
KeymasterWow, cool function! Thanks for sharing 🙂
January 3, 2018 at 12:06 pm #3203Tom
KeymasterThinking about this more, wouldn’t it be easier to uncheck the “Include title” option in the list, then add the title manually without the link?
add_action( 'wpsp_before_header', 'tu_add_linkless_title' ); function tu_add_linkless_title() { if ( is_page( 'my-list-page' ) ) { the_title(); } }
Wouldn’t work with multiple lists on a page, but we should be able to fix that as well once 1.1 is released.
June 3, 2021 at 4:20 am #30880Sergio
ParticipantI have tried to uncheck the “Include title”, But when I uncheck this, all the items dissapear.
I will try with CSS display: none;
June 3, 2021 at 11:16 pm #30895elvin
ModeratorHi Sergio, unchecking that completely removes the rendered title element.
Tom’s PHP snippet re-adds the title as a string rather than a link.
July 15, 2021 at 6:09 am #32045Carlo
ParticipantHi,
I need to disable the links of the images for specific lists.
A “link disabled” list must work also when placed in pages together to other lists that have normal links.
I have already disabled titles, so no need to remove links for that.
Is this solution still the best one at the moment?
https://wpshowposts.com/support/topic/option-to-disable-permalinks/#post-3069
Or is there some new?Thank you. All the best. Carlo
July 15, 2021 at 6:32 am #32049Carlo
ParticipantUPDATE:
I found easier to use this
https://wpshowposts.com/support/topic/option-to-disable-permalinks/#post-2146anyway my question still stands 🙂
Is this this the best solution so far?
July 15, 2021 at 8:28 pm #32086elvin
ModeratorHi Carlo,
Every elements on the plugin have a filter assigned to them. You can filter their output if you wish to remove their links.
Say for example, the image link can be removed by doing
add_filter( 'wpsp_disable_image_link', function($output,$settings){ $output = false; return $output; });
For title, you can do it with
add_filter( 'wpsp_disable_title_link', function($output,$settings){ $output = false; return $output; });
For the date link – https://wpshowposts.com/support/topic/removing-links-from-all-taxonomy-items/
For the author and taxonomy – https://wpshowposts.com/support/topic/display-meta-without-link/#post-30529
-
AuthorPosts
- You must be logged in to reply to this topic.