Add RSS subscription support

This commit is contained in:
User
2026-03-12 16:42:57 +08:00
parent f9dc3f7a40
commit d11873f921
4 changed files with 43 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ if (version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' )) {
function theme_slug_setup() {
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
load_theme_textdomain('argon', get_template_directory() . '/languages');
}
add_action('after_setup_theme','theme_slug_setup');

View File

@@ -1529,6 +1529,18 @@ function themeoptions_page(){
</tr>
<tr>
<th><label><?php _e('显示 RSS 订阅链接', 'argon');?></label></th>
<td>
<select name="argon_show_rss_link">
<?php $argon_show_rss_link = get_option('argon_show_rss_link', 'false'); ?>
<option value="false" <?php if ($argon_show_rss_link=='false'){echo 'selected';} ?>><?php _e('隐藏', 'argon');?></option>
<option value="true" <?php if ($argon_show_rss_link=='true'){echo 'selected';} ?>><?php _e('显示', 'argon');?></option>
</select>
<p class="description"><?php _e('在左侧栏博客概览下方显示 RSS 订阅链接', 'argon');?></p>
</td>
</tr>
<tr><th class="subtitle"><h2 id="section-announcement"><?php _e('博客公告', 'argon');?></h2></th></tr>
<tr>
@@ -6879,6 +6891,7 @@ function argon_update_themeoptions(){
argon_update_option('argon_show_duolingo_streak');
argon_update_option('argon_duolingo_username');
argon_update_option('argon_show_rss_link');
delete_option('argon_duolingo_email');
delete_transient('argon_duo_login_error');

View File

@@ -714,6 +714,14 @@ $author_desc = get_option('argon_sidebar_author_description');
</nav>
<?php if (get_option('argon_show_rss_link', 'false') == 'true') : ?>
<div class="site-rss">
<a href="<?php bloginfo('rss2_url'); ?>" target="_blank" class="btn btn-primary btn-sm btn-icon-only rounded-circle" data-toggle="tooltip" data-placement="bottom" title="<?php _e('RSS 订阅', 'argon'); ?>">
<i class="fa fa-rss"></i>
</a>
</div>
<?php endif; ?>
<?php
/*侧栏作者链接*/

View File

@@ -17872,4 +17872,24 @@ html.darkmode .argon-hidden-text-background:active {
filter: none;
-webkit-filter: none;
user-select: auto;
}
}.site-rss {
margin-top: 15px;
display: flex;
justify-content: center;
}
.site-rss a {
width: 38px;
height: 38px;
display: flex;
align-items: center;
justify-content: center;
color: #fff !important;
background: var(--themecolor);
border-radius: 50%;
box-shadow: 0 4px 6px rgba(50, 50, 93, .11), 0 1px 3px rgba(0, 0, 0, .08);
transition: all .15s ease;
}
.site-rss a:hover {
transform: translateY(-1px);
box-shadow: 0 7px 14px rgba(50, 50, 93, .1), 0 3px 6px rgba(0, 0, 0, .08);
}