我没有编码很长时间,我的技能是基本的。 我有一个php文件。这是我自定义的wordpress主题的一个部分文件。
我的问题是。使代码链接到外部css文件以自定义社交媒体图标,但它没有加载CSS!
<!DOCTYPE html>
<html lang = "en-US">
<head>
<meta charset = "UTF-8">
<link rel="stylesheet" type="text/css" href="D:\xampp\htdocs\alfasteel.pt\wp-content\themes\onetone\css\socialmedia.css" />
</head>
<body>
<div class="footer-social-icons">
<h4 class="_14">Follow us on</h4>
<ul class="social-icons">
<li><a href="" class="social-icon"> <i class="fa fa-facebook"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-twitter"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-rss"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-youtube"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-linkedin"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-google-plus"></i></a></li>
</ul>
</div>
以下是您需要的整个文件代码:
<!DOCTYPE html>
<html lang = "en-US">
<head>
<meta charset = "UTF-8">
<link rel="stylesheet" type="text/css" href="D:\xampp\htdocs\alfasteel.pt\wp-content\themes\onetone\css\socialmedia.css" />
</head>
<body>
<?php
global $onetone_animated, $onetone_section_id, $allowedposttags;
$i = $onetone_section_id ;
$section_title = onetone_option( 'section_title_'.$i );
$section_menu = onetone_option( 'menu_title_'.$i );
$section_content = onetone_option( 'section_content_'.$i );
$content_model = onetone_option( 'section_content_model_'.$i);
$section_subtitle = onetone_option( 'section_subtitle_'.$i );
$left_content = onetone_option( 'section_left_content_'.$i );
$right_content = onetone_option( 'section_right_content_'.$i );
if( !isset($section_content) || $section_content=="" )
$section_content = onetone_option( 'sction_content_'.$i );
if( $content_model == '0' || $content_model == '' ):
?>
<?php if( $section_title != '' || (function_exists('is_customize_preview') && is_customize_preview()) ):?>
<?php
$section_title_class = '';
if( $section_subtitle == '' && !(function_exists('is_customize_preview') && is_customize_preview()))
$section_title_class = 'no-subtitle';
?>
<h2 class="section-title <?php echo esc_attr($section_title_class); ?> <?php echo 'section_title_'.$i;?>"><?php echo wp_kses($section_title, $allowedposttags);?></h2>
<?php endif;?>
<?php if( $section_subtitle != '' || (function_exists('is_customize_preview') && is_customize_preview()) ):?>
<div class="section-subtitle <?php echo 'section_subtitle_'.$i;?>"><?php echo do_shortcode(wp_kses($section_subtitle, $allowedposttags));?></div>
<?php endif;?>
<div class="home-section-content">
<div class="footer-social-icons">
<h4 class="_14">Follow us on</h4>
<ul class="social-icons">
<li><a href="" class="social-icon"> <i class="fa fa-facebook"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-twitter"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-rss"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-youtube"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-linkedin"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-google-plus"></i></a></li>
</ul>
</div>
<div class="row">
<div class="col-md-8"><div class="<?php echo $onetone_animated;?> <?php echo 'section_left_content_'.$i;?>" data-animationduration="0.9" data-animationtype="fadeInLeft" data-imageanimation="no"><?php echo do_shortcode($left_content);?></div></div>
<div class="col-md-4"><div class="<?php echo $onetone_animated;?> <?php echo 'section_right_content_'.$i;?>" data-animationduration="0.9" data-animationtype="fadeInRight" data-imageanimation="no"><?php echo do_shortcode($right_content);?></div></div>
</div>
</div>
<?php
else:
?>
<?php if( $section_title != '' || (function_exists('is_customize_preview') && is_customize_preview()) ):?>
<div class="section-title <?php echo 'section_title_'.$i;?>"><?php echo esc_attr($section_title);?></div>
<?php endif;?>
<div class="home-section-content <?php echo 'section_content_'.$i;?>">
<?php
if(function_exists('Form_maker_fornt_end_main'))
{
$section_content = Form_maker_fornt_end_main($section_content);
}
echo do_shortcode(wp_kses($section_content, $allowedposttags));
?>
</div>
<?php
endif;
?>
</body>
</html>
答案 0 :(得分:0)
您的文件位于Web服务器htdocs文件夹下。您可以通过指定URI来访问它们。
改变href="D:\xampp\htdocs\alfasteel.pt\wp-content\themes\onetone\css\socialmedia.php"
到
href="http://localhost/alfasteel.pt/wp-content/themes/onetone/css/socialmedia.php"
答案 1 :(得分:0)
@Itay Moav -Malimovka建议
这条道路不是正确的道路!
这有效!
<link rel="stylesheet" type="text/css" href="http://localhost/alfasteel.pt/wp-content/themes/onetone/css/socialmedia.css" />
非常感谢你的帮助!