首页 文章

如何在wordpress主题中注册html页面的Css

提问于
浏览
3

我是wordpress开发的新手 . 我试图将响应式html页面转换为wordpress主题,但html页面的CSS在wordpress主题中效果不佳 . 请看下面的图片:

Html页眉

enter image description here

wordpress主题 Headers

enter image description here

我无法弄清楚为什么wordpress主题 Headers 与html页面 Headers 不同,而 Style.css 是相同的 .
请告诉我如何解决这个问题 .

2 回答

  • 0

    这里是调用WordPress目录图像,样式或帖子等的所有过程请检查它 .

    default CSS call 
    <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" media="screen" />
    
     <a href="php?page_id=318"><h6 class="add-to-cart"></h6></a>-------page call
    
      <?php get_header(); ?>---------------------------------------header show
    
      <?php get_sidebar(); ?>--------------------------------------to call slider.php
    
      <?php dynamic_sidebar( 'sidebar name  include ' ); ?>-----to show slider wigdts
    
      <?php dynamic_sidebar('New 1'); ?>---------------------------sidebar 
    
      <?php get_footer(); ?>---------------------------------------footer show
    
      <?php get_template_directory(); ?> --------------------------dirctory path
    
      <?php echo get_template_directory_uri(); ?>------------------script path
    
      <?php the_title(''); ?>--------------------------------------title show
    
      <?php the_excerpt(''); ?>------------------------------------content show 
    
      <p><?php echo substr(get_the_excerpt(), 0,170); ?></p>------content LIMIT 
    
      <?php get_search_form(); ?>-----search 
    
      <?php the_permalink(''); ?>----------------------------------post ka link(like click on title of post and it show inside the post)
    
      <?php bloginfo('template_url');?>/images---------------------image path 
    
    
    
      <link href="<?php bloginfo('template_url'); ?>/css/global-style.css" type="text/css" rel="stylesheet">-- css path in header file
    
      <?php echo the_post_thumbnail(''); ?>------------------------image show
    

    还有更多,但列表太长,它将帮助您使静态HTML动态

  • 0

    function.php 找到 wp_register_style 函数

    并且您可以在那里添加自定义样式表文件

    wp_register_style('THEMENAME', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');
    wp_enqueue_style('THEMENAME');
    

相关问题