2013-12-10 3 views
1

안녕하세요 저는 WordPress 사이트에서 일하고 있습니다. 현재 단축키의 arrtibute가 "popup ="register "로 설정된 경우 표시 할 팝업 세트가 있습니다. lightbox 속성이 "popup ="apply "로 설정된 경우 표시하려고 함)팝업 트리거를 사용하는 변수 확인

내 질문은 다음 함수에 다른 변수를 추가하는 방법입니다. if 문이 필요합니까? PHP PHP는 새로운 모든 조언을 크게 주셔서 감사합니다 .. 감사합니다 !!!!

function oxy_shortcode_button_fancy($atts , $content = '') { 
    // setup options 
    extract(shortcode_atts(array(
     'button_swatch'  => 'swatch-coral', 
     'button_animation' => '', 
     'size'    => 'default', 
     'xclass'   => '', 
     'link'    => '', 
     'label'    => 'My button', 
     'icon'    => '', 
     'link_open'   => '_self', 
     'popup'    => '' 
    ), $atts)); 

    $popup = ('register' == $popup) ? ' onclick="jQuery(\'#registerid, .overlayLogin\').show();"' : ''; 
    $animation = ($button_animation != "") ? ' data-animation="'.$button_animation.'"' :""; 
    return '<a'.$popup.' href="'. $link .'" class="btn '. $size.' btn-icon-right '. $xclass . ' '. $button_swatch .'" target="' . $link_open . '"> '. $label . '<span><i class="'.$icon.'" '.$animation.'></i></span></a>'; 



    } 

내가 뭘 추가 찾고 있어요 것은 :

$popup = ('apply' == $popup) ? ' onclick="jQuery(\'#applyid, .overlayLogin\').show();"' : ''; 
+0

하는 데 도움이 codes..Hope 당신은 방법은 U가 언급 한 right..Do입니다 사용해보십시오 –

+0

@VaibhavBhanushali 처음 $ popup = ('register'== $ popup) 바로 아래에 추가하면 작동하지 않습니다 .... – js111

+0

if else statments를 사용하여 확인 했습니까? –

답변

1

그것은 당신에게

function oxy_shortcode_button_fancy($atts , $content = '') { 
// setup options 
extract(shortcode_atts(array(
    'button_swatch'  => 'swatch-coral', 
    'button_animation' => '', 
    'size'    => 'default', 
    'xclass'   => '', 
    'link'    => '', 
    'label'    => 'My button', 
    'icon'    => '', 
    'link_open'   => '_self', 
    'popup'    => '' 
), $atts)); 


if('register' == $popup) { 
$popup = ('register' == $popup) ? ' onclick="jQuery(\'#registerid, .overlayLogin\').show();"' : ''; 
} else { 
$popup = ('apply' == $popup) ? ' onclick="jQuery(\'#applyid, .overlayLogin\').show();"' : ''; 
} 
$animation = ($button_animation != "") ? ' data-animation="'.$button_animation.'"' :""; 
return '<a'.$popup.' href="'. $link .'" class="btn '. $size.' btn-icon-right '. $xclass . ' '. $button_swatch .'" target="' . $link_open . '"> '. $label . '<span><i class="'.$icon.'" '.$animation.'></i></span></a>'; 



}