/* 使用方法: 获取过去24小时发布的文章数量: [zkf_index_module_03_power_level hours="24"] 获取过去12小时发布的文章数量: [zkf_index_module_03_power_level hours="12"] 获取过去6小时发布的文章数量: [zkf_index_module_03_power_level hours="6"] 获取当天发布的文章数量: [zkf_index_module_03_power_level hours="24"] (或者你可以修改逻辑来支持精确到当天) */ /* 获取过去指定时间内发布的文章数量(能量值显示) | 结束 */ /* 根据分类或者标签筛选文章 | 开始 */ function zkf_index_module_04_custom_category_tag_code($atts) { // 提取短代码属性并设置默认值 $atts = shortcode_atts(array( 'category' => '', 'tag' => '', 'offset' => 0, 'limit' => 5, 'category_switch' => 'and', 'tag_switch' => 'and', 'main_switch' => 'and' ), $atts, 'zkf_index_module_04_custom_category_tag'); // 验证和过滤输入参数 $offset = max(0, intval($atts['offset'])); $limit = max(1, intval($atts['limit'])); $category_switch = in_array($atts['category_switch'], array('and', 'or')) ? $atts['category_switch'] : 'and'; $tag_switch = in_array($atts['tag_switch'], array('and', 'or')) ? $atts['tag_switch'] : 'and'; $main_switch = in_array($atts['main_switch'], array('and', 'or')) ? $atts['main_switch'] : 'and'; // 处理分类 $categories = array(); if (!empty($atts['category'])) { $category_slugs = array_map('sanitize_text_field', explode(',', $atts['category'])); foreach ($category_slugs as $slug) { $category = get_category_by_slug(trim($slug)); if ($category) { $categories[] = $category->term_id; } } } // 处理标签 $tags = array(); if (!empty($atts['tag'])) { $tag_slugs = array_map('sanitize_text_field', explode(',', $atts['tag'])); foreach ($tag_slugs as $slug) { $tag = get_term_by('slug', trim($slug), 'post_tag'); if ($tag) { $tags[] = $tag->term_id; } } } // 设置查询参数 $args = array( 'posts_per_page' => $limit, 'offset' => $offset, 'post_type' => 'post', 'post_status' => 'publish', ); // 设置分类查询参数 if (!empty($categories)) { if ($category_switch === 'and') { $args['category__and'] = $categories; } else { $args['category__in'] = $categories; } } // 设置标签查询参数 if (!empty($tags)) { if ($tag_switch === 'and') { $args['tag__and'] = $tags; } else { $args['tag__in'] = $tags; } } // 处理主要条件 if ($main_switch === 'or') { $args['tax_query'] = array('relation' => 'OR'); if (!empty($categories)) { $args['tax_query'][] = array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => $categories, 'operator' => $category_switch === 'and' ? 'AND' : 'IN', ); } if (!empty($tags)) { $args['tax_query'][] = array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $tags, 'operator' => $tag_switch === 'and' ? 'AND' : 'IN', ); } } // 执行查询 $query = new WP_Query($args); // 构建输出内容 $output = ''; if ($query->have_posts()) { $output .= ''; } else { $output = '没有找到相关文章。'; } // 恢复全局 $post 变量 wp_reset_postdata(); return $output; } add_shortcode('zkf_index_module_04_custom_category_tag', 'zkf_index_module_04_custom_category_tag_code'); /* 用法: 短代码:[zkf_index_module_04_custom_category_tag category="分类1,分类2" tag="标签1,标签2" offset="0" limit="5" category_switch="or" tag_switch="or" main_switch="or"] 参数解释: category:指定分类的 slug,可以是单个分类或多个分类,用逗号分隔。 tag:指定标签的 slug,可以是单个标签或多个标签,用逗号分隔。 offset:从第几篇文章开始(从 0 开始计数)。 limit:指定要获取的文章数量。 category_switch:分类条件,'and' 或 'or'。 tag_switch:标签条件,'and' 或 'or'。 main_switch:主条件,'and' 或 'or'。 用法示例: 短代码 [zkf_index_module_04_custom_category_tag category="分类1,分类2" tag="标签1,标签2" offset="0" limit="5" category_switch="or" tag_switch="or" main_switch="or"] 会获取第1到第5篇符合条件的文章。 调整 offset 和 limit 参数可以获取不同区间的文章。 */ /* 根据分类或者标签筛选文章 | 结束 */
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/zhaokaifeng.com/wp-content/plugins/CoreEngine/index-page/index-page-main.php:215) in /www/wwwroot/zhaokaifeng.com/wp-includes/rest-api/class-wp-rest-server.php on line 1831
1.0荒原之梦https://zhaokaifeng.com通过二次型的正惯性指数确定变量的取值范围 - 荒原之梦rich600338<blockquote class="wp-embedded-content" data-secret="e1TYjZpzlB"><a href="https://zhaokaifeng.com/16948/">通过二次型的正惯性指数确定变量的取值范围</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://zhaokaifeng.com/16948/embed/#?secret=e1TYjZpzlB" width="600" height="338" title="《 通过二次型的正惯性指数确定变量的取值范围 》—荒原之梦" data-secret="e1TYjZpzlB" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script> /*! This file is auto-generated */ !function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document); </script> 已知,二次型 $a x_{1}^{2}+(2 a-1) x_{2}^{2}+a x_{3}^{2}-2 x_{ … 继续阅读“”