Skip to content

Instantly share code, notes, and snippets.

View manmar's full-sized avatar

Marko Manojlovic manmar

View GitHub Profile
// pen by Micah Godbolt: https://codepen.io/micahgodbolt/pen/FgqLc
equalHeightCols = function(container){
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(container).each(function() {
<?php
$name = Trim(stripslashes($_POST['name']));
$email = Trim(stripslashes($_POST['email']));
$message = Trim(stripslashes($_POST['message']));
// validation
$validationOK=true;
if (!$validationOK) {
@manmar
manmar / create-wp-admin-account.sql
Created September 29, 2015 11:33 — forked from azizur/create-wp-admin-account.sql
Create a WordPress Administrator user account using SQL
USE __DATABASE__;
SET @username = 'azizur';
SET @password = MD5('password');
SET @fullname = 'Azizur Rahman';
SET @email = 'azizur@example.com';
SET @url = 'http://azizur.com/';
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`) VALUES (@username, @password, @fullname, @email, @url, NOW(), '0', @fullname);
@manmar
manmar / widget-repeatable-fields.php
Created June 23, 2015 09:06
WP widget with dynamically added/repeatable fields
<?php
class Clients_Module_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'client_logos', // Base ID
__('Clients', 'text-domain'), // Name
array( 'description' => __( 'Our Clients - logo list', 'text-domain' ), ) // Args
);
@manmar
manmar / widget-image.php
Created June 23, 2015 08:53
Image module WP widget
<?php
class Image_Module_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'image_module_widget', // Base ID
__( 'Image module', 'text-domain' ), // Name
array( 'description' => __( 'Image module - full width image', 'text-domain' ), ) // Args
);
@manmar
manmar / widget-callout.php
Created June 23, 2015 08:43
A simple WordPress text widget
<?php
class Callout_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'callout_widget', // Base ID
__( 'Widget - Callout', 'text-domain' ), // Name
array( 'description' => __( 'A Simple Callout Widget', 'text-domain' ), ) // Args
);
@manmar
manmar / wp_media_upload.js
Created June 23, 2015 08:35
Use WordPress media uploader from custom meta fields or widgets
jQuery(document).ready(function($) {
var imageFrame;
$(document).on("click", ".upload_image_button", function() {
event.preventDefault();
var options, attachment;