Tag: PHP
-
Principles of PHP
Here is a very short introduction to the principles of PHP. PHP is an acronym for “hypertext preprocessor”. PHP is a serverside language. We use PHP in order to prepare webpages, react to user input – and (on the third semester) to interact with databases. Many Open Source CMSs use a combination of Apache, PHP…
-
WordPress theme with Bootstrap
An excellent tutorial by Zac Gordon: “How to Build a Responsive WordPress Theme with Bootstrap”. You’ll learn to hack a WP theme from scratch with Bootstrap and jQuery enabled.
-
CSS i plugin
Dokumentationen på Codex er ikke lysende klar; men et plugin gør sådan: /* filters etc. */ add_action('wp_print_styles', 'add_hyperboard_stylesheet'); // (…) /*Required stylesheets */ function add_hyperboard_stylesheet() { $myStyleUrl = WP_PLUGIN_URL . '/hyperboard/styles.css'; $myStyleFile = WP_PLUGIN_DIR . '/hyperboard/styles.css'; if ( file_exists($myStyleFile) ) { wp_register_style('HyperBoardStyleSheets', $myStyleUrl); wp_enqueue_style( 'HyperBoardStyleSheets'); } } Pluginet sætter en krog i wp_print_styles.
-
Native admin tables i WordPress
Smashing Magazine (SM) har en artikel om at bruge WPs egen tabel-skaber-klasse til at skabe tabeller. Det giver en spændende funktionalitet. Læs “Create Native Admin Tables in WordPress”. Så vidt jeg kan se er artiklen i SM inspireret af dette plugin af Matt van Andel. På sitepoint findes en ganske hæderlig forklaring til udvikling af plugins…
-
Adgangskontrol i WP
Denne lille stump kode er meget nyttig: if ( !current_user_can( 'publish_posts' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } Her er WP listen over brugerrettigheder: user_can “Roles and Capabilities” på Codex. En række af WPs hooks skriver “capability”. Hvis fx en Contributor skal have adgang…