代码高亮DEMO
开始之前,看一下行内代码 const hljs = require('highlight.js');
常用类别
PHP
要在WordPress中调用自定义文章分类中的文章,您可以使用WP_Query或get_posts函数。以下是一些示例代码,假设您有一个名为"customcategory"的自定义文章分类:
使用WP_Query:
$args = array(
'post_type' => 'post', // 文章类型
'posts_per_page' => 1, // 获取所有文章
'tax_query' => array(
array(
'taxonomy' => 'customcategory', // 自定义文章分类的名称
'field' => 'slug', // 根据分类别名进行查询
'terms' => 'yourtermslug', // 替换为您要调用的分类别名
),
),
);
$custom_query = new WP_Query($args);
if ($custom_query>have_posts()) :
while ($custom_query>have_posts()) : $custom_query>the_post();
// 在这里显示文章内容
the_title();
the_content();
endwhile;
endif;
wp_reset_postdata();
CSS
使用 calc() 函数计算 <div> 元素的宽度:
#div1 {
position: absolute;
left: 50px;
width: calc(100% - 100px);
border: 1px solid black;
background-color: yellow;
padding: 5px;
text-align: center;
}
JavaScript
如果今天不是星期六或星期日,则会输出默认的消息:
var d=new Date().getDay();
switch (d)
{
case 6:x="今天是星期六";
break;
case 0:x="今天是星期日";
break;
default:
x="期待周末";
}
document.getElementById("demo").innerHTML=x;
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>文档标题</title>
</head>
<body>
文档内容......
</body>
</html>
其他代码
BASH
npm install highlight.js
# or
yarn add highlight.js
ini
[SERVERCONNECTION]
Address=localhost
PortNumber=3333
[ACTIVATIONS]
Count=3
ActID0=AAAA-AAAA-AAAA-AAAA::1
ActID1=BBBB-BBBB-BBBB-BBBB::3
ActID2=CCCC-CCCC-CCCC-CCCC::0
plaintext
The ActID0 code followed by (::1) will result in a final total of 1.
If the server did not have this code, then the code will be added with an absolute total of 1.
If this code already existed in the server before the request is made, the total will adjust to the quantity that was just requested.
If the server already had the ActID0 code with a total of 3 before the ActID0=AAAA-AAAA-AAAA-AAAA::1 request, then 2 quantities of the code will be removed to adjust to the
SQL
CREATE TABLE "topic" (
"id" integer NOT NULL PRIMARY KEY,
"forum_id" integer NOT NULL,
"subject" varchar(255) NOT NULL
);
ALTER TABLE "topic"
ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id")
REFERENCES "forum" ("id");
-- Initials
insert into "topic" ("forum_id", "subject")
values (2, 'D''artagnian');
0 条评论