WordPress.org

Forums

Customizr
Linking a page to Slider Picture without using Theme call to action button (24 posts)

  1. codyjk09
    Member
    Posted 2 years ago #

    Hi, thanks for the theme! It looks great.

    I was wondering if there is a way to link a slider image to a page without using the built-in slider button created from the slider settings. In other words, I would like to make the whole picture a link without having an overlay buttons or boxes.

    I am very new to coding and WordPress, so any help is greatly appreciated! Thanks!

  2. Joe12345Campbell
    Member
    Posted 2 years ago #

    This is exactly what I would like to do! Other than that Customizr is the most awesome theme I have ever used. I really hope there is a way to do this!

  3. ekekrantz
    Member
    Posted 2 years ago #

    I would also like to know how it's done :-)
    Great theme btw!

  4. Joe12345Campbell
    Member
    Posted 2 years ago #

    I really do love Customizr, but...

    I suggest WP Slider as a plug in. It seems to work about as well as the slider supplied with Customizr, but allows URLs to be embedded into the slides. :)

  5. jccantele49
    Member
    Posted 2 years ago #

    I would also like to do this.

  6. jccantele49
    Member
    Posted 2 years ago #

    I've developed a solution for this:

    Edit /wp-content/themes/customizr/inc/tc_voila_slider.php

    Go to line 141 and change this code from:

    <?php echo wp_get_attachment_image( $id, $img_size, array('class' => 'slide', 'alt' => $alt ) ); ?>

    to

    <a href="<?php echo get_permalink($button_link); ?>"><?php echo wp_get_attachment_image( $id, $img_size, array('class' => 'slide', 'alt' => $alt ) ); ?></a>

    Now edit /wp-content/themes/customizr/inc/css/YOURCSS.css

    And change:

    .btn {
      display: inline-block;

    to

    .btn {
      /*display: inline-block;*/

    BAM! You're done! :D :D :D

  7. codyjk09
    Member
    Posted 2 years ago #

    Thank you so much! It is truly appreciated. I had one quick followup question, would it be possible to only make the slider pictures with specific hyperlinks active. On my page, the pictures without a specified link redirect to the blog archive page. Since this isn't a heavily emphasized portion of the site, I'd rather those pictures not have active hyperlinks at all. Thanks again! I really appreciate your work.

    latechbcm.org

  8. cproctor
    Member
    Posted 2 years ago #

    Hi I want to do this as well, I am having trouble getting to the directories you provide. How do i navigate to these directories? Thank you so much.

    goodpetstuff.com/newsite

  9. cproctor
    Member
    Posted 2 years ago #

    Actually, I found it in a different directory within the Editor.
    Customizr: class-header-slider.php (parts/class-header-slider.php)

  10. cproctor
    Member
    Posted 2 years ago #

    Still cannot find the "YOURCSS.css" area to complete this solution.

  11. cproctor
    Member
    Posted 2 years ago #

    Sorry, it's probably me but I cannot fix it with the suggested solution. Simply want to make the sliders "clickable" links WITHOUT the buttons.

  12. cproctor
    Member
    Posted 2 years ago #

    it worked! I realized I didn't "update file". And instead of finding the YOURCSS.css directory and changing the file, I simply added the CSS code to the "custom css" area in the CustomizIt! option.

  13. Playtolose
    Member
    Posted 2 years ago #

    Hi guys,

    So I've been looking for this very solution but can't seem to implement it on the current version of Customizr. I've checked class-header-slider.php but can't seem to get the code to work for me in the right place.
    Any chance of a line reference for where I should be putting the code just to make sure I'm getting it right?

    Alternatively is there another method available?

  14. ElectricFeet
    Member
    Posted 2 years ago #

    In 3.0.8 this would now be in class-header-slider.php

    But the code has all changed since then. Needs a php expert to correct it.

  15. Playtolose
    Member
    Posted 2 years ago #

    Yes, I thought that might be the case.

    Any php experts out there on this forum so?

  16. olsonsp4c
    Member
    Posted 1 year ago #

    This works. Change it in parts/class-header-slider.php around line 204:

    //attachment image
    //                        $slide_to_display   =  wp_get_attachment_image( $id, $img_size, array( 'class' => 'slide' , 'alt' => $alt ) );
    // custom changes for clickable image
                            $button_perm        =  get_permalink($button_link);
                            $slide_img          =  wp_get_attachment_image( $id, $img_size, array('class' => 'slide', 'alt' => $alt ) );
                            $slide_to_display   =  '<a href="'.$button_perm.'">'.$slide_img.'</a>';

    maybe the author could consider adding this with and "if" statement that activates it if the option is selected in the settings page.

    hope this helps you guys.

  17. Playtolose
    Member
    Posted 1 year ago #

    @olsonsp4c
    Works a charm.
    Thanks!

  18. olsonsp4c
    Member
    Posted 1 year ago #

    You are welcome.

  19. cautioustrain
    Member
    Posted 1 year ago #

    Great workaround olsonsp4c, thanks. Exactly what I was after.

  20. olsonsp4c
    Member
    Posted 1 year ago #

    @cautioustrain - glad it helped.

  21. wernshen
    Member
    Posted 1 year ago #

    hi guys, i get a nasty php error when i use the code by olsonsp4c. the line

    //attachment image
    //                        $slide_to_display   =  wp_get_attachment_image( $id, $img_size, array( 'class' => 'slide' , 'alt' => $alt ) );

    is in line 227 on my file

  22. olsonsp4c
    Member
    Posted 1 year ago #

    that line is only to show that the original line is to be commented out of the code. So, if the original is still uncommented, then it would cause an error.

  23. Russian Beekeeper
    Member
    Posted 1 year ago #

    I added olsonsp4c code above to parts/class-header-slider.php without success. How does the link get attached to the media image when the front page is viewed in Customizr and doesn't provide a place to enter the url or short code?

  24. Russian Beekeeper
    Member
    Posted 1 year ago #

    Found that previous css written to remove the hover will disable the link.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic