DUX theme beautification Large front-end DUX theme adds NEW icons to newly published articles

888u

Last update at :2024-01-18,Edit by888u

The blogger is using a large front-end DUX theme, and has recently done some related beautification, that is, adding a NEW icon to the homepage for newly released themes within 24 hours. For specific effects, you can check the latest articles on the blog homepage. In fact, it is a very simple tutorial on modifying the main.css file. The blogger has written out the specific modification content for everyone. If you want to modify it, you can read it.

1. Modify the theme's excerpt.php

1. Open the excerpt.php file in the theme directory, Ctrl+F to search for the following code.

echo '

'.get_the_title().get_the_subtitle().'

';

2. Then add the following code after the searched code above. The first step of modifying the excerpt.php file is completed.

date_default_timezone_set('PRC'); $t1=$post->post_date; $t2=date("Y-m-d H:i:s"); $diff=(strtotime($t2)-strtotime($t1))/3600; if($diff<24){echo 'New';} else{echo "";}

2. Modify the theme’s CSS file main.css

1. First, find the main.css file in the theme CSS file, and add the following code at the end. Then clear the local cache or CDN cache and you will see the same effect as shown on the homepage of this blog.

/** Modify summary list positioning method */ .excerpt { position: relative; } /** NEW icon text version style **/ .excerpt .new-icon{ position: absolute; right: -38px; top: -16px; display: block; width: 76px; height: 20px; line-height: 20px; background: #4caf50; color: #fff; font-size: 14px; font-weight: 400; text-align: center; transform: rotate(45deg); transform-origin: 0% 0%; }

The content of this article comes from: https://www.wn789.com/category/wordpress

Recommended site search: Korean cn2 server, free static space, icp registration query system, Guangdong website registration, Ministry of Industry and Information Technology icp registration query, how to register domain names, http proxy ip, wordpress host, website space provider, webmaster ip,

p>

DUX theme beautification Large front-end DUX theme adds NEW icons to newly published articles

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码