As easy as 1, 2, 3!
Updated:
- Aug, 08, 2022 update
config
docs for npm 8+ - Jul 27, 2021 add private scopes
- Jul 22, 2021 add dist tags
- Jun 20, 2021 update for
--access=public
- Sep 07, 2020 update docs for
npm version
<?php | |
/* | |
PostsOrderedByMetaQuery class that extends WP_Query and sorts posts meta_key | |
Author: Mike Schinkel (http://mikeschinkel.com) | |
This example works, just drop into the root of your website and call directly. | |
Use the class in your plugins or themes. | |
See: http://stackoverflow.com/questions/4111255/how-to-sort-a-query-posts-function-by-custom-field-while-limiting-posts-by-ano |
<?php | |
/** | |
* Example for writing a WP plugin that adds a custom post type and flushes | |
* rewrite rules only once on initialization. | |
*/ | |
/** | |
* On activation, we'll set an option called 'my_plugin_name_flush' to true, | |
* so our plugin knows, on initialization, to flush the rewrite rules. | |
*/ |
// /usr/local/src/httpd-2.3.16-beta/support/ab -r -n 10000 -c 10 http://127.0.0.1:1327/ | |
var http = require('http'); | |
var sys = require('util') | |
var exec = require('child_process').exec; | |
var util = require('util'); | |
var cnt = 0; | |
<?php | |
/* | |
Plugin Name: Simple Post Views | |
Plugin URI: http://en.bainternet.info | |
Description: Simple And lightweight plugin to track post views. | |
Version: 0.2 | |
Author: Bainternet | |
Author URI: http://en.bainternet.info | |
*/ | |
if ( !class_exists('PostViews')){ |
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group | |
WP_ROOT=$1 # <-- wordpress root directory |
<form action="" enctype="multipart/form-data" method="post"> | |
<input id="file" name="file" type="file" /> | |
<input id="Submit" name="submit" type="submit" value="Submit" /> | |
</form> |
<?php | |
function sprintf_assoc( $string = '', $replacement_vars = array(), $prefix_character = '%' ) { | |
if ( ! $string ) return ''; | |
if ( is_array( $replacement_vars ) && count( $replacement_vars ) > 0 ) { | |
foreach ( $replacement_vars as $key => $value ) { | |
$string = str_replace( $prefix_character . $key, $value, $string ); | |
} | |
} | |
return $string; |
<?php | |
// Resuable instance of WP_Query with preset $args | |
class Extended_WP_Query extends WP_Query { | |
function __construct( $args = array() ) { | |
$args = wp_parse_args( $args, array( | |
// some $args go here for reuse | |
) ); | |
<?php | |
function sass_darken($hex, $percent) { | |
preg_match('/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i', $hex, $primary_colors); | |
str_replace('%', '', $percent); | |
$color = "#"; | |
for($i = 1; $i <= 3; $i++) { | |
$primary_colors[$i] = hexdec($primary_colors[$i]); | |
$primary_colors[$i] = round($primary_colors[$i] * (100-($percent*2))/100); | |
$color .= str_pad(dechex($primary_colors[$i]), 2, '0', STR_PAD_LEFT); | |
} |