【问题标题】:How to integrate visual composer custom wordpress theme如何集成视觉作曲家自定义 wordpress 主题
【发布时间】:2017-12-20 12:30:11
【问题描述】:

Console Image

我已经开发了带有集成可视化作曲家插件的自定义 wordpress 主题,它已正常安装,但问题是当我从后端在我的自定义主题中安装插件时,所有可视化作曲家功能都正常工作,但在前端没有像我一样显示设计在后端设置,这意味着当我的主题安装了可视化作曲家插件 js 并且未加载 css 时,当我安装其他主题时它工作正常,请让我摆脱这个问题,我浪费了一天时间去寻找它,但没有得到任何适当的解决方案。

例如:我在页面中从后端设置了三列,但是当我在前端显示时,它不是分成三列。

Header.php 文件

<?php
 /*
  Template Name:Header
 */
?>
<!DOCTYPE html>

<html class="top">
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width">
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <?php wp_head();?>
</head>
<body <?php body_class(); ?> id="page-wrap">
    <div id="page" class="main-site">
        <header id="master-header" class="main-header">
            <div class="site-branding">
                <a href="<?php echo esc_url( home_url() ); ?>" class="link-logo"><img src="<?php echo esc_url( home_url() ); ?>/wp-content/uploads/2017/12/test.png" class="logo"></a>
            <?php 
                 wp_nav_menu( array( 
                   'theme_location' => 'primary-menu', 
                   'container_class' => 'top-navigation-menu' ) 
                );
            ?>
        </div>
        </header>   
    <div id="main-content" class="data-content">
         <div class="container-fluid">

页脚.php 文件

    </div>
   </div> 
   </div> 
<?php get_footer(); ?>
  </body>
</html>

Function.php 文件

<?php
function my_theme_script(){
    wp_enqueue_style('style-css', get_template_directory_uri().'/style.css');
    wp_enqueue_style('bootstrap-css', get_template_directory_uri().'/bootstrap/css/bootstrap.min.css');
    //wp_enqueue_script('jquery-js', get_template_directory_uri().'/js/jquery.min.js');
    wp_enqueue_script('bootstrap-js', get_template_directory_uri().'/bootstrap/js/bootstrap.min.js');
}
add_action('wp_enqueue_scripts','my_theme_script');

/*Add Menu in Wordpress Admin Dashboard*/
add_theme_support( 'menus' );

add_action( 'init', 'register_my_menu' );
function register_my_menu() {
  register_nav_menu( 'primary-menu', __( 'Primary Menu') );
}
?>

【问题讨论】:

    标签: jquery css wordpress plugins themes


    【解决方案1】:

    尝试像这样创建页面模板,并在编辑或新页面部分模板的后端显示选项选择“首页模板”并更新页面将显示具有视觉设计的内容

    <?php
    /**
     * Template Name: Front Page Template // You can change the name
     *
     * @package WordPress
    
     * @subpackage demo // Theme Name
    
     * @since demo 1.0
     */
    
    get_header(); ?>
    
        <div class="main_content">
            <div class="container">
                 <?php if ( have_posts() ) : ?>
                    <?php while ( have_posts() ) : the_post() ?>
                        <?php the_content() ?>
                    <?php endwhile; ?>
                <?php endif; ?> 
    
            </div><!-- container -->
        </div><!-- main_content -->
    
    <?php get_footer(); ?>
    

    【讨论】:

    • 我已经上传了我的 header.php 、 footer.php 和 function.php 文件..@Aakansh Patel
    • 能分享一下控制台截图吗
    • 我的代码有解决问题,但小问题是如果我不使用引导程序,某些功能在可视化作曲家中不起作用
    • 把截图发给我哪个功能不工作,因为我也有演示,它不使用引导程序并且它工作正常
    • 目前我已经使用了其他页面构建器,例如站点起源,在视觉合成器功能中不起作用,就像我们必须设置容器拉伸列一样,它显示在前端全宽列中,当我使用选项卡时,视觉 css不工作,只显示文本不显示标签...所以感谢支持我并给我答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-17
    • 2016-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多