WordPress.org

Ready to get started?Download WordPress

Forums

oik-nivo-slider
Using 'oik custom image link URL' only on *certain* slides (4 posts)

  1. expomas
    Member
    Posted 1 year ago #

    I'm wondering if there's a way to use the 'oik custom image link URL' field, but only on certain slides in the Nivo slider. So, for example, one slide of three would link to an external URL, and the other two wouldn't link anywhere.

    http://wordpress.org/extend/plugins/oik-nivo-slider/

  2. expomas
    Member
    Posted 1 year ago #

    No answer on this but, if anyone wants to do this, here's how I did it hacking the plugin:

    I used the Nivo silder shortcode with link=y

    [nivo link=y]

    Then, to only create a link in the slideshow for slides with an associated URL, I hacked nivo.inc in plugins/oik-nivo-slider/ as follows:

    at line 337 I replaced these lines:

    $permalink = bw_get_image_link( $post->ID );
          alink( null, $permalink , $thumbnail, null );

    with:

    $permalink = bw_get_image_link( $post->ID );
          if (strlen($permalink) > 0 ) {
    
          	alink( null, $permalink , $thumbnail, null );  
    
          } else {
    
          	e( $thumbnail );
          }

    To prevent the cursor appearing for slides with no URL, I commented out almost all of plugins/oik-nivo-slider/jquery.oik-nc-click.js:

    jQuery.fn.oikNCClick = function(){
        var slider = $(this);
        var nc = $('.nivo-caption', slider);
        //nc.hover( function() { $(this).addClass( 'nivo-caption-hovered' ); }
          //      , function() { $(this).removeClass( 'nivo-caption-hovered' ); } );
        //nc.css( 'cursor', 'pointer' );
        //nc.live('click', function(){
          //var visible = $('a.nivo-imageLink:visible', slider);
          //window.location.href = visible.attr('href');
        //});
      };

    Then, to allow external links to open in a new window, I hacked bobbfunc.inc in plugins/oik as follows:

    at line 181, I replaced this line

    $link .= ">";

    with

    // if URL contains domain.com, don't open in new window: must replace with your own site's domain
      if (stripos($url, "domain.com")) {
    
      	$link .= " >";
    
      } else { // it IS external...
    
      	$link .= " target='_blank'>";
      }
  3. bobbingwide
    Member
    Plugin Author

    Posted 12 months ago #

    Hi, sorry I didn't see this sooner. I'm glad you found a solution to your problem.

    There are probably some other solutions that don't necessitate hacking the code but I don't have time to investigate them right now.
    When I do, I'll see whether or not I can incorporate your solutions into the base code.

  4. bobbingwide
    Member
    Plugin Author

    Posted 10 months ago #

    Hi again, regarding making links inactive. One option would be to set the oik custom image link URL to #

    But when the user clicks on it the page may scroll back to the top.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.