Blog - page 3

1 2 3 4 5 6


Useful Javascript Helpers

After writing tones of code you’ll get bored to write the same (helper)functions over and over again for each new project. Functions to short tables, scroll to top, detect mouse position, show pop-up boxes and more are very useful on each public project. I’m not giving you optimized code here, instead I’m showing some basic stuff in order to get inspiration! It is better in my opinion not to use jQuery but for the sake of simplicity I’ll use this library here.

At the bottom of this article I referance some great articles with great javascipt helper functions.

Continue reading “Useful Javascript Helpers”


PHP Classes – Oblects notes

Object oriented programming logic is very usefull if you want your code to reach your imagination limits. OOP helps your code to extend easier and at the same time helps your scripts to be cleaner, reusable, and saperated according to the logic you choose. Much stuff here is taken from the official php manual paraphrased and summarized by me in an efford to create a quick guide to PHP classes and objects. Most of the examples are mine and I tried to make them playful and educational.

Continue reading “PHP Classes – Oblects notes”


$wpdb Class notes

WordPress Logo Symbol
Methods in the wpdb() class should not be called directly. Use the global $wpdb object instead.
$wpdb object can talk to any number of tables but only to one database.(*hyperdb)
Some of the methods in this class require from you to escape all untrusted values you incorporate.
$wpdb -> get_var(‘query’, column_offset, row_offset)
$wpdb -> get_row( ‘query’, output_type, row_offset )
$wpdb -> get_col( ‘query’, column_offset )
$wpdb -> get_results( ‘query’, output_type )
$wpdb -> insert( $table, $data, $format )
$wpdb -> replace( $table, $data, $format )
$wpdb -> update( $table, $data, $where, $format=null, $where_format=null )
$wpdb -> delete( $table, $data, $where_format=null )
$wpdb -> query( ‘query’ )
$wpdb -> get_col_info( ‘type’, offset )
$wpdb -> show_errors()
$wpdb -> hide_errors()
$wpdb -> print_error()

Continue reading “$wpdb Class notes”


WP Settings Api notes

settings control panel

The Settings API, lets you define settings pages, sections within those pages, and fields within the sections.

The form posts to wp-admin/options.php which provides strick capabilities checking and users will need to ‘manage_options’ capability to submit the form.

These are my quick notes for personal use, and they only resume the official wp codex.

Setting API functions

register_setting( $option_group, $option_name , $sanitize_callback )
unregister_setting( $option_group, $option_name , $sanitize_callback )
add_settings_field( $id, $title, $callback, $page, $section, $args )
add_settings_section( $id, $title, $callback, $page )
setting_fields( $option_group )
do_settings_sections( $page )
do_settings_fields( $page, $section )
add_settings_error( $setting, $code, $message, $type )
get_settings_errors( $settings, $sanitize )
settings_errors( $setting, $sanitize, $hide_on_update )

Continue reading “WP Settings Api notes”