How to have images skip going to Post, go directly to enlarged image (dark bkgd)

Viewing 14 posts - 1 through 14 (of 14 total)
  • #5506
    lynnedrake
    Participant

    Thanks again for the great theme. Is there a way to click on an image in the slider and have it go directly to the enlarged imaged (with the darkened diagonal stripes) and skip going to the post completely? Many many thanks!

    #5540
    Daniel Tara
    Keymaster

    Open slider.php and replace this code:

    <a href="<?php the_permalink() ? rel="nofollow">" rel="bookmark" title="<?php the_title_attribute(); ?>">
    	<?php the_post_thumbnail( 'slider-thumb' ); ?>
    </a>

    with this:

    <a href="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); echo $image[0] ? rel="nofollow">" rel="bookmark" title="<?php the_title_attribute(); ?>">
    	<?php the_post_thumbnail( 'slider-thumb' ); ?>
    </a>
    #5607
    lynnedrake
    Participant

    Thanks so much Daniel, — but I don’t have a slider.php in the — do you mean loop-slider.php? My code is different (but similar!) to what you show above — Thank you for your help!

    <div id="post-” style=”background:url() center no-repeat”>

    <a class="overlay" href="” rel=”bookmark”>

    <a href="” title=”” rel=”bookmark”>

    • This reply was modified 12 years, 5 months ago by lynnedrake.
    • This reply was modified 12 years, 5 months ago by lynnedrake.
    #5610
    lynnedrake
    Participant

    Sorry, I’m having trouble copying the code in — is there a special way I should copy it in? It isn’t displaying correctly from what I copied. Thank you!

    #5617
    Daniel Tara
    Keymaster

    I’m sorry, the line you need to replace is this:

    <a class="overlay" href="<?php the_permalink(); ?>" rel="bookmark"></a>

    with this:

    <a class="overlay" href="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); echo $image[0]; ?>" rel="bookmark"></a>
    #5619
    lynnedrake
    Participant

    Ok — switched browsers — here is the way my code is in loop-slider.php: (a little different but very similar) Thanks Daniel!

    <div id="post-” style=”background:url() center no-repeat”>

    <a class="overlay" href="” rel=”bookmark”>

    <a href="” title=”” rel=”bookmark”>

    #5620
    lynnedrake
    Participant

    Ok — I just saw your new note — stay tuned!

    #5625
    lynnedrake
    Participant

    Yes! It works! Thank you so much! Do you have a place for (modest, I’m afraid) donations from thankful users of your theme?

    #5628
    lynnedrake
    Participant

    Is there a way to go to the enlarged image with the black diagonal lines and the small “x” box in the corner like the demo?

    #5629
    lynnedrake
    Participant

    Sorry – one more problem. I had the last image of my last post going to a contact form page, and now it doesn’t. Can I make that one image still go to a post?

    #5637
    Daniel Tara
    Keymaster

    To make the image open in a lightbox replace in the code above rel="bookmark" with rel="colorbox".

    To exempt the contact form from this, find the post or page’s ID and add an exception to it like this:

    <a class="overlay" href="<?php
    	if( xxx != get_the_ID() ) {
    		$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
    		echo $image[0];
    	} else {
    		the_permalink();
    	}
    ?>" rel="colorbox"></a>
    #5639
    lynnedrake
    Participant

    In the loop-slider.php there are no references to post ID’s – it looks like there are global changes there. How can I find the individual post ID from there? And what would I replace with this new exception? I can get to the content-audio.php for that post (it’s the only one saved that way) – but that seems wrong since it worked before I made the changes to the loop-slider.php? Thanks so very much for your help Daniel!!!

    #5641
    Daniel Tara
    Keymaster

    You find the post ID in the admin when editing the post, the URL looks like this:

    /post.php?post=xxx&action=edit

    #5665
    lynnedrake
    Participant

    Thanks Daniel, I replaced “bookmark” with “colorbox” in the loop-slider but no change – I saw another “bookmark” a little further down, tried that, no change. (tried them both, and then swapped them, no change) I also tried changing “bookmark” to “colorbox” in two places in the loop.php, but I haven’t been able to get to the lightbox yet.

    Sorry for my basic question about the post ID – I have that now! But before I insert the code in, I want to be sure I’m putting it in the right spot. In the loop-slider.php, where do I insert that code in? Right after the code we added above? (Sorry, I’m new to this) Thank you Daniel!!

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.