diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4117f7cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# WordPress +wp-config.php +wp-content/uploads/ +wp-content/cache/ + +# Docker +.env.local + +# IDE +.vscode/ +.idea/ + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log +logs/ + +# Development +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +/vendor/ +.env +.env.example +docker-compose.yml diff --git a/admin/favorites-page.php b/admin/favorites-page.php new file mode 100644 index 00000000..dbd3d62b --- /dev/null +++ b/admin/favorites-page.php @@ -0,0 +1,202 @@ + + * @license GPL v2 or later + * @link https://github.com/gustavodscruz/wordpress-back-end-challenge + */ + +// Evita acesso direto +if (!defined('ABSPATH')) { + exit; +} +?> + +
+ +
+ +| + | + | + | + |
|---|---|---|---|
|
+
+
+ display_name); ?>
+
+
+ + ID: user_id; ?> + |
+
+
+
+ post_title); ?>
+
+
+ + + + + + + |
+ + date_favorited) + ); ?> + | ++ + + + | +
' . $message . '
+' . __('Você precisa estar logado para ver seus favoritos.', 'wp_backend_challenge') . '
'; + } + + $user_id = get_current_user_id(); + $favorites = $this->getUserFavorites($user_id); + + if (empty($favorites)) { + return '' . __('Você ainda não tem posts favoritos.', 'wp_backend_challenge') . '
+' . get_the_date('', $post->ID) . '
'; + } + + if ($atts['show_excerpt'] === 'true') { + $excerpt = wp_trim_words($post->post_content, 20); + $html .= '' . esc_html($excerpt) . '
'; + } + + $html .= ''; + $html .= '