1 / 12

WordPress Architecture

WordPress Architecture. Core files – PHP MySQL database Configured by the installation script wp-content directory themes subdirectory: layout plugins subdirectory: extensions uploads subdirectory: uploaded files Version updates relatively painless. Presentation: Choose a Theme.

wileym
Download Presentation

WordPress Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WordPress Architecture • Core files – PHP • MySQL database • Configured by the installation script • wp-content directory • themes subdirectory: layout • plugins subdirectory: extensions • uploads subdirectory: uploaded files • Version updates relatively painless

  2. Presentation: Choose a Theme Current Theme Default Themes 100’s available Administrator’s View

  3. Theme Architecture • Set of files installed in a subdirectory of wp-content/themes • Typical theme set includes • style.css and required images • PHP template files defining parts of the pages • header, footer, sidebar, comments • PHP template files defining entire pages • Runtime selection based on template hierarchy • Can also set page template when creating the page Administrator’s View

  4. Template Architecture • Not Smarty • But does serve to separate content generation from presentation • Dozens of predefined tags • Simple example: get_header() • Called “tags,” but most are functions • Example: list categories • list_cats() – 18 positional parameters • wp_list_cats() – arguments as name/value pairs Administrator’s View

  5. Editing Templates Administrator’s View

  6. Example template: page.php <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2> <?php the_content(__('Read the rest of this page &raquo;')); ?> <?php wp_link_pages(); ?> <?php edit_post_link(__('Edit'), '<p>', '</p>'); ?> <?php endwhile; endif; ?> <?php get_sidebar(); ?> <?php get_footer(); ?> Administrator’s View

  7. get_header • get_sidebar • the_title • the_content • edit_post_link • get_footer

  8. Digression: The Loop <?php if (have_posts()) : while (have_posts()) : the_post(); ?> …. <?php endwhile; endif; ?> • Applies to “WordPress Pages” as well as “pages” that display “WordPress Posts” • Many tags to control what happens inside • is_category() • is_page() • More conditional tags Administrator’s View

  9. Extensibility: Plugins Administrator’s View

  10. Sample Plugin: Hello, Dolly $lyrics = explode("\n", $lyrics); $chosen = wptexturize( $lyrics[ mt_rand(0, count($lyrics) ) ] ); function hello_dolly() { global $chosen; echo "<p id='dolly'>$chosen</p>"; } add_action('admin_footer', 'hello_dolly'); function dolly_css() { echo "<style type='text/css'> #dolly { … style attributes … } </style>"; } add_action('admin_head', 'dolly_css'); Administrator’s View

  11. Before activation After activation “Hello, Dolly” in action Administrator’s View

  12. Customizing Your SiteOther Options Quotes Links Calendar Book List RSS Feeds

More Related