• Is there available code so I could divide a ~ 1200 X 500 pixel slider into four segments ~ 300X125 pixels and each segment would have it’s own image with a button link to a webpage.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter pembrokellc

    (@pembrokellc)

    Please look at my website https://www.pembrokeinstruments.com and see first slider. There are four products on the one slider and I would like a button for each product on this one slider.

    Theme Author presscustomizr

    (@nikeo)

    Hi @pembrokellc,
    You could use this kind of code in your functions.php, to hook into a specific slide’s rendering function :

    add_filter( 'tc_slide_background' , 'my_custom_slide' , 10, 4);
    function my_custom_slide( $original , $link , $attachement_id, $slider ) {
    	//apply only to a specific slide in a specific slider name
    	if ( 'slider-name' != $slider || 2547 != $attachement_id ) // <= set the name of your slider and the id of the slide's media
    		return $original;
    	ob_start();
    	?>
    
    		<div class="row-fluid" style="position: absolute;top: 0px;z-index: 1;text-align: center;">
    			<div class="span3 product1"><a class="btn btn-large btn-primary" href="#custom-link">product1</a></div>
    			<div class="span3 product2"><a class="btn btn-large btn-primary" href="#custom-link">product2</a></div>
    			<div class="span3 product3"><a class="btn btn-large btn-primary" href="#custom-link">product3</a></div>
    			<div class="span3 product4"><a class="btn btn-large btn-primary" href="#custom-link">product4</a></div>
    		</div>
    
    	<?php
    	$html = ob_get_contents();
        if ($html) ob_end_clean();
       	return $html.$original;
    }

    Hope this will help

    Thread Starter pembrokellc

    (@pembrokellc)

    Thanks. This I added this to my functions.php in child theme and I get a parse error. Please see functions.php file below

    Parse error: syntax error, unexpected $end in /home/penbr0/public_html/wp-content/themes/customizr-child/functions.php on line 48

    <?php
    // Adds a widget area.
    if (function_exists(‘register_sidebar’)) {
    register_sidebar(array(
    ‘name’ => ‘Extra Header Widget Area’,
    ‘id’ => ‘extra-widget-area’,
    ‘description’ => ‘Extra widget area after the header’,
    ‘before_widget’ => ‘<div class=”widget my-extra-widget”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => ‘</h2>’
    ));
    }

    // Place the widget area after the header
    add_action (‘__after_header’, ‘add_my_widget_area’, 0);
    function add_my_widget_area() {
    if (function_exists(‘dynamic_sidebar’)) {
    dynamic_sidebar(‘Extra Header Widget Area’);
    }
    }

    add_filter( ‘tc_slide_background’ , ‘my_custom_slide’ , 10, 4);
    function my_custom_slide( $original , $link , $attachement_id, $slider ) {
    //apply only to a specific slide in a specific slider name
    if ( ‘ pembroke-slider-sept-2014-c’ != $slider || 2547 != $attachement_id ) // <= set the name of your slider and the id of the slide’s media
    return $original;
    ob_start();
    ?>
    <div class=”row-fluid” style=”position: absolute;top: 0px;z-index: 1;text-align: center;”>
    <div class=”span3 product1″>product1</div>
    <div class=”span3 product2″>product2</div>
    <div class=”span3 product3″>product3</div>
    <div class=”span3 product4″>product4</div>
    </div>

    <?php
    $html = ob_get_contents();
    if ($html) ob_end_clean();
    return $html.$original;

    Theme Author presscustomizr

    (@nikeo)

    Hi @pembrokellc, for future references, please wrap your code with single quotes (code button of the editor).
    Your code seem to miss a curly brace to close the last callback function.
    If you are not familiar with those kind of advanced customizations, you might want to try simpler snippets first. (check the customizr snippets here)
    Cheers

    Thread Starter pembrokellc

    (@pembrokellc)

    Hi Nikeo-

    I added the } at the end of the snippet and it parses.
    But the slider images are all exploded in size.
    Also, so I have to add the explicit page links in the snippet?
    Does the name of the slider have to include .jpg?

    Thanks
    pembrokellc

    Thread Starter pembrokellc

    (@pembrokellc)

    Looking for help on how to fix this snippet.

    I am trying to reduce number of sliders by having 4 buttons on first slider.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Slider with multiple buttons’ is closed to new replies.