好吧,所以我有一个问题,我正在尝试解决涉及WordPress插件的问题。我找到了一个我喜欢的图库插件 - 几乎有我需要的一切 - 但问题是将简码放在内容编辑器中会导致它被放置在我拥有的横幅图像下方(此横幅图像存储在我的自定义主题的header.php
文件中,由于我正在处理的网站的布局,它必须去那里)。
我想做的是调用我的标题中的插件.php在这个横幅图像之前......但我很难弄清楚我需要做什么才能完成这项工作。我读到当我在头文件中手动调用插件时需要潜在地删除register_activation_hook或activate_pluginname操作.php......我是否需要以某种方式合并这些或在我的header.php
文件中创建类似的功能?
这就是我在标题.php文件中的目标(我只想为主页加载此图库插件,因此检查页面 ID 是否是主页 ID):
<div id="Container_Body" class="clearfix">
<div id="topbox">
<?php
$id = get_the_ID();
$hpid = get_option('page_on_front');
if($id == $hpid)
{
code to display plugin
}
?>
<div class="GalleryPlugin">
<?php code to display gallery plugin ?>
</div>
<div class="giantBanner" style="background: rgb(0, 141, 175);">
<img title="Main-Header-Banner" src="<?php bloginfo('template_directory'); ?>/images/Market-Crowd.jpg" alt="Market Crowd">
</div>
</div>
检查这个
<?php
if(is_home() || is_front_page()) // this will check for homepage its a wp check
{
// echo the plugin shortcode here like
echo do_shortcode('[gallery]'); // this will be any shortcode
}
?>