admin管理员组文章数量:1323714
i am adding a option to a plugin. I want to add a Subfix after the curent test variable is return from a summarizer.
So my data is in excerpt variable and i want to add text that is in this variable $summarizer_add_html_trust_bulletpoints.
How can i do that?
function create_excerpt_product($post_ID) {
global $wpdb;
$excerpt = $wpdb->get_var("SELECT post_excerpt FROM $wpdb->posts WHERE ID = $post_ID");
if(!$excerpt && !$force_rewrite_excerpt) {
require_once('config.php');
// load the correct Document class for the language specified
require_once("lib/$lang/$document[$lang].php");
$content = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $post_ID");
$title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $post_ID");
$doc = new $document[$lang]($title, $content);
// TODO add tags, category and others to the query
$summarizer_add_html_trust_bulletpoints='my demo text' ;
$excerpt = $doc->getSummary($summary_options);
//$excerpt = $excerpt + $summarizer_add_html_trust_bulletpoints ;
$excerpt = esc_sql($excerpt);
$wpdb->query("UPDATE $wpdb->posts SET post_excerpt = '$excerpt' WHERE ID = $post_ID");
}
}
?>
i am adding a option to a plugin. I want to add a Subfix after the curent test variable is return from a summarizer.
So my data is in excerpt variable and i want to add text that is in this variable $summarizer_add_html_trust_bulletpoints.
How can i do that?
function create_excerpt_product($post_ID) {
global $wpdb;
$excerpt = $wpdb->get_var("SELECT post_excerpt FROM $wpdb->posts WHERE ID = $post_ID");
if(!$excerpt && !$force_rewrite_excerpt) {
require_once('config.php');
// load the correct Document class for the language specified
require_once("lib/$lang/$document[$lang].php");
$content = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $post_ID");
$title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $post_ID");
$doc = new $document[$lang]($title, $content);
// TODO add tags, category and others to the query
$summarizer_add_html_trust_bulletpoints='my demo text' ;
$excerpt = $doc->getSummary($summary_options);
//$excerpt = $excerpt + $summarizer_add_html_trust_bulletpoints ;
$excerpt = esc_sql($excerpt);
$wpdb->query("UPDATE $wpdb->posts SET post_excerpt = '$excerpt' WHERE ID = $post_ID");
}
}
?>
Share
Improve this question
asked Sep 9, 2020 at 16:57
Pierre Pierre
1
1 Answer
Reset to default 1You've commented out the line that does this:
//$excerpt = $excerpt + $summarizer_add_html_trust_bulletpoints ;
The only mistake is that you've used +
instead of .
, which is the correct concatenation operator in PHP.
$excerpt = $excerpt . $summarizer_add_html_trust_bulletpoints;
本文标签: pluginsAdd text to variable
版权声明:本文标题:plugins - Add text to variable 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742127796a2422020.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论