Skip to content

Commit

Permalink
Adicionar title no meta, e fix nos dados do termo.
Browse files Browse the repository at this point in the history
  • Loading branch information
elvishp2006 committed Nov 8, 2018
1 parent 836b0f9 commit e8a7039
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Funciona tanto para os post_types, quanto para as taxonomias.
"image": false
},
"meta": {
"title": "Olá, mundo! - WordPress DEV",
"description": "Bem-vindo ao WordPress. Esse é o seu primeiro post. Edite-o ou exclua-o, e então comece a escrever!"
}
},
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apiki/wordpress-seo-rest",
"description": "Show in JSON REST params configured in yoast (meta-title, meta-description, facebook, twitter)",
"version": "1.2.3",
"version": "1.2.4",
"type": "wordpress-plugin",
"license": "GPL-2.0",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordpress-seo-rest",
"version": "1.2.3",
"version": "1.2.4",
"description": "Show in JSON REST params configured in yoast (meta-title, meta-description, facebook, twitter)",
"main": "wordpress-seo-rest.php",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/Model/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

class Meta extends Social
{
public function get_title()
{
return trim( apply_filters( 'wpseo_meta_title', parent::get_title() ) );
}

public function get_description()
{
return trim( apply_filters( 'wpseo_meta_desc', parent::get_description() ) );
Expand All @@ -16,6 +21,7 @@ public function get_description()
public function get_array()
{
return array(
'title' => $this->get_title(),
'description' => $this->get_description(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Social.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function get_title()
$title = WPSEO_Meta::get_value( 'title', $this->post->ID );

if ( $title ) {
return $title;
return $this->get_replace_vars( $title, true );
}

return wpseo_replace_vars( $this->options[ 'title-' . $this->post->post_type ], $this->post );
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private function get_title( $prefix = 'opengraph' )
$meta = 'base' === $prefix ? 'wpseo_title' : "wpseo_{$prefix}-title";
$title = $this->metas[ $meta ];

if ( empty( $meta ) ) {
if ( empty( $title ) ) {
$title = $this->term['name'];
}

Expand All @@ -92,7 +92,7 @@ private function get_description( $prefix = 'opengraph' )
$meta = 'base' === $prefix ? 'wpseo_desc' : "wpseo_{$prefix}-description";
$description = $this->metas[ $meta ];

if ( empty( $meta ) ) {
if ( empty( $description ) ) {
$description = $this->term['description'];
}

Expand Down
2 changes: 1 addition & 1 deletion wordpress-seo-rest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: WordPress SEO REST
Version: 1.2.3
Version: 1.2.4
Author: @kassyn
Author URI: https://github.com/kassyn
Text Domain: wordpress-seo-rest
Expand Down

0 comments on commit e8a7039

Please sign in to comment.