'', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'two_columns_one', 'pirate_rogue_shortcode_two_columns_one' ); function pirate_rogue_shortcode_two_columns_one_last( $atts, $content = null ) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'two_columns_one_last', 'pirate_rogue_shortcode_two_columns_one_last' ); // Three Columns function pirate_rogue_shortcode_three_columns_one($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'three_columns_one', 'pirate_rogue_shortcode_three_columns_one' ); function pirate_rogue_shortcode_three_columns_one_last($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'three_columns_one_last', 'pirate_rogue_shortcode_three_columns_one_last' ); function pirate_rogue_shortcode_three_columns_two($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ). '
'; } add_shortcode( 'three_columns_two', 'pirate_rogue_shortcode_three_columns_two' ); function pirate_rogue_shortcode_three_columns_two_last($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'three_columns_two_last', 'pirate_rogue_shortcode_three_columns_two_last' ); // Four Columns function pirate_rogue_shortcode_four_columns_one($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'four_columns_one', 'pirate_rogue_shortcode_four_columns_one' ); function pirate_rogue_shortcode_four_columns_one_last($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'four_columns_one_last', 'pirate_rogue_shortcode_four_columns_one_last' ); function pirate_rogue_shortcode_four_columns_two($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'four_columns_two', 'pirate_rogue_shortcode_four_columns_two' ); function pirate_rogue_shortcode_four_columns_two_last($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'four_columns_two_last', 'pirate_rogue_shortcode_four_columns_two_last' ); function pirate_rogue_shortcode_four_columns_three($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'four_columns_three', 'pirate_rogue_shortcode_four_columns_three' ); function pirate_rogue_shortcode_four_columns_three_last($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass=' '.$color; $addclass .= $setlighten; } } return '
' . do_shortcode( ($content) ). '
'; } add_shortcode( 'four_columns_three_last', 'pirate_rogue_shortcode_four_columns_three_last' ); // Divide Text Shortcode function pirate_rogue_shortcode_divider($atts, $content = null) { return '
'; } add_shortcode( 'divider', 'pirate_rogue_shortcode_divider' ); /*-----------------------------------------------------------------------------------*/ /* Info Boxes Shortcodes /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_fullwidth($atts, $content = null) { extract(shortcode_atts(array( 'color' => '', 'lighten' => '', 'scrollleft' => '', 'background' => '', 'fixed' => '', 'maxheight' => '', ), $atts)); $addclass = ''; if (isset($color)) { $setlighten = ''; if ($lighten) { $setlighten = ' lighten'; } $color = pirate_rogue_columns_checkcolor($color); if (!empty($color)) { $addclass= $color; $addclass .= $setlighten; } } if (!empty($scrollleft)) { $addclass .= ' scrollleft'; } $setstyle = ''; $setinnerstyle = ''; if (!empty($maxheight)) { $maxheight = intval($maxheight); if ($maxheight > 0) { $setstyle = 'height: '.$maxheight.'px; overflow:hidden;'; } } if (!empty($background)) { $background = esc_url($background); if (!empty($background)) { $setstyle .= 'background-image: url('.$background.'); background-repeat: no-repeat; '; } if (!empty($fixed) ) { $setstyle .= 'background-attachment: fixed;'; } $setstyle .= 'background-size: cover;'; $addclass .= ' withbackground'; } if (!empty($setstyle)) { $setstyle = ' style="'.$setstyle.'"'; } if (!empty($setinnerstyle)) { $setinnerstyle = ' style="'.$setinnerstyle.'"'; } if (!empty($addclass)) { $addclass = ' class="'.$addclass.'"'; } if (is_page()) { // Close sourounding markup, then insert secxtion, then open markup for page again $close_markup = ' '; $close_markup .= ' '; $close_markup .= ' '; $close_markup .= ' '; $open_markup = '
'; $open_markup .= '
'; $open_markup .= '
'; $open_markup .= '
'; $innerstyle = '
'; $res = $close_markup.'
' .$innerstyle. do_shortcode( ($content) ). '
'.$open_markup; return $res; } } add_shortcode( 'section_fullwidth', 'pirate_rogue_shortcode_fullwidth' ); /*-----------------------------------------------------------------------------------*/ /* Info Boxes Shortcodes /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_white_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'white_box', 'pirate_rogue_shortcode_white_box' ); function pirate_rogue_shortcode_yellow_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'yellow_box', 'pirate_rogue_shortcode_yellow_box' ); function pirate_rogue_shortcode_red_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'red_box', 'pirate_rogue_shortcode_red_box' ); function pirate_rogue_shortcode_blue_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'blue_box', 'pirate_rogue_shortcode_blue_box' ); function pirate_rogue_shortcode_green_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'green_box', 'pirate_rogue_shortcode_green_box' ); function pirate_rogue_shortcode_lightgrey_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'lightgrey_box', 'pirate_rogue_shortcode_lightgrey_box' ); function pirate_rogue_shortcode_grey_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'grey_box', 'pirate_rogue_shortcode_grey_box' ); function pirate_rogue_shortcode_dark_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'dark_box', 'pirate_rogue_shortcode_dark_box' ); function pirate_rogue_shortcode_maincolor_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'maincolor_box', 'pirate_rogue_shortcode_maincolor_box' ); function pirate_rogue_shortcode_secondcolor_box($atts, $content = null) { extract(shortcode_atts(array( 'background' => '', ), $atts)); $setinvertclass = ''; if ($background) { $setinvertclass = ' invertbox'; } return '
' . do_shortcode( ($content) ) . '
'; } add_shortcode( 'secondcolor_box', 'pirate_rogue_shortcode_secondcolor_box' ); /*-----------------------------------------------------------------------------------*/ /* Buttons Shortcodes /*-----------------------------------------------------------------------------------*/ function pirate_rogue_button( $atts, $content = null ) { extract(shortcode_atts(array( 'link' => '#', 'target' => '', 'color' => '', 'size' => '', 'class' => '' ), $atts)); $class = $class ? ' ' . esc_attr( $class ) : ''; $color = ($color) ? ' '.$color. '-btn' : ''; $size = ($size) ? ' '.$size. '-btn' : ''; $target = ($target == 'blank') ? ' target="_blank"' : ''; $out = '' .do_shortcode($content). ''; return $out; } add_shortcode('button', 'pirate_rogue_button'); /*-----------------------------------------------------------------------------------*/ /* Accordion: Surrounding Markup /*-----------------------------------------------------------------------------------*/ function pirate_rogue_accordion( $atts, $content = null ) { if( isset($GLOBALS['accordion_count']) ) $GLOBALS['accordion_count']++; else $GLOBALS['accordion_count'] = 0; $defaults = array(); extract( shortcode_atts( $defaults, $atts ) ); $output = ''; $output .= '
'; $output .= do_shortcode( $content ); $output .= '
'; return $output; } add_shortcode('accordion', 'pirate_rogue_accordion' ); // add_shortcode('accordionsub', array( $this, 'pirate_rogue_accordion' )); // Define more as one shortcode name to allow nestet accordions /*-----------------------------------------------------------------------------------*/ /* Accordion: Single Accordion Tab /*-----------------------------------------------------------------------------------*/ function pirate_rogue_accordion_tab( $atts, $content = null ) { if( !isset($GLOBALS['current_accordiontab']) ) $GLOBALS['current_accordiontab'] = 0; else $GLOBALS['current_accordiontab']++; $defaults = array( 'title' => 'Tab', 'color' => '', 'id' => '', 'load' => ''); extract( shortcode_atts( $defaults, $atts ) ); $addclass = ''; $title = esc_attr($title); $color = $color ? ' ' . esc_attr( $color ) : ''; $load = $load ? ' ' . esc_attr( $load ) : ''; if (!empty($load)) { $addclass .= " ".$load; } $id = intval($id) ? intval($id) : 0; if ($id<1) { $id = $GLOBALS['current_accordiontab']; } $output = '
'; $output .= ''."\n"; $output .= '
'; $output .= '
'."\n"; $output .= do_shortcode($content); $output .= '
'; $output .= '
'; return $output; } add_shortcode('collapse', 'pirate_rogue_accordion_tab'); add_shortcode('accordion-item', 'pirate_rogue_accordion_tab'); add_shortcode('accordion-tab','pirate_rogue_accordion_tab' ); // Define more as one shortcode name to allow nestet accordions /*-----------------------------------------------------------------------------------*/ /* Shortcodes to display feature sections top /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_section_featured_3to1( $atts, $content = null ) { extract(shortcode_atts(array( 'cat' => '', 'tag' => '', 'title' => '', 'id' => '', 'num' => '', ), $atts)); $cat = ($cat) ? $cat : ''; $tag = ($tag) ? $tag : ''; $title = esc_attr($title); $id = ($id) ? $id : ''; $num = ($num) ? intval($num) : 5; $out = pirate_rogue_section_featured_3to1($tag, $cat, $title, $num, $id, 'shortcode-section'); if (empty($out)) { echo '

'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'

'; } return $out; } add_shortcode('section_featured_3to1', 'pirate_rogue_shortcode_section_featured_3to1'); add_shortcode('section_featured_top', 'pirate_rogue_shortcode_section_featured_3to1'); /*-----------------------------------------------------------------------------------*/ /* Shortcodes to display feature sections bottom /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_section_featured_1to3( $atts, $content = null ) { extract(shortcode_atts(array( 'cat' => '', 'tag' => '', 'title' => '', 'id' => '', 'num' => '', ), $atts)); $cat = ($cat) ? $cat : ''; $tag = ($tag) ? $tag : ''; $title = esc_attr($title); $id = ($id) ? $id : ''; $num = ($num) ? intval($num) : 9; $out = pirate_rogue_section_featured_1to3($tag, $cat, $title, $num, $id, 'shortcode-section'); if (empty($out)) { echo '

'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'

'; } return $out; } add_shortcode('section_featured_1to3', 'pirate_rogue_shortcode_section_featured_1to3'); add_shortcode('section_featured_bottom', 'pirate_rogue_shortcode_section_featured_1to3'); /*-----------------------------------------------------------------------------------*/ /* Shortcodes to display two column section /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_section_twocolumn( $atts, $content = null ) { extract(shortcode_atts(array( 'cat' => '', 'tag' => '', 'title' => '', 'num' => '', ), $atts)); $cat = ($cat) ? $cat : ''; $tag = ($tag) ? $tag : ''; $title = esc_attr($title); $num = ($num) ? intval($num) : 4; $out = pirate_rogue_section_twocolumn($tag, $cat, $title, $num, 'shortcode-section'); if (empty($out)) { echo '

'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'

'; } return $out; } add_shortcode('section_twocolumn', 'pirate_rogue_shortcode_section_twocolumn'); /*-----------------------------------------------------------------------------------*/ /* Shortcodes to display two column section /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_blogroll( $atts, $content = null ) { extract(shortcode_atts(array( 'cat' => '', 'tag' => '', 'num' => '', ), $atts)); $cat = ($cat) ? $cat : ''; $tag = ($tag) ? $tag : ''; $num = ($num) ? intval($num) : 4; $out = pirate_rogue_blogroll($tag, $cat, $num); if (empty($out)) { echo '

'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'

'; } return $out; } add_shortcode('blogroll', 'pirate_rogue_shortcode_blogroll'); /*-----------------------------------------------------------------------------------*/ /* Shortcodes to display articlelist /*-----------------------------------------------------------------------------------*/ function pirate_rogue_shortcode_articlelist( $atts, $content = null ) { extract(shortcode_atts(array( 'cat' => '', 'tag' => '', 'num' => '', 'class' => '', 'title' => '', ), $atts)); $title = esc_attr($title); $cat = ($cat) ? $cat : ''; $tag = ($tag) ? $tag : ''; $num = ($num) ? intval($num) : 5; $class = ($class) ? $class : ''; $out = pirate_rogue_articlelist($tag, $cat, $num,$class, $title); if (empty($out)) { echo '

'.__("No result for category \"$cat\", Tag \"$tag\"",'uku').'

'; } return $out; } add_shortcode('articlelist', 'pirate_rogue_shortcode_articlelist'); /*-----------------------------------------------------------------------------------*/ /* Check if color attribut is valid /*-----------------------------------------------------------------------------------*/ function pirate_rogue_columns_checkcolor($color = '') { if ( ! in_array( $color, array( 'black', 'red', 'yellow', 'green', 'blue', 'white', 'lightgrey', 'grey', 'dark', 'maincolor', 'secondcolor' ) ) ) { return ''; } return $color; } /*-----------------------------------------------------------------------------------*/ /* The end of this file inc/shortcodes.php as you know it /*-----------------------------------------------------------------------------------*/