728x90
728x170
기본 : 'WordPressPCL' Nuget 패키지 설치
코드 내용
using WordPressPCL;
using WordPressPCL.Models;
namespace WordPressPCLTest
{
public partial class WordPressForm : Form
{
public WordPressForm()
{
InitializeComponent();
}
private async void getPostButton_Click(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
WordPressClient client = new WordPressClient("https://wordpress주소.kr/wp-json/");
IEnumerable<Post> postEnumerable = await client.Posts.GetAllAsync();
int i = 1;
foreach (Post post in postEnumerable.Reverse())
{
string title = post.Title.Rendered.Trim();
this.textBox1.Text += $"[{i.ToString("000")}] {title + Environment.NewLine}";
i++;
}
this.Cursor = Cursors.Default;
}
}
}
결과
728x90
그리드형
'C# > WordPress' 카테고리의 다른 글
[C#/WordPress] WordPress API - Post 수정하기 (0) | 2023.09.15 |
---|---|
[C#/WordPress] WordPress API - Post 구하기 (0) | 2023.09.13 |
[C#/WordPress] WordPress API - Post 삭제하기 (0) | 2023.09.12 |
[C#/WordPress] WordPress API - Post 쓰기 (0) | 2023.09.06 |
[링크] 10 Awesome WordPress Plugin (0) | 2023.01.25 |