Jump to content


Photo
- - - - -

Two action buttons in hero unit

Hero unit

  • Please log in to reply
6 replies to this topic

#1 lazlo

lazlo

    Advanced Member

  • Members

  • 93 posts
  • Country: Country Flag

Posted 12 April 2013 - 04:43 PM

Hi,

 

 

I would like to have a hero unit with two action buttons (so I can have one button going to contact page, one button going to following page) can this be acheived by copying some of the code in hero/section.php, if so, which part?

 

many thanks



#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 12 April 2013 - 04:52 PM

I think the easiest way to include two action buttons would be to use the ContentBox section (

Please Login or Register to see this Hidden Content

) to replicate the look of the Hero unit and implement the two buttons using the button shortcode from this page:

Please Login or Register to see this Hidden Content



#3 lazlo

lazlo

    Advanced Member

  • Members

  • 93 posts
  • Country: Country Flag

Posted 12 April 2013 - 05:52 PM

hi, Thanks for your reply Catrina - before i go down the route you have outlined, I would like to see if i can tweak the hero unit itself - herefore i have tried to create the additional arrays, though i cant get teh extra options to show up with the page meta section - do i have to alter any other files  or just teh section.php file in teh her folder?

 

 

<?php
/*
Section: Hero
Author: PageLines
Author URI:

Please Login or Register to see this Hidden Content

Description: A responsive full width image and text area with button.
Class Name: PLheroUnit
Workswith: templates, main, header, morefoot, content
Cloning: true
*/
 
/*
 * Main section class
 *
 * @package PageLines Framework
 * @author PageLines
 */
class PLheroUnit extends PageLinesSection {
 
    var $tabID = 'herounit_meta';
 
 
function section_optionator( $settings ){
 
$settings = wp_parse_args($settings, $this->optionator_default);
 
 
$option_array = array(
 
'pagelines_herounit_text' => array(
'type' => 'multi_option',
'inputlabel' => 'Enter text for your Hero section',
'title' => $this->name.' Text',
'selectvalues' => array(
'pagelines_herounit_title' => array(
'type'  => 'text',
'inputlabel'=>'Heading',
),
'pagelines_herounit_tagline' => array(
'type'   => 'textarea',
'inputlabel'=>'Subtext'
)
),
'shortexp' => 'The text for the Hero section Header and Subtext content.',
'exp' => 'The title is used for the heading, and the subtext is placed directly beneath it.'
 
),
'pagelines_herounit_image' => array(
'type' => 'image_upload',
'imagepreview' => '270',
'inputlabel' => 'Upload custom image',
'title' => $this->name.' Image',
'shortexp' => 'Input Full URL to your custom Hero image.',
'exp' => 'Places a custom image to the right of the call to action and text.'
),
'pagelines_herounit_cta' => array(
'type' => 'multi_option',
'title' => __('Hero Action Button', 'pagelines'),
'shortexp' => __('Enter the options for the Hero button', 'pagelines'),
'selectvalues' => array(
'herounit_button_link' => array(
'type' => 'text',
'inputlabel' => 'Button link destination (URL - Required)',
),
'herounit_button_text' => array(
'type' => 'text',
'inputlabel' => 'Hero Button Text',
),
'herounit_button_target' => array(
'type' => 'check',
'default' => false,
'inputlabel' => 'Open link in new window.',
),
'herounit_button_theme' => array(
'type' => 'select',
'default' => false,
'inputlabel' => 'Select Button Color',
'selectvalues' => array(
'primary' => array('name' => 'Blue'),
'warning' => array('name' => 'Orange'),
'important' => array('name' => 'Red'),
'success' => array('name' => 'Green'),
'info' => array('name' => 'Light Blue'),
'reverse' => array('name' => 'Grey'),
),
),
),
),
'pagelines_herounit_ctatwo' => array(
'type' => 'multi_option',
'title' => __('Hero Action Button Two', 'pagelines'),
'shortexp' => __('Enter the options for the Hero button two ', 'pagelines'),
'selectvalues' => array(
'herounit_button_linktwo' => array(
'type' => 'text',
'inputlabel' => 'Button link destination (URL - Required)',
),
'herounit_button_texttwo' => array(
'type' => 'text',
'inputlabel' => 'Hero Button Text',
),
'herounit_button_targettwo' => array(
'type' => 'check',
'default' => false,
'inputlabel' => 'Open link in new window.',
),
'herounit_button_themetwo' => array(
'type' => 'select',
'default' => false,
'inputlabel' => 'Select Button Color',
'selectvalues' => array(
'primary' => array('name' => 'Blue'),
'warning' => array('name' => 'Orange'),
'important' => array('name' => 'Red'),
'success' => array('name' => 'Green'),
'info' => array('name' => 'Light Blue'),
'reverse' => array('name' => 'Grey'),
),
),
),
),
'pagelines_herounit_widths' => array(
'type' => 'multi_option',
'title' => __('Content Widths', 'pagelines'),
'shortexp' => __('Select the width of the image and text areas', 'pagelines'),
'selectvalues' => array(
'herounit_left_width' => array(
'type' => 'select',
'default' => 'span6',
'inputlabel' => 'Text Area Width',
'selectvalues' => array(
'span3' => array('name' => '25%'),
'span4' => array('name' => '33%'),
'span6' => array('name' => '50%'),
'span8' => array('name' => '66%'),
'span9' => array('name' => '75%'),
'span7' => array('name' => '90%'),
),
),
'herounit_right_width' => array(
'type' => 'select',
'default' => 'span6',
'inputlabel' => 'Image Area Width',
'selectvalues' => array(
'span3' => array('name' => '25%'),
'span4' => array('name' => '33%'),
'span6' => array('name' => '50%'),
'span8' => array('name' => '66%'),
'span9' => array('name' => '75%'),
'span7' => array('name' => '90%'),
),
),
),
),
);
 
$metatab_settings = array(
'id' => $this->tabID,
'name' => 'Hero Unit',
'icon' => $this->icon,
'clone_id' => $settings['clone_id'],
'active' => $settings['active']
);
 
register_metatab($metatab_settings, $option_array);
 
 
}
 
/**
* Section template.
*/
   function section_template( $clone_id ) {
 
$hero_lt_width = ploption( 'herounit_left_width', $this->oset );
if ( ! $hero_lt_width )$hero_lt_width = 'span6';
$hero_rt_width = ploption( 'herounit_right_width', $this->oset );
if ( ! $hero_rt_width )$hero_rt_width = 'span6';
    $hero_title = ploption( 'pagelines_herounit_title', $this->tset );
$hero_tag = ploption( 'pagelines_herounit_tagline', $this->tset );
$hero_img = ploption( 'pagelines_herounit_image', $this->tset );
$hero_butt_link = ploption( 'herounit_button_link', $this->oset );
$hero_butt_text = ploption( 'herounit_button_text', $this->oset );
$hero_butt_target = ( ploption( 'herounit_button_target', $this->oset ) ) ? ' target="_blank"': '';
$hero_butt_theme = ploption( 'herounit_button_theme', $this->oset );
$hero_butt_linktwo = ploption( 'herounit_button_linktwo', $this->oset );
$hero_butt_texttwo = ploption( 'herounit_button_texttwo', $this->oset );
$hero_butt_targettwo = ( ploption( 'herounit_button_targettwo', $this->oset ) ) ? ' target="_blank"': '';
$hero_butt_themetwo = ploption( 'herounit_button_themetwo', $this->oset );
 
    if($hero_title) { ?>
 
  <div class="pl-hero-wrap row">
 
  <?php
  if($hero_lt_width)
printf('<div class="pl-hero %s">',$hero_lt_width);
?>
<?php
 
if($hero_title)
printf('<h1 class="m-bottom">%s</h1>',$hero_title);
 
if($hero_tag)
  printf('<p>%s</p>',$hero_tag);
 
     if($hero_butt_link)
printf('<a %s class="btn btn-%s btn-large" href="%s">%s</a> ', $hero_butt_target, $hero_butt_theme, $hero_butt_link, $hero_butt_text);
 
 if($hero_butt_linktwo)
printf('<a %s class="btn btn-%s btn-large" href="%s">%s</a> ', $hero_butt_targettwo, $hero_butt_themetwo, $hero_butt_linktwo, $hero_butt_texttwo);
  ?>
                
</div>
 
  <?php
  if($hero_rt_width)
printf('<div class="pl-hero-image %s">',$hero_rt_width);
?>
<?php
 
if($hero_img)
printf('<div class="hero_image"><img class="pl-imageframe" src="%s" /></div>', apply_filters( 'pl_hero_image', $hero_img ) );
 
?>
</div>
 
</div>
 
<?php
 
} else
echo setup_section_notify($this, __('Set Hero page options to activate.', 'pagelines') );
}
 
}


#4 lazlo

lazlo

    Advanced Member

  • Members

  • 93 posts
  • Country: Country Flag

Posted 12 April 2013 - 07:41 PM

Have just tested and this actually works :o)

#5 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 12 April 2013 - 09:04 PM

Hi there, we can't support editing the core code unfortunately, any changes made to the section will be wiped on update. You could however copy the section code and include it as a new section with a child theme.



#6 lazlo

lazlo

    Advanced Member

  • Members

  • 93 posts
  • Country: Country Flag

Posted 12 April 2013 - 11:08 PM

Hi James, thanks for advice - have now copied, renamed, installed and activated through customised template folder. Could this section now be uploaded to the store section of PageLines?

#7 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 12 April 2013 - 11:18 PM

Hi there, if you've installed and activated on the site already you won't need to install it via the store on your install.

 

Or do you mean to sell through the Pagelines store to other users?

 

You'd need to join the developer community to be able to sell products through the store, if you're interested in signing up and becoming part of the developer team you can sign up here -

Please Login or Register to see this Hidden Content

and they'll be able to go through the criteria for products and sales with you.







Also tagged with one or more of these keywords: Hero unit