Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ciprian Popescu wolffe

🏠
Working from home
Block or report user

Report or block wolffe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View script.php
<?php
function my_plugin_enqueue_scripts() {
wp_enqueue_script('my-plugin', plugins_url('/assets/js/init.js', __FILE__), [], '', true);
wp_localize_script('my-plugin', 'myAjaxVar', [
'ajaxurl' => admin_url('admin-ajax.php'),
'url' => 'https://ckp.ie'
]);
}
add_action('wp_enqueue_scripts', 'my_plugin_enqueue_scripts');
@wolffe
wolffe / activate.php
Created Mar 21, 2017 — forked from eteubert/activate.php
WordPress: Find Users by Last Login Activity
View activate.php
<?php
register_activation_hook( __FILE__, 'add_last_activity_for_all_users' );
function add_last_activity_for_all_users() {
global $wpdb;
$sql = $wpdb->prepare( "
SELECT
u.ID
FROM
$wpdb->users AS u
@wolffe
wolffe / anonymous.php
Created Mar 21, 2017 — forked from eteubert/anonymous.php
WordPress: Thoughts on Filtering by Time
View anonymous.php
<?php
$age_filter = function ( $where = '' ) use ( $options ) {
$where .= " AND post_date > '" . date( 'Y-m-d', strtotime( '-' . $options[ 'max_post_age' ] ) ) . "'";
return $where;
};
add_filter( 'posts_where', $age_filter );
$query = new WP_Query( $args );
remove_filter( 'posts_where', $age_filter );
@wolffe
wolffe / Pagination.php
Last active Sep 1, 2017
Pagination class for custom WordPress tables
View Pagination.php
<?php
/*
* Pagination class for WordPress 4.7+ and PHP 7+
*/
class Pagination {
var $total_pages = -1;
var $limit = 20;
var $target = '';
var $page = 1;
var $adjacents = 1;
View chip-scan.php
<html>
<head>
<title>Find String</title>
</head>
<body>
<?php
ini_set('max_execution_time', '0');
ini_set('set_time_limit', '0');
find_files('.');
@wolffe
wolffe / functions-1424101035.php
Last active Aug 29, 2015
Numbered siblings (child page navigation)
View functions-1424101035.php
<?php
// the menu_order parameter has been added to account for custom page ordering
function numbered_siblings($link) {
global $post;
$siblings = get_pages('child_of=' . $post->post_parent . '&parent=' . $post->post_parent . '&sort_column=menu_order');
foreach($siblings as $key=>$sibling) {
if($post->ID == $sibling->ID) {
$ID = $key;
}
}
View functions-1391075201.php
<?php
// add a shortcode to place on the submission page (or post)
add_shortcode('videowizard', 'videowizard_main'); // shortcode, function
// create attachments column
function videodjin_custom_column($column_name, $post_id) {
global $wpdb;
if($column_name == 'attachments') {
$query = "SELECT post_title, ID FROM $wpdb->posts WHERE post_type='attachment' AND post_parent='$post_id'";
$attachments = $wpdb->get_results($query);
@wolffe
wolffe / butterflies.css
Last active Dec 30, 2015
CSS normalization addon (fonts, box sizing and hardware acceleration).
View butterflies.css
* {
/**
* Improve font rendering and readability/legibility on MacOS and Windows
*/
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-moz-font-feature-settings: "liga=1, dlig=1";
@wolffe
wolffe / functions-1373297449.php
Created Jul 8, 2013
This function emulates WordPress wpautop() function for custom PHP scripts, parses URL addresses and adds smilies/emoticons.
View functions-1373297449.php
<?php
function smilieMe($text) {
$smiliesFind = array(
'/:\)/',
'/:P/',
'/:D/',
'/:S/',
'/:\(/',
'/:8/',
'/:tea/',
@wolffe
wolffe / wpf-guestinfo.php
Created Jul 1, 2013
Mingle Forum Guest Info allows you to enable guest posts to Mingle Forum without registration while still collecting contributor's email info. This version is an update from the original, outdated 1.0.1.
View wpf-guestinfo.php
<?php
/*
Plugin Name: Mingle Forum Guest Info
Plugin URI: http://wpweaver.info/plugins/
Description: This is an add on to the Mingle Forum. It allows you allow geust posts without registration while requiring a name and e-mail to make posts easier to track.
Version: 1.0.2
Author: Bruce Wampler
Author URI: http://wpweaver.info
Text Domain: mingleforumguest
Copyright: 2009-2011, Bruce Wampler
You can’t perform that action at this time.