admin管理员组文章数量:1406178
In single.php
, inside the loop the code shows text output.
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
$content = get_the_content();
$content = apply_filters('the_content', $content);
echo wp_strip_all_tags($content);
$Temp_text=wp_strip_all_tags($content);
?>
Is there any way to use $Temp_text
in functions.php
.
In single.php
, inside the loop the code shows text output.
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
$content = get_the_content();
$content = apply_filters('the_content', $content);
echo wp_strip_all_tags($content);
$Temp_text=wp_strip_all_tags($content);
?>
Is there any way to use $Temp_text
in functions.php
.
- you want to use the content of a post ? what do you want to do with it ? – Kaperto Commented Nov 24, 2019 at 13:30
- I want to create the title, description , and keyword from this text and pass it to SEO. I am using YOAST SEO. – NARAYAN CHANGDER Commented Nov 24, 2019 at 13:44
1 Answer
Reset to default 0I don't undesrtand well what you want to do. You mean this??? (the last line):
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
$content = get_the_content();
$content = apply_filters('the_content', $content);
echo wp_strip_all_tags($content);
$Temp_text=wp_strip_all_tags($content);
do_something($Temp_text);
?>
And implement do_something()
inside functions.php
本文标签: loopHow to use singlephp output in functionphp
版权声明:本文标题:loop - How to use single.php output in function.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744973764a2635394.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论