简体   繁体   中英

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 ? I thought the post_class would be in my CSS, but could not find it.

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.

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. 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 %

An id is just an id. You can use it in Javascript, in CSS or both or neither. 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.

The "ID" is used server-side by a php routine to 'load' the article and some stuff.

To see the CSS underneath :

  1. catch Google Chrome
  2. open the page in the client side
  3. and 'inspect element' properies

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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