正在尝试在我的摘录readmore链接中包含帖子标题。我读过这方面的法典,但我的主题文件要复杂得多,所以我需要一些专家的帮助。。。
从函数中提取。php:*编辑以显示更多代码。。。。。。。。。
function theme_get_content($args = array()) {
$more_tag = theme_get_array_value($args, \'more_tag\', __(\'Continue Bob <span class="meta-nav">→</span>\', THEME_NS));
theme_ob_start();
the_content($more_tag);
$content = theme_ob_get_clean();
return $content . wp_link_pages(array(
\'before\' => \'<p><span class="page-navi-outer page-navi-caption"><span class="page-navi-inner">\' . __(\'Pages\', THEME_NS) . \': </span></span>\',
\'after\' => \'</p>\',
\'link_before\' => \'<span class="page-navi-outer"><span class="page-navi-inner">\',
\'link_after\' => \'</span></span>\',
\'echo\' => 0
));
}
function theme_get_excerpt($args = array()) {
global $post;
$more_tag = theme_get_array_value($args, \'more_tag\', __(\'My Words...<span class="meta-nav">→</span>\', THEME_NS));
$auto = theme_get_array_value($args, \'auto\', theme_get_option(\'theme_metadata_excerpt_auto\'));
$all_words = theme_get_array_value($args, \'all_words\', theme_get_option(\'theme_metadata_excerpt_words\'));
$min_remainder = theme_get_array_value($args, \'min_remainder\', theme_get_option(\'theme_metadata_excerpt_min_remainder\'));
$allowed_tags = theme_get_array_value($args, \'allowed_tags\',
(theme_get_option(\'theme_metadata_excerpt_use_tag_filter\')
? explode(\',\',str_replace(\' \', \'\', theme_get_option(\'theme_metadata_excerpt_allowed_tags\')))
: null));
$perma_link = get_permalink($post->ID);
$more_token = \'%%theme_more%%\';
$show_more_tag = false;
$tag_disbalance = false;
if (post_password_required($post)) {
return get_the_excerpt();
}
if ($auto && has_excerpt($post->ID)) {
$excerpt = get_the_excerpt();
$show_more_tag = theme_strlen($post->post_content) > 0;
} else {
$excerpt = get_the_content($more_token);
// hack for badly written plugins
theme_ob_start();
echo apply_filters(\'the_content\', $excerpt);
$excerpt = theme_ob_get_clean();
global $multipage;
if ($multipage && theme_strpos($excerpt, $more_token) === false) {
$show_more_tag = true;
}
if (theme_is_empty_html($excerpt))
return $excerpt;
if ($allowed_tags !== null) {
$allowed_tags = \'<\' . implode(\'><\', $allowed_tags) . \'>\';
$excerpt = strip_tags($excerpt, $allowed_tags);
}
if (theme_strpos($excerpt, $more_token) !== false) {
$excerpt = str_replace($more_token, $more_tag, $excerpt);
} elseif ($auto && is_numeric($all_words)) {
$token = "%theme_tag_token%";
$content_parts = explode($token, str_replace(array(\'<\', \'>\'), array($token . \'<\', \'>\' . $token), $excerpt));
$content = array();
$word_count = 0;
foreach ($content_parts as $part) {
if (theme_strpos($part, \'<\') !== false || theme_strpos($part, \'>\') !== false) {
$content[] = array(\'type\' => \'tag\', \'content\' => $part);
} else {
$all_chunks = preg_split(\'/([\\s])/u\', $part, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($all_chunks as $chunk) {
if (\'\' != trim($chunk)) {
$content[] = array(\'type\' => \'word\', \'content\' => $chunk);
$word_count += 1;
} elseif ($chunk != \'\') {
$content[] = array(\'type\' => \'space\', \'content\' => $chunk);
}
}
}
}
if (($all_words < $word_count) && ($all_words + $min_remainder) <= $word_count) {
$show_more_tag = true;
$tag_disbalance = true;
$current_count = 0;
$excerpt = \'\';
foreach ($content as $node) {
if ($node[\'type\'] == \'word\') {
$current_count++;
}
$excerpt .= $node[\'content\'];
if ($current_count == $all_words) {
break;
}
}
$excerpt .= \'…\'; // ...
}
}
}
if ($show_more_tag) {
$excerpt = $excerpt . \' <a class="more-link" href="\' . $perma_link . \'">\' . $more_tag . \' </a>\';
}
if ($tag_disbalance) {
$excerpt = force_balance_tags($excerpt);
}
return $excerpt;
}
如何在readmore permalink中包含帖子标题???谢谢