如何在div中放置wordpress插件(自定义Facebook Feed)?

时间:2014-04-16 21:54:56

标签: php facebook wordpress wordpress-plugin

我一直在开发我的第一个Wordpress主题,我正在尝试将“自定义Facebook Feed”插件放在div文件的index.php元素中。

包含此插件的简写是[custom-facebook-feed]

如果我通过wp-admin面板将其输入到帖子中,这是有效的,但是如果我尝试在我的index.php文件中直接使用它,它就不会出现。

我不确定我做错了什么(显然我是),我已经阅读了一堆关于激活挂钩和所有种类的页面,因为我不确定我的主题是否启用了插件但不能似乎围绕着如何在主题中实现插件。

以下是我的index.php文件中的代码

<?php get_header()?>

<!-- POSTS -->
<div class='col-sm-12 section'>
    <?php while(have_posts()): the_post()?>

        <h1><?php the_title();?></h1>
        <?php the_content();?>

    <?php endwhile;?>
</div>

<!-- PLUGINS -->
<div class='col-sm-4 section'>
    <h1>Social</h1>
    <?php [custom-facebook-feed]?>
</div>

<div class='col-sm-4 section'>
    <h1>Instagram</h1>
    <p>
        Insert Instagram feed
    </p>
</div>

<div class='col-sm-4 section'>
    <h1>Music</h1>
    <p>
        Insert Soundcloud feed
    </p>
</div>

<?php get_footer()?>

1 个答案:

答案 0 :(得分:3)

您可以使用do_shortcode函数:

<!-- PLUGINS -->
<div class='col-sm-4 section'>
    <h1>Social</h1>
    <?php echo do_shortcode('[custom-facebook-feed]');?>
</div>

http://codex.wordpress.org/Function_Reference/do_shortcode