2017-05-18 42 views
0

我提出具有使用简码功能的一个插件,虽然简码会在页面的地方,它会返回一个很好DESGIN形式 例如:https://www.screencast.com/t/XTteV6u8qw加载特定的CSS文件 - WordPress的

现在,如果我添加bootstrap css/classes我当前的主题搞砸了,

我想要任何主题的功能,我的短代码功能显示设计将保持不变。 有关它如何可能的任何想法?

任何信息将不胜感激。谢谢!

+0

这一个所有帮助你... https://wordpress.stackexchange.com/questions/165754/enqueue-scripts-styles-when-shortcode-is-present –

回答

2

您可以编写该短代码内容的内部CSS,如下例所示。

function shortcode_func($atts) { 

    $returnString = '<style>'; 
    $returnString .='#shortcode-id{background-color:yello;}'; 
    $returnString .= '</style>'; 

    $returnString .='<div id="shortcode-id"></div>'; 
    return $returnString; 
} 

add_shortcode('shortcode-name', 'shortcode_func');

相关问题