• Home
  • Blog
  • Showcase
  • Setup Docs
    • Sunshine Help
    • Flex Help
  • Support
    • Support Area
    • Contact us
    • Feedback
  • Connect
    • Newsletter
    • Twitter
    • Facebook
  • My Account
  • Flex
  • Sunshine
Support : Simple Pro Themes

Support : Simple Pro Themes

[Resolved] How to Create Two Buttons in Flex Slider Like Home Page Banner

If you have purchased a product, please enter the email address that you used to register at time of purchase.
Log In
Lost Password

Create an Account
  • Your username must be unique, and cannot be changed later.
  • We use your email address to email you a secure password and verify your account.

Support › Forums › Flex Theme › How to Create Two Buttons in Flex Slider Like Home Page Banner

Tagged: Flex slider, Home Page Banner, Read More Button

  • This topic has 1 reply, 2 voices, and was last updated 4 years, 1 month ago by Chinmoy Paul.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 11, 2018 at 12:17 am #1703
    gigtime
    Participant

    Hi,

    The Flex Pro demo has the Flex Slider in the Home Top section and the Home Page Banner in the Home Middle section. The Home Page Banner Widget offers the option of doing two buttons. Is there a way to create two buttons when using the Flex Slider?

    Thanks,

    Bill

    May 11, 2018 at 8:59 am #1704
    Chinmoy Paul
    Moderator

    Open the slider-cpt.php file from flex/lib/cpt folder. Enter the following PHP code above the line no 100

    $btn2txt = (get_post_meta(get_the_ID(), '_btn2_txt', true)) ? get_post_meta(get_the_ID(), '_btn2_txt', true) : ""; 
        $btn2url = (get_post_meta(get_the_ID(), '_btn2_url', true)) ? get_post_meta(get_the_ID(), '_btn2_url', true) : "";
    
        echo '<div style="width: 90%;">';
        
          printf( '<p><label>%s<input type="text" name="sld[_btn2_txt]" id="_btn2_txt" class="large-text" value="%s" /></label></p>', __( 'Button 2 Text: ', 'flex' ), esc_attr( $btn2txt ) );
        
        echo '</div><br style="clear: both;" />';
    
        echo '<div style="width: 90%;">';
        
          printf( '<p><label>%s<input type="text" name="sld[_btn2_url]" id="_btn2_url" class="large-text" value="%s" /></label></p>', __( 'Button 2 URL: ', 'flex' ), esc_attr( $btn2url ) );
        
        echo '</div><br style="clear: both;" />';

    You will get two new custom fields in Slider CPT at your backend. You will enter the button text & URL.

    Now open the flex-slider-widget.php file from flex/lib/widgets folder. Add the following code below the line no 128

    $btn2Txt = get_post_meta(get_the_ID(), '_btn2_txt' ,true);
                  $btn2url = get_post_meta(get_the_ID(), '_btn2_url' ,true);
                  if( ! empty( $btn2Txt ) && ! empty( $btn2url ) )         
                     echo '<p><a href="'.$btn2url.'" class="read-more btn-alt">'.$btn2Txt.'</a></p>' . "\n";

    Note: code is not tested. You keep a backup first.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

Copyright © 2022 · Simple PRO Themes for Genesis Framework · About · FAQs · Contact · Affiliates