Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress视觉合成器内置短代码赢得';不承认自定义CSS_Wordpress_Visual Composer - Fatal编程技术网

Wordpress视觉合成器内置短代码赢得';不承认自定义CSS

Wordpress视觉合成器内置短代码赢得';不承认自定义CSS,wordpress,visual-composer,Wordpress,Visual Composer,我正在使用一个内容块插件,它允许我频繁地使用内容作为短代码。短代码内容块的内容编辑器使用Visual Composer。当我为页面上的块使用已创建的短代码时,除了VisualComposer短代码中定义的任何自定义css之外,其他大部分都可以正常工作 例如: [vc_column_inner width="1/3" css=".vc_custom_1463660338922{background-image: url(/circlebg.png) !important;}”] 自定义css类是

我正在使用一个内容块插件,它允许我频繁地使用内容作为短代码。短代码内容块的内容编辑器使用Visual Composer。当我为页面上的块使用已创建的短代码时,除了VisualComposer短代码中定义的任何自定义css之外,其他大部分都可以正常工作

例如:

[vc_column_inner width="1/3" css=".vc_custom_1463660338922{background-image: url(/circlebg.png) !important;}”]
自定义css类是在前面的源中创建的div中定义的,但该定义不显示在标题中。如果我在页面本身上执行相同的过程,而不使用内容的短代码,那么这确实有效。我相信这与functions.php有关。我已将此函数更改为以下内容(粗体),但仍然无法识别任何内容:

if(!function_exists('qode_visual_composer_custom_shortcodce_css')){
function qode_visual_composer_custom_shortcodce_css(){
if(qode_visual_composer_installed()){

if(is_page() || is_single() || is_singular('portfolio_page') || is_singular('content_block')){
$shortcodes_custom_css = get_post_meta( qode_get_page_id(), '_wpb_shortcodes_custom_css', true );
if ( ! empty( $shortcodes_custom_css ) ) {
echo '<style type="text/css" data-type="vc_shortcodes-custom-css-'.qode_get_page_id().'">';
echo $shortcodes_custom_css;
echo '</style>';
}
$post_custom_css = get_post_meta( qode_get_page_id(), '_wpb_post_custom_css', true );
if ( ! empty( $post_custom_css ) ) {
echo '<style type="text/css" data-type="vc_custom-css-'.qode_get_page_id().'">';
echo $post_custom_css;
echo '</style>';
}
}
}
}
add_action('qode_visual_composer_custom_shortcodce_css', 'qode_visual_composer_custom_shortcodce_css');
}
如果(!function\u存在('qode\u visual\u composer\u custom\u shortcodce\u css')){
函数qode_visual_composer_custom_shortcodce_css(){
如果(qode_visual_composer_installed()){
如果(is_page()| | is_single()| | is_singular('portfolio_page')| | is_singular('content_block')){
$shortcodes_custom_css=get_post_meta(qode_get_page_id(),'u wpb_shortcodes_custom_css',true);
如果(!空($shortcode\u custom\u css)){
回声';
echo$shortcodes\u custom\u css;
回声';
}
$post_custom_css=get_post_meta(qode_get_page_id(),'wpb_post_custom_css',true);
如果(!empty($post\u custom\u css)){
回声';
echo$post_custom_css;
回声';
}
}
}
}
添加动作('qode_visual_composer_custom_shortcodce_css'、'qode_visual_composer_custom_shortcodce_css');
}
以前有人见过这个吗

谢谢大家!


我使用
visual\u composer
类的
parseShortcodeCustomCss
方法解决了这个问题,visual composer本身使用该方法在页眉或页脚中包含样式

我的解决方案:

$shortcodeContent = '[vc_column_inner width="1/3" css=".vc_custom_1463660338922{background-image:url(/circlebg.png)!important;}”]';
$shortcodes_custom_css = visual_composer()->parseShortcodesCustomCss( $shortcodeContent );
if ( ! empty( $shortcodes_custom_css ) ) {
    $shortcodes_custom_css = strip_tags( $shortcodes_custom_css );
    $output .= '<style type="text/css" data-type="vc_shortcodes-custom-css">';
    $output .= $shortcodes_custom_css;
    $output .= '</style>';
    echo $output;
}
echo apply_filters( 'the_content', $shortcodeContent );
$shortcodeContent='[vc_column_inner width=“1/3”css=“.vc_custom_1463660338922{背景图像:url(/circlebg.png)!important;}”];
$shortcodes\u custom\u css=visual\u composer()->parseShortcodesCustomCss($shortcodeContent);
如果(!空($shortcode\u custom\u css)){
$shortcodes\u custom\u css=条带标签($shortcodes\u custom\u css);
$output.='';
$output.=$shortcode\u custom\u css;
$output.='';
echo$输出;
}
echo apply_过滤器('the_content',$shortcodeContent);

我使用
visual\u composer
类的
parseShortcodeCustomCss
方法解决了这个问题,visual composer本身使用该方法将样式包含在页眉或页脚中

我的解决方案:

$shortcodeContent = '[vc_column_inner width="1/3" css=".vc_custom_1463660338922{background-image:url(/circlebg.png)!important;}”]';
$shortcodes_custom_css = visual_composer()->parseShortcodesCustomCss( $shortcodeContent );
if ( ! empty( $shortcodes_custom_css ) ) {
    $shortcodes_custom_css = strip_tags( $shortcodes_custom_css );
    $output .= '<style type="text/css" data-type="vc_shortcodes-custom-css">';
    $output .= $shortcodes_custom_css;
    $output .= '</style>';
    echo $output;
}
echo apply_filters( 'the_content', $shortcodeContent );
$shortcodeContent='[vc_column_inner width=“1/3”css=“.vc_custom_1463660338922{背景图像:url(/circlebg.png)!important;}”];
$shortcodes\u custom\u css=visual\u composer()->parseShortcodesCustomCss($shortcodeContent);
如果(!空($shortcode\u custom\u css)){
$shortcodes\u custom\u css=条带标签($shortcodes\u custom\u css);
$output.='';
$output.=$shortcode\u custom\u css;
$output.='';
echo$输出;
}
echo apply_过滤器('the_content',$shortcodeContent);
您可以尝试以下代码:

    Vc_Manager::getInstance()->vc()->addShortcodesCustomCss($page_id);
    $the_post = get_post($page_id);
    echo apply_filters('the_content', $the_post->post_content);
它适合我

您可以尝试以下代码:

    Vc_Manager::getInstance()->vc()->addShortcodesCustomCss($page_id);
    $the_post = get_post($page_id);
    echo apply_filters('the_content', $the_post->post_content);
它对我有用