简体   繁体   English

如何在Wordpress的front-page.php中正确使用插件

[英]How to use plugin correctly within front-page.php in wordpress

I have created a front-page.php page for my wordpress site. 我为我的wordpress网站创建了一个front-page.php页面。 This page contains fully customised css and js. 此页面包含完全自定义的css和js。 So it doesn't use anything from the installed theme. 因此,它不使用已安装主题中的任何内容。 I am not using: 我没有使用:

<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Now I have installed a plugin ( wp-tiles ) and would like to use this on the front-page.php 现在,我已经安装了一个插件( wp-tiles ),并希望在front-page.php上使用它

By adding the code to display the tiles 通过添加代码以显示图块

<?php echo do_shortcode(
        '[wp-tiles post_type = "attachment,product" orderby = "rand" order = "DESC" grids = "Featured" small_screen_grid = "Featured" breakpoint = "800" padding = "5" pagination = "ajax" grid_selector_color = "#444444"]'
    );?>

It tries to show the tiles but does so incorrectly as I'm assuming the plugin css and js is missing. 它尝试显示图块,但这样做不正确,因为我假设缺少插件css和js。

Is there anyway to automatically add the plugins required files without manually adding the paths to the front-page.php? 无论如何,有没有自动添加插件所需的文件,而无需手动将路径添加到front-page.php的方法?

Thanks 谢谢

As far as I know the only automatic way to load their CSS and JS files would be to allow Wordpress to load the header like normal, however this will load CSS and JS files for all Wordpress plugins and themes which are activated. 据我所知,唯一自动加载CSS和JS文件的方法是允许Wordpress像正常情况一样加载标头,但是这将为所有已激活的Wordpress插件和主题加载CSS和JS文件。

The only other solution I could imagine would be to manually load the paths as you have suggested. 我能想到的唯一其他解决方案是按照您的建议手动加载路径。 You could do this by running a php script to go into their plugin folder and then assets and load each css and js file, however it seems it would be easier just to manually load the paths. 您可以通过运行php脚本进入其插件文件夹,然后资产并加载每个css和js文件来执行此操作,但是似乎手动加载路径会更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM