简体   繁体   中英

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

I have created a front-page.php page for my wordpress site. This page contains fully customised css and 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

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.

Is there anyway to automatically add the plugins required files without manually adding the paths to the 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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