Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Resolved] Option to disable permalinks

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Option to disable permalinks

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2136
    Addison
    Participant

    Hey, 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!

    #2140
    Tom
    Keymaster

    There’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/

    #2146
    Addison
    Participant

    Just 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!

    #3069
    Addison
    Participant

    To 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!

    #3083
    Tom
    Keymaster

    Wow, cool function! Thanks for sharing 🙂

    #3203
    Tom
    Keymaster

    Thinking 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.

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