We're merging with GenerateBlocks! Learn more here.

[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 11 posts - 1 through 11 (of 11 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.

    #30880
    Sergio
    Participant

    I have tried to uncheck the “Include title”, But when I uncheck this, all the items dissapear.

    https://nimb.ws/NrZLTE

    I will try with CSS display: none;

    #30895
    elvin
    Moderator

    Hi Sergio, unchecking that completely removes the rendered title element.

    Tom’s PHP snippet re-adds the title as a string rather than a link.

    #32045
    Carlo
    Participant

    Hi,

    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

    #32049
    Carlo
    Participant

    UPDATE:
    I found easier to use this
    https://wpshowposts.com/support/topic/option-to-disable-permalinks/#post-2146

    anyway my question still stands 🙂

    Is this this the best solution so far?

    #32086
    elvin
    Moderator

    Hi 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

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