GithubHelp home page GithubHelp logo

alikaptanoglu / wordpresssharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abrudtkuhl/wordpresssharp

0.0 1.0 0.0 2.81 MB

A C# client to to interact with the WordPress XML-RPC API

Home Page: abrudtkuhl.github.io/WordPressSharp/

License: GNU General Public License v3.0

C# 100.00%

wordpresssharp's Introduction

#WordPressSharp# A C# client to interact with the WordPress XML-RPC API

##Install## I'm working on a Nuget package once I'm done mapping all the WP XML-RPC endpoints.

In the meantime, you'll have to clone, build, and add the DLL the ole fashioned way

##Config## Use your config file to for configuration settings:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<appSettings>
		<add key="WordPressUsername" value="" />
		<add key="WordPressPassword" value="" />
		<add key="WordPressBaseUrl" value="" />
		<add key="WordPressBlogId" value="" />
	</appSettings>
</configuration>

As an alternative you can use the WordPressSiteConfig class to store configuration settings.

#Examples#

##Create Post##

using (var client = new WordPressClient()) 
{
    var post = new Post
    {
        PostType = "post",
        Title = "My Awesome Post",
        Content = "<p>This is the content</p>",
        PublishDateTime = DateTime.Now
    };

    var id = Convert.ToInt32(client.NewPost(post));
}

##Create Post Tag##

using (var client = new WordPressClient())
{
    var termId = client.NewTerm(new Term
    {
        Name = "term test",
        Description = "term description",
        Slug = "term_test",
        Taxonomy = "post_tag"
    });
}

##Add feature image## You can add a feature image by using the Data.CreateFromUrl or Data.CreateFromFilePath:

string url = "https://unsplash.imgix.net/photo-1423683249427-8ca22bd873e0";
using (var client = new WordPressClient()) 
{
    var post = new Post
    {
        PostType = "post",
        Title = "New photo from Unsplash",
        Content = "<p>Check out this new picture from Unsplash.</p>",
        PublishDateTime = DateTime.Now
    };
    
    var featureImage = Data.CreateFromUrl(url);
    post.FeaturedImageId = client.UploadFile(featureImage).Id;

    var id = Convert.ToInt32(client.NewPost(post));
}

#Tutorials# How to publish a post or page

#Dependencies# XML-RPC.net

#Resources# WordPress XML-RPC API

#Notes# Inspired by the POSSIBLE.WordPress.XmlRpcClient by markeverard

wordpresssharp's People

Contributors

abrudtkuhl avatar keescbakker avatar weltmeyer avatar raelyard avatar wakusei avatar florearobert avatar drussilla avatar adminx2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.