Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使这个php代码片段浮动:就在我的页脚中,但保留在页面的主体中?_Php_Wordpress - Fatal编程技术网

如何使这个php代码片段浮动:就在我的页脚中,但保留在页面的主体中?

如何使这个php代码片段浮动:就在我的页脚中,但保留在页面的主体中?,php,wordpress,Php,Wordpress,我希望在我的页脚中有这些社交图标float:right。但是当我在结束PHP标记之前尝试这个时: <span style="float:right;"><?php if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?></span> 以下收盘?>。但是它不会浮动:对。 因此,我必须在页脚的某个地方实现一些代码,这就是您在图片中看到的,if(function_exists('cn

我希望在我的页脚中有这些社交图标float:right。但是当我在结束PHP标记之前尝试这个时:

<span style="float:right;"><?php if ( function_exists('cn_social_icon') ) echo 
cn_social_icon(); ?></span>
以下收盘?>。但是它不会浮动:对。

因此,我必须在页脚的某个地方实现一些代码,这就是您在图片中看到的,if(function_exists('cn_social_icon'))echo cn_social_icon()只是混合在其中:

<?php
/**
 * Builds the footer structure.
 *
 * @package Catalyst
 */

global $catalyst_layout_id;
if ( function_exists('cn_social_icon') ) echo cn_social_icon();
if( !is_page_template( 'template-blank-body.php' ) )
{
catalyst_hook_before_before_footer( $catalyst_layout_id . '_catalyst_hook_before_before_footer' );
catalyst_hook_before_footer( $catalyst_layout_id . '_catalyst_hook_before_footer' );
catalyst_hook_after_before_footer( $catalyst_layout_id . '_catalyst_hook_after_before_footer' );
catalyst_hook_footer( $catalyst_layout_id . '_catalyst_hook_footer' );

catalyst_hook_before_after_footer( $catalyst_layout_id . '_catalyst_hook_before_after_footer' );
catalyst_hook_after_footer( $catalyst_layout_id . '_catalyst_hook_after_footer' );
catalyst_hook_after_after_footer( $catalyst_layout_id . '_catalyst_hook_after_after_footer' );
}
wp_footer();

catalyst_hook_after_html( $catalyst_layout_id . '_catalyst_hook_after_html' );

/**
 * Un-comment the below function to list all items currently hooked into a WordPress or Catalyst hook.
 */
//catalyst_list_hooked();
/**
 * Un-comment the below function to display the number of database queries during the WordPress execution.
 */
//echo get_num_queries();
?>

</body>

</html>


任何帮助都将不胜感激

不确定要查找哪个钩子,但请使用以下格式尝试所有钩子:

替换:

if ( function_exists('cn_social_icon') ) echo cn_social_icon();
与:

function add_social_icons() {
    if ( function_exists('cn_social_icon') ) echo cn_social_icon();
}
add_action($catalyst_id.'_catalyst_hook_before_before_footer', 'add_social_icons');

发布footer.phpThanks Nicholas的全部内容;我对问题进行了编辑,以包含整个页脚。感谢您抽出时间来帮助我!使用这个footer.php,在第33行仍然会出现错误?使用这个footer,我得到的结果如图所示;我不能让它浮动:对……你需要把你的呼叫挂到正确的挂钩上。我不知道会是哪一个,我会一个接一个地尝试。在不同的地方尝试不同的钩子。。。没有收到错误,但没有显示任何内容。。。当我查看html输出时,没有任何内容表示任何社交媒体图标或链接。我会继续努力!再次感谢尼古拉斯!主题文件夹中是否存在
template blank body.php
。。。一切都是。。。这是:人力资源管理。。。我对Catalyst了解不够,无法进一步帮助您。我建议从开发者那里得到支持-对不起,没关系。。谢谢你的帮助,尼古拉斯。我把它放在开头的正上方
if ( function_exists('cn_social_icon') ) echo cn_social_icon();
function add_social_icons() {
    if ( function_exists('cn_social_icon') ) echo cn_social_icon();
}
add_action($catalyst_id.'_catalyst_hook_before_before_footer', 'add_social_icons');