npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dispofi-node-wordpress

v0.3.4

Published

posts wordpress pour node

Downloads

11

Readme

#dispofi-node-wordpress

Module pour intégration du CMS Wordpress sur le frontend

installation

$ npm install dispofi-node-wordpress

connexion

var dispofiNodeWordpress = require('dispofi-node-wordpress');

var numSite = 1;
var sql_connexion = {
  host: 'localhost',
  port: '3306',
  user: 'user',
  password: 'pass',
  database: ''
}

var dnw = dispofiNodeWordpress(numSite, sql_connexion);

principe

Le module comporte 5 fonctions principales qui permettent de récupérer les données au format JSON

  • loadPost -> récup un article et ses données liées
  • loadPosts -> récup les x derniers posts et leurs données liées (triés par date)
  • loadCategory -> récup une catégorie et ses données liées
  • loadCategories -> récup la liste de toutes les catégories
  • loadUser -> récup un auteur et ses données liées

loadPost

var id = 12;
var format = 'DD/MM/YYYY'; // momentjs

dnw.loadPost(id, format).then(function (post) {
    // titre du post
    console.log(post.post_title);
    
    // date du post au format donné
    console.log(post.post_date_fr);
    
    // url de l'image à la une
    console.log(post.data.thumbnail.url);

    // accès aux métas en fonction de leur meta_key
    console.log(post.data.metas._yoast_wpseo_metadesc);

    // accès aux catégories du post
    post.data.categories.forEach(function (category) {
    });

    // accès aux tags du post
    post.data.tags.forEach(function (category) {
    });

    // fils d'ariane -> slug de la catégorie parent
    console.log(post.data.ariane.category.slug)

    // fils d'ariane -> slug de la catégorie fille
    console.log(post.data.ariane.subcategory.slug)

}, function (error) {
    console.log(error);
});

## loadPosts # var limit = 5; // nombre de posts var order = 'ASC'; // desc par défaut

dnw.loadPosts(limit, order).then(function (posts) {
    posts.forEach(function (post) {
        // accès aux données de la même manière que pour loadPost
    });
}, function (error) {
    console.log(error);
});

loadCategory #

var slug = 'nom-de-la-category';
var type = 'category'; // facultatif (valeur par défaut : category) / autre valeur possible : post_tag

dnw.loadCategory(slug, type).then(function (category) {

    // nom et code de la catégorie
    console.log(category.name, category.slug)
    
    // liste des posts (et leurs données) d'une categorie
    category.data.posts.forEach(function (post) {
        // accès aux données de la même manière que pour loadPost
    });

    // fils d'ariane -> slug de la catégorie parent
    console.log(category.data.ariane.category.slug)

    // fils d'ariane -> slug de la catégorie fille
    console.log(category.data.ariane.subcategory.slug)
});

## loadCategories # dnw.loadCategories().then(function (categories) { categories.forEach(function (category) { // nom et code de la catégorie console.log(category.name, category.slug) }) });

loadUser

var name = 'admin';
dnw.loadUser(name).then(function (user) {
    // nom de l'auteur
    console.log(user.user_nicename);

    // metas de l'auteur
    console.log(user.data.metas.description);
});