【发布时间】:2015-04-21 21:04:13
【问题描述】:
大家好,我想学习在 wp 环境中使用 php 过滤器来执行此操作:filter on
<?php do_action( 'glow_credits' ); ?>
要删除此演职员表并仅添加版权信息...我该怎么做?
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the id=main div and all content after
*/
?>
</div><!-- #main .site-main -->
<?php get_sidebar(); ?>
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="social-menu">
<?php if ( has_nav_menu( 'social' ) ) {
wp_nav_menu( array( 'theme_location' => 'social', 'container' => 'false', 'menu_class' => 'menu-social' ));
} ?>
</div><!-- .social-menu -->
<div class="site-info">
<?php do_action( 'glow_credits' ); ?>
<a href="http://wordpress.org/" title="<?php esc_attr_e( 'A Semantic Personal Publishing Platform', 'glow' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'glow' ), 'WordPress' ); ?></a>.
<?php printf( __( 'Theme: %1$s by %2$s.', 'glow' ), 'Snaps', '<a href="http://glow.com/" rel="designer">glow</a>' ); ?>
</div><!-- .site-info -->
</footer><!-- #colophon .site-footer -->
</div><!-- #page .hfeed .site -->
<?php wp_footer(); ?>
</body>
</html>
我知道该怎么做:
function test_new_action() {
echo 'Howdy';
}
add_action('glow_credits','test_new_action');
但不替代...
【问题讨论】:
-
您可以将多个函数挂接到一个动作中。您将需要删除具有功劳的原始文件才能正常工作。在您的主题文件中搜索 gloom_credits,然后您可以找到相关的功能。也可以注释掉调用该函数的 add_action 函数。