插件和摘录不起作用

时间:2015-10-08 20:02:33

标签: wordpress

这是我的代码:

ready: function() {
  this.$http.get('/todos', function (data) {
    this.$set('todos', data);
  }).error(function (data) {
    console.log(data);
  });

打印出来:

/*
Plugin Name: myplugin
*/



function my_facebook_tags() {
  echo "testme";
  $myExcerpt = strip_tags(get_the_excerpt()); 
  echo "Excerpt ".$myExcerpt;
  echo "Excerpt ".get_the_excerpt();
  echo "Content ".the_content();
  echo "Title ".the_title();
}
add_action( 'wp_head', 'my_facebook_tags' );

而不是:

testmeExcerpt Excerpt Content POSTITLETitle 

为什么?

1 个答案:

答案 0 :(得分:0)

请试试下面的代码。

/*
Plugin Name: myplugin
*/



function my_facebook_tags() {
    global $post;
  echo "<br />testme";
  $myExcerpt = strip_tags($post->post_content); 
  echo "<br />Excerpt ".$myExcerpt;
  echo "<br />Excerpt ".$post->post_content;
  echo "<br />Content ".$post->post_content;
  echo "<br />Title ".$post->post_title;
}
add_action( 'wp_head', 'my_facebook_tags' );

请尝试让我知道。

相关问题