예제 #1
0
function vibe_parallax_block($atts, $content = null)
{
    $attributes = v_get_attributes($atts, "v_parallax_block");
    $rand = 'parallax' . rand(1, 999);
    $scroll = isset($atts['scroll']) ? $atts['scroll'] : 2;
    $rev = isset($atts['rev']) ? $atts['rev'] : '0';
    $height = isset($atts['height']) ? $atts['height'] : '0';
    $adjust = isset($atts['adjust']) ? $atts['adjust'] : '0';
    $padding_top = isset($atts['padding_top']) ? $atts['padding_top'] : '0';
    $padding_bottom = isset($atts['padding_bottom']) ? $atts['padding_bottom'] : '0';
    $output = '<style>#' . $rand . ' {
            background: url(' . (isset($atts['bg_image']) ? $atts['bg_image'] : '') . ') 50% -' . $adjust . 'px;
            position:relative;background-size: cover;
            min-height:' . (is_numeric($height) ? $height . 'px' : $height) . ';
            } #' . $rand . ' .parallax_content{
              ' . ($padding_top ? 'padding-top:' . $padding_top . 'px;' : '') . '
            ' . ($padding_bottom ? 'padding-bottom:' . $padding_bottom . 'px;' : '') . '
            }' . (isset($atts['custom_css']) ? $atts['custom_css'] : '') . '
            </style>';
    $output .= "<div id='{$rand}' data-rev={$rev} data-scroll={$scroll} data-height={$atts['height']} data-adjust={$adjust} {$attributes['class']}{$attributes['inline_styles']} >\r\n                            <div class='parallax_content'>";
    if (isset($atts['title']) && $atts['title'] && $atts['title'] != 'Content') {
        $ntitle = $atts['title'];
        $ntitle = preg_replace('/[^a-zA-Z0-9\']/', '_', $ntitle);
        $ntitle = str_replace("'", '', $ntitle);
        $output .= '<div id="' . $ntitle . '"></div>';
    }
    $output .= do_shortcode(v_fix_shortcodes($content)) . "</div></div>";
    return $output;
}
예제 #2
0
파일: editor.php 프로젝트: prands/QM-Tests
function qm_parallax_block($atts, $content = null)
{
    $attributes = v_get_attributes($atts, "v_parallax_block");
    $rand = 'paralax' . rand(1, 999);
    $output = '<style>#' . $rand . ' {
            background: url(' . $atts['bg_image'] . ') 50% -50px;
            position:relative;
            height: ' . $atts['height'] . 'px;
            } ' . $atts['custom_css'] . '</style>';
    $scroll = $atts['scroll'] ? $atts['scroll'] : 2;
    $rev = $atts['rev'] ? $atts['rev'] : '0';
    $output .= "<div id='{$rand}' data-rev={$rev} data-scroll={$scroll} {$attributes['class']}{$attributes['inline_styles']} >\n                            <div class='parallax_content'>";
    if (isset($atts['title']) && $atts['title'] && $atts['title'] != 'Content') {
        $ntitle = $atts['title'];
        $ntitle = preg_replace('/[^a-zA-Z0-9\']/', '_', $ntitle);
        $ntitle = str_replace("'", '', $ntitle);
        $output .= '<div id="' . $ntitle . '"></div>';
    }
    $output .= do_shortcode(v_fix_shortcodes($content)) . "</div></div>";
    return $output;
}