Category: Programming

Home > Blog > ArchivesBlog > Programming

How To Copy Sub-site Media to Admin Site on Upload (WordPress Multisite)

July 16, 2014 by in category Programming, Wordpress tagged as , , , , ,

Jaysus, this one took me ages to understand. I spent so long doing all sorts of things to get it to work but in the end I think I’ve copped it. One important note though: do not remove the “restore_current_blog()” function at the end or move it within the if statement. You’ll end up in […]

0 1 Read more

How to add Custom Post Type menu to Admin Sub-menu WordPress

July 15, 2014 by in category Programming, Wordpress

After a lot of googling, I couldn’t find a solution to my problem. I finally figured it out and have decided to document it below. <?php define(“ICON_URL”, ‘/path/to/icons’); // First we sort out some submenu pages under our custom // menu page function my_add_submenu_pages() { add_submenu_page( ‘my-plugin’, __( ‘All Players’, ‘Players’ ), __( ‘All Players’, ‘Players’ […]

0 1 Read more

Multiple File Uploads In A WordPress Plugin

June 12, 2014 by in category PHP, Programming, Wordpress

In work today, I noticed a distinct lack of solutions for uploading multiple files through the ‘media_handle_upload’ function. Since it assumes that $_FILES is just the normal array of details, it isn’t really adaptable to multi-file uploads.   So, to get around this, you can de-make and re-make several $_FILE arrays and just feed them through the […]

0 1 Read more

How to connect to a MySQL database with PHP (Using MySQLi)

April 11, 2014 by in category PHP, Programming tagged as , , , , ,

(FYI: this example assumes you know some basic SQL) There are three main ways that you connect to a MySQL database using PHP: the original MySQL extension (function based), MySQL Improved (MySQLi – Object-oriented) and PHP Data Objects (PDO, Object-oriented). This little piece will be about using MySQLi to insert, update and get data from […]

0 0 Read more

Bash Profile

March 23, 2014 by in category Programming tagged as , , , ,

On linux machines, there are a couple aliases I like to make just so everything runs a little smother and a little prettier. To use these aliases, simply edit (via GUI or vi/nano/vim/etc.) “.profile” or “.bashrc”, save the changes and then use the command: . .profile   My bash profile: alias ls=”ls –color=auto” alias ll=”ls […]

0 0 Read more

PHP – Variables, Types and Operators

March 23, 2014 by in category PHP, Programming tagged as , , , , , , , , ,

What is a variable? A variable is like a custom-made box. It can only hold one thing at a time and youshould specify the type of thing you want to put in it when it’s being made.Each variable starts with a dollar sign ($) in PHP and can hold various types of data (e.g: strings (‘Hello’), […]

0 0 Read more

PHP – How to read the PHP documentation

March 23, 2014 by in category PHP, Programming tagged as , , , ,

A function is a list (or “block”) of instructions that can be “called” in a PHP script to execute them. How to use a function A function is, generally, a single word with capitalisation to show where two words were put together. e.g: <?php functionName(); ?> Some functions accept “arguments” inside the brackets which will […]

0 0 Read more
© Evan Smith 2009 - 2017