wordpress使用the_tags()函数(推荐)
<div class="post-meta"> <!-- 其他元信息 --> <div class="post-date">发布于: <?php the_date(); ?></di……
<div class="post-meta"> <!-- 其他元信息 --> <div class="post-date">发布于: <?php the_date(); ?></di……
<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <article id="post-<?php the_ID(); ?>"……
<div class="ad-container" style=" display: block !important; margin: 1rem auto !important; padding: 0 !important; text-align……
这个是zblog的搜索功能代码 <form name="search" method="get" action="<?php bloginfo('url'); ?>/"> &l……
方法1:调用第一个分类(常用) <?php $categories = get_the_category(); if ( ! empty( $categories ) ) { $first_category = $categories[0&……
添加序号计数器 为前三名添加特殊class 移除浏览量显示 添加target=”_blank”属性 保持原有查询逻辑不变 修改后的完整代码如下: <ul> <?php $ar……
一般我们添加上一篇和下一篇文章时的代码是这样子的: <?php previous_post_link('%link','%title',true) ?> <?php next_post_link(&……
首先在网站后台的wordpress模板函数functions.php文件中加入以下的代码: /*显示文章浏览次数*/ function getPostViews($postID){ $count = get_post_meta($postID……
核心代码实现 <h1 class="search-results-title"> <?php printf( esc_html__( 'Search Results for: %s', 'y……
<?php // 获取当前文章的ID $current_post_id = get_the_ID(); // 获取当前文章的分类ID(以第一个分类为例) $categories = get_the_category($current_post……