wp-show-posts icon indicating copy to clipboard operation
wp-show-posts copied to clipboard

Disable link for title

Open tomusborne opened this issue 8 years ago • 5 comments

Make it so you can disable the title link with a filter.

tomusborne avatar Apr 20 '17 04:04 tomusborne

can you add a filter to disable all links? Image, title and abstract? Maybe assign attributes to the filter filter_removelinks(image, title, abstract)

alexseboe avatar Apr 20 '17 15:04 alexseboe

This gets a little weird as the link is within the_title() function.

Instead, we can just turn the title off, and then add in a link-less title:

add_action( 'wpsp_before_header', 'tu_add_linkless_title' );
function tu_add_linkless_title( $settings ) {
    if ( 10 == $settings['list_id'] ) {
        the_title();
    }
}

tomusborne avatar Jan 03 '18 19:01 tomusborne

If you want to disable ALL links within a wp-show-posts list, I've come up with this: https://gist.github.com/addisonhall/a9d6756de4835018e6ac80a2531e754a

It's far from perfect, but it gets the job done until we have a checkbox. ;-)

UPDATE: I've fixed the link. Sorry about that.

addisonhall avatar Jan 03 '18 21:01 addisonhall

As of 1.1, you'll be able to do this:

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

    return $output;
}

177 being the ID of the list we're targeting.

You can grab beta.1 here: https://tomusborne.com/dev/temp/wp-show-posts.zip

Hoping to get it released tomorrow, so any quick testing is appreciated! :)

tomusborne avatar Jan 05 '18 04:01 tomusborne

FYI, the new disable link filters work for me!

addisonhall avatar Jan 09 '18 18:01 addisonhall