WP Folder Structure. Η δομή των καταλόγων του wordpress. Τα plugins τοποθετονται στον κατλογο wp-content/plugins

Σχετικά έγγραφα
Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

SOAP API. Table of Contents

(C) 2010 Pearson Education, Inc. All rights reserved.

Στο εστιατόριο «ToDokimasesPrinToBgaleisStonKosmo?» έξω από τους δακτυλίους του Κρόνου, οι παραγγελίες γίνονται ηλεκτρονικά.

How to register an account with the Hellenic Community of Sheffield.

Οδηγίες Αγοράς Ηλεκτρονικού Βιβλίου Instructions for Buying an ebook

2 Composition. Invertible Mappings

VBA ΣΤΟ WORD. 1. Συχνά, όταν ήθελα να δώσω ένα φυλλάδιο εργασίας με ασκήσεις στους μαθητές έκανα το εξής: Version ΗΜΙΤΕΛΗΣ!!!!

Εγκατάσταση λογισμικού και αναβάθμιση συσκευής Device software installation and software upgrade

Δημιουργία Λογαριασμού Διαχείρισης Business Telephony Create a Management Account for Business Telephony

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

Section 8.3 Trigonometric Equations

The Nottingham eprints service makes this work by researchers of the University of Nottingham available open access under the following conditions.

derivation of the Laplacian from rectangular to spherical coordinates

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

SPEEDO AQUABEAT. Specially Designed for Aquatic Athletes and Active People

TaxiCounter Android App. Περδίκης Ανδρέας ME10069

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

PortSip Softphone. Ελληνικά Ι English 1/20

Galatia SIL Keyboard Information

ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΕΙΡΑΙΩΣ ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΠΜΣ «ΠΡΟΗΓΜΕΝΑ ΣΥΣΤΗΜΑΤΑ ΠΛΗΡΟΦΟΡΙΚΗΣ» ΚΑΤΕΥΘΥΝΣΗ «ΕΥΦΥΕΙΣ ΤΕΧΝΟΛΟΓΙΕΣ ΕΠΙΚΟΙΝΩΝΙΑΣ ΑΝΘΡΩΠΟΥ - ΥΠΟΛΟΓΙΣΤΗ»

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

Advanced Subsidiary Unit 1: Understanding and Written Response

OER Growers Blog. How to Post on the Blog. v2.0. Araksia Kantikian

The Simply Typed Lambda Calculus

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Instruction Execution Times

Οδηγίες χρήσης. Registered. Οδηγίες ένταξης σήματος D-U-N-S Registered στην ιστοσελίδα σας και χρήσης του στην ηλεκτρονική σας επικοινωνία

ΓΡΑΜΜΙΚΟΣ & ΔΙΚΤΥΑΚΟΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ

Ψηφιακή ανάπτυξη. Course Unit #1 : Κατανοώντας τις βασικές σύγχρονες ψηφιακές αρχές Thematic Unit #1 : Τεχνολογίες Web και CMS

Mean bond enthalpy Standard enthalpy of formation Bond N H N N N N H O O O

Κατανεμημένα Συστήματα. Javascript LCR example

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Website review lalemou.com

EE512: Error Control Coding

Οδηγίες χρήσης υλικού D U N S Registered

ΕΙΣΑΓΩΓΗ ΣΤΟN ΠΡΟΓΡΑΜΜΑΤΙΣΜΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΑΤΡΩΝ ΠΟΛΥΤΕΧΝΙΚΗ ΣΧΟΛΗ ΤΜΗΜΑ ΜΗΧΑΝΙΚΩΝ Η/Υ ΚΑΙ ΠΛΗΡΟΦΟΡΙΚΗΣ

WORDPRESS WORKSHOP. Child Themes. Κόκκορασ Φώτησ Τμήμα Μηχανικών Πληροφορικήσ TEI Θεςςαλίασ. Τμήμα Μηχανικών Πληροφορικής ΤΕΙ Θεσσαλίας

Math 6 SL Probability Distributions Practice Test Mark Scheme

Εργαστήριο 9. Styling with Javascript

Ρύθμιση σε whitelist

Statistical Inference I Locally most powerful tests

Special edition of the Technical Chamber of Greece on Video Conference Services on the Internet, 2000 NUTWBCAM

Οδηγός εκκαθάρισης ιστορικού cookies περιηγητή

Right Rear Door. Let's now finish the door hinge saga with the right rear door

Πώς μπορεί κανείς να έχει έναν διερμηνέα κατά την επίσκεψή του στον Οικογενειακό του Γιατρό στο Ίσλινγκτον Getting an interpreter when you visit your

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

Assalamu `alaikum wr. wb.

CYTA Cloud Server Set Up Instructions

Other Test Constructions: Likelihood Ratio & Bayes Tests

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

Web and HTTP. Βασικά Συστατικά: Web Server Web Browser HTTP Protocol

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

ΕΠΙΧΕΙΡΗΣΙΑΚΗ ΑΛΛΗΛΟΓΡΑΦΙΑ ΚΑΙ ΕΠΙΚΟΙΝΩΝΙΑ ΣΤΗΝ ΑΓΓΛΙΚΗ ΓΛΩΣΣΑ

ΔΗ Μ Ι Ο ΥΡ Γ Ι Α W I K I με τ η χρήση τ η ς υπ ηρεσίας h t t p : / id ot.com /

Ευτύχιος Βαβουράκης Σταύρος Καουκάκης

The municipality of Apokoronas has created a new app for your smart phone.

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

ΓΗΠΛΧΜΑΣΗΚΖ ΔΡΓΑΗΑ ΑΡΥΗΣΔΚΣΟΝΗΚΖ ΣΧΝ ΓΔΦΤΡΧΝ ΑΠΟ ΑΠΟΦΖ ΜΟΡΦΟΛΟΓΗΑ ΚΑΗ ΑΗΘΖΣΗΚΖ

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

Potential Dividers. 46 minutes. 46 marks. Page 1 of 11

Paper Reference. Paper Reference(s) 1776/04 Edexcel GCSE Modern Greek Paper 4 Writing. Thursday 21 May 2009 Afternoon Time: 1 hour 15 minutes

Areas and Lengths in Polar Coordinates

Approximation of distance between locations on earth given by latitude and longitude

ΣΗΜΑΝΤΙΚΗ ΑΝΑΚΟΙΝΩΣΗ ΓΙΑ ΤΗΝ ΔΙΕΘΝΗ ΕΚΘΕΣΗ VEHICLE AND ON-VEHICLE EQUIPMENTS FAIR

ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΜΕ ΤΟ ΚΙΤ ΡΟΜΠΟΤΙΚΗΣ LEGO MINDSTORMS EV3

Τμήμα Πολιτικών και Δομικών Έργων

Section 7.6 Double and Half Angle Formulas

ΤΕΧΝΟΛΟΓΙΚΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΝΟΣΗΛΕΥΤΙΚΗΣ

Ερώτηση και Αίτηση Κατάθεσης Εγγράφων Προς τον κ. Υπουργό Ανάπτυξης και Ανταγωνιστικότητας

Section 9.2 Polar Equations and Graphs

TMA4115 Matematikk 3

Business Opening. Very formal, recipient has a special title that must be used in place of their name

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΕΣΣΑΛΙΑΣ ΤΜΗΜΑ ΠΟΛΙΤΙΚΩΝ ΜΗΧΑΝΙΚΩΝ ΤΟΜΕΑΣ ΥΔΡΑΥΛΙΚΗΣ ΚΑΙ ΠΕΡΙΒΑΛΛΟΝΤΙΚΗΣ ΤΕΧΝΙΚΗΣ. Ειδική διάλεξη 2: Εισαγωγή στον κώδικα της εργασίας

Block Ciphers Modes. Ramki Thurimella

Εισαγωγή στη Βιοπληροφορική

Δομές Δεδομένων - Εργαστήριο 2. Λίστες

Homework 3 Solutions

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 5: Component Adaptation Environment (COPE)

Basic Missions

Areas and Lengths in Polar Coordinates

Συστήματα Διαχείρισης Βάσεων Δεδομένων

FSM Toolkit Exercises

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible.

Finite Field Problems: Solutions

ΔΕ10: Πληροφοριακά Συστήματα Διοίκησης IΙ Εργαστήριο # 2

Η ΕΕ εγκρίνει νέο πρόγραµµα για ασφαλέστερη χρήση του Ίντερνετ και διαθέτει 55 εκατ. ευρώ ώστε να καταστεί ασφαλές για τα παιδιά

Ψηφιακή ανάπτυξη. Course Unit #1 : Κατανοώντας τις βασικές σύγχρονες ψηφιακές αρχές Thematic Unit #1 : Τεχνολογίες Web και CMS

Πνευματική ιδιοκτησία και ιατρικά επιστημονικά έργα

4.6 Autoregressive Moving Average Model ARMA(1,1)

1. Αφετηρία από στάση χωρίς κριτή (self start όπου πινακίδα εκκίνησης) 5 λεπτά µετά την αφετηρία σας από το TC1B KALO LIVADI OUT

Logout Exit Print. Form Description Order Date Page Scanned

ΗY335: Δίκτυα Υπολογιστών Χειμερινό Εξάμηνο Τμήμα Επιστήμης Υπολογιστών Πανεπιστήμιο Κρήτης Διδάσκουσα: Μαρία Παπαδοπούλη

Εργαστήριο 7. Implementing and Deploying a PHP Web Application

«Δικτυακός τόπος της Βιβλιοθήκης του Μοσχάτου»

Transcript:

Wordpress Plugins

WP Folder Structure Η δομή των καταλόγων του wordpress Τα plugins τοποθετονται στον κατλογο wp-content/plugins απλό plugin: ένα php αρχείο πιο σύνθετο: κατάλογος (προτείνεται) καλό θα ήταν να υπάρχει και ένα readme.txt αρχείο κατάλογος και βασικό αρχείο καλό είνα να έχουν το ίδιο όνομα

Διαδικασία Φόρτωσης Τα plugins «φορτώνονται» πολύ νωρίς τυπική δομή: / /unique-plugin-name (no spaces or special characters) unique-plugin-name.php Primary plugin PHP file uninstall.php The uninstall file for your plugin /js Folder for JavaScript files /css Folder for stylesheet files /includes Folder for other PHP includes /images Folder for plugin images

Γράφοντας ενα Plugin Δημιουργία ενός php αρχείου με όνομα το επιθυμητό όνομα του plugin Οι πρώτες γραμμές πρέπει να είναι συγκεκριμένα σχόλια που αφορούν πληροφορίες για το plugin. <?php /* Plugin Name: 1WD Slider Plugin URI: http://1stwebdesigner.com/ Description: Slider Component for WordPress Version: 1.0 Author: Rakhitha Nimesh Author URI: http://1stwebdesigner.com/ License: GPLv2 or later */?>

WordPress Naming Conventions And Best Practices Στις μεταβλητές και τις συναρτήσεις καλό είναι να έχετε το δικό σας πρόθεμα (το πρόθεμα του plugin σας) Χρησιμοποιήστε τα κανονικά tags της php <?php?> Χρησιμοποιήστε {} σε όλα τα blocks Χρησιμοποιήστε και αποδοτικά και αποφύγετε τους escape characters στα, μέσα σε strings Αν κλείνετε τα php statements φροντίστε να μην αφήνετε κενά μετά. Αλλιώς μην κλείνετε τα php tags στο τέλος των αρχείων. Αφήνετε κενά μετά τα, και στους τελεστές WordPress Coding Standards http://codex.wordpress.org/wordpress_coding_standards https://make.wordpress.org/core/handbook/coding-standards/php/

Filters And Actions Βασικά στοιχεία του wordpress API Filters: functions στις οποίες το wordpress περνά δεδομένα, σε συγκεκριμένα σημεία εκτέλεσης, πριν γίνει κάποια ενέργεια στα δεδομένα. Κάθονται ανάμεσα στη βάση και τον browser. Actions: Ενεργοποιούνται από συγκεκριμένα γεγονότα που συμβαίνουν στο wordpress. Απαντούν σε αυτά τα γεγονότα εκτελώντας μια συνάρτηση.

Filters overwrite code Μπορούμε να αλλάξουμε μια μεταβλητή του wordpress ή το αποτλεσμα μιας function Επιδρά σε μεταβλητές στο page content the_content {content of your posts and pages} the_tags {applied to the tags retrieved from the database, prior to printing on the screen} the_title {applied to the post title retrieved from the database, prior to printing on the screen} wp_title {applied to the blog page title before sending to the browser in the wp_title function} {τι να αλλάξω} {τι να εκτελεσω} {προτεραιότητα} {# παραμέτρων} add_filter( $tag, $function_to_add, $priority, $accepted_args ); Plugin API/Filter Reference http://codex.wordpress.org/plugin_api/filter_reference apply_filters($tag, $value)

Actions (hooks) add code Μοιάζει με τα filters, αλλά εφαρμόζεται όταν γίνουν συγκεκριμένες ενέργειες: publish_post called when a post is published or when status is changed into published save_post called when a post/page is created from start or updated wp_head called when the template is loaded and runs the wp_head() function loop_end called immediately after the final post has been processed through the WordPress loop trackback_post called whenever a new trackback is added into a post... do_action( wp_head ); add_action( 'action_hook', 'your_function_name' ); Plugin API/Action Reference http://codex.wordpress.org/plugin_api/action_reference

Παράδειγμα <?php function hk_trim_content( $limit ) { $content = explode( ' ', get_the_content(), $limit ); if ( count( $content ) >= $limit ) { array_pop( $content ); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } has_action( $tag, $function_to_check ); $content = preg_replace('/\[.+\]/','', $content); $content = apply_filters('the_content', $content); return $content; }?> Making Your First Plugin https://www.udemy.com/blog/how-to-make-a-plugin/ <?php echo hk_trim_content(55); // display page content limited at 55 chars?>

Activation / Deactivation Μπορούμε να κάνουμε ενέργειεςα κατά την ενεργοποίηση / απενεργοποίηση του plugin Δημιουργία πινάκων στη βάση δεδομένων και διαγρα τους κατά την απενεργοποίηση Καθορισμός επιλογλων κατά την ενεργοποίηση και διαγραφή τους κατά την απανεργοποίηση Έλεγχος για άλλα προαπαιτούμενα plugin register_activation_hook() This hook allows you to create a function that runs when your plugin is activated. It takes the path to your main plugin file as the first argument, and the function that you want to run as the second argument. You can use this to check the version of your plugin, do some upgrades between versions, check for the correct PHP version and so on. register_deactivation_hook() The name says it all. This function works like its counterpart above, but it runs whenever your plugin is deactivated. I suggest using the next function when deleting data; use this one just for general housekeeping. register_uninstall_hook() This function runs when the website administrator deletes your plugin in WordPress back end. This is a great way to remove data that has been lying around, such as database tables, settings and what not. A drawback to this method is that the plugin needs to be able to run for it to work; so, if your plugin cannot uninstall in this way, you can create an uninstall.php file. Check out this function s documentation for more information.

Things to do... localization options styles debug http://codex.wordpress.org/debugging_in_wordpress widgets

Menus Menus and submenus <?php add_menu_page( page_title, menu_title, capability, menu_slug, function, icon_url, position );? > <?php add_submenu_page( parent_slug, page_title, menu_title, capability, menu_slug, function );? > The add_menu_page() function accepts the following parameters: page_title The title of the page as shown in the <title> tags menu_title The name of your menu displayed on the dashboard capability Minimum capability required to view the menu menu_slug Slug name to refer to the menu; should be a unique name function: Function to be called to display the page content for the item icon_url URL to a custom image to use as the Menu icon position Location in the menu order where it should appear

Widgets Widgets are a great way to give the users of your plugin an easy method to display your plugin information or data. WordPress features a Widgets API for creating and interacting with widgets. In this section you explore how to create widgets, add and save widget options, and display plugin information in the widget. Code https://drive.google. com/file/d/0b8ipe7cz3z8enegywuxveefiqke/view? usp=sharing

HTTP API wp_remote_ Functions wp_remote_get() wp_remote_post() wp_remote_head()

HTTP API response wp_remote_ Companion Functions wp_remote_retrieve_response_code() Returns just the response code (for example, 200) of an HTTP response wp_remote_retrieve_response_message() Returns just the response message (for example, OK ) wp_remote_retrieve_body() Returns the body of the response wp_remote_retrieve_headers() Returns all the headers of a server response wp_remote_retrieve_header() Returns just one particular header from a server response

Παράδειγμα <?php $url = http://www.example.com/bleh ; // Send GET request $response = wp_remote_get( $url ); // Check for server response if (is_wp_error($response)) { $code = $response->get_error_message(); wp_die( Requests could not execute. Error was:. $code); } // Check that the server sent a 404 Not Found HTTP status code if (wp_remote_retrieve_response_code($response) == 404) { wp_die( Link not found ); } // So far, so good echo Link found ;?>

Shortcodes // Extended subscription function with subscription type variable function subscribe_multilink_shortcode( $atts ) { extract( shortcode_atts( array( 'subtype' => 'RSS', 'subtypeurl' => 'http://feeds.feedburner. com/elegantthemes', ), $atts, 'multilink' ) ); return sprtinf( 'Be sure to subscribe to future Elegant Themes updates <a href='%1$s'>by %2$s</a>.', esc_url( $subtypeurl ), esc_html( $subtype ) ); } add_shortcode( 'subscribe', 'subscribe_multilink_shortcode' ); [subscribe] [subscribe subtype="twitter" subtypeurl="http://www. twitter.com/elegantthemes/"] [subscribe subtype="facebook" subtypeurl="http://www. facebook.com/elegantthemes/"] [subscribe subtype="google" subtypeurl="http://plus. google.com/+elegantthemes/"]