简体   繁体   English

Wordpress PHP和HTML5解释

[英]Wordpress PHP and HTML5 explain

Could so 可以这样

<article id="post-<?php the_ID(); ?>" <?php post_class('group'); ?>> </article>

what does the post, ID and that other stuff doing in the article ? 什么是职务,身份证和其他东西做article I thought the post_class would be in my CSS, but could not find it. 我以为post_class将在我的CSS中,但找不到它。

When I remove the entire code from the <article> , my site messses up, when I take the group out, it does not mess up... but I want to know which css class is driving that entire artcle section. 当我从<article>删除整个代码时,我的网站陷入混乱,当我退出该组时,它并没有陷入混乱……但是我想知道哪个CSS类正在驱动整个artcle部分。

Ok, whhat i meant is : 好的,我的意思是:

I have the code below, it gives me 4 row of images, but on phone it gives me 3 plus 1 below. 我有下面的代码,它给了我4行图像,但是在电话上它给了我3加1。 I will like to have 2 rows phones but maintain the 4 rows on desktop PC and large screens 我想要两排手机,但在台式机和大屏幕上保持四排

    <article  style="max-width: 28%; float: left;  margin-right: 10px; color:#ffffff"
<?php #post_class(); ?> >
        <!--/.post-thumbnail-->
    <!-- #############################################  -->
<?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif; ?></article>

I fixed it myself... not a good practices mixing px and % 我自己修复了此问题...不是将px和%混合使用的好方法

An id is just an id. 一个id只是一个id。 You can use it in Javascript, in CSS or both or neither. 您可以在Javascript,CSS中或同时使用两者或两者都不使用。 So removing it might cause no problems at all, but if it is convention in WordPress to have such an id, I would leave it, because it might be used depending on which plugins you have, which themes you choose, or whatever future changes to Wordpress there might be. 因此,将其删除可能不会造成任何问题,但是如果WordPress中有这样的ID是惯例,我会保留它,因为它的使用取决于您拥有的插件,选择的主题或将来的更改WordPress的可能存在。

The "ID" is used server-side by a php routine to 'load' the article and some stuff. php例程在服务器端使用“ ID”来“加载”文章和某些内容。

To see the CSS underneath : 要查看下面的CSS:

  1. catch Google Chrome 赶上谷歌浏览器
  2. open the page in the client side 在客户端打开页面
  3. and 'inspect element' properies 和“检查元素”属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM