Date post: | 17-May-2015 |
Category: |
Technology |
Upload: | mohammed-sahli |
View: | 2,768 times |
Download: | 0 times |
1 By Emran Omari
2
By Emran Omari
•WordPress is a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability. WordPress is both free and priceless at the same time. (wordpress team)
What is WordPress?
•WordPress, has emerged as a preferred platform for content production and continues to evolve to meet our ever-changing content needs. (wordpress bible)•WordPress is free, open source, and has fostered a giant community around it, you’ll always be in good hands. (digging into wordpress)
3
By Emran Omari
What I need to use it?•WordPress core (Wordpress.org or Ar-wp.com)•PHP version 4.3 or greater•MySQL version 4.1.2 or greater
Local Server (test environment)•Xampp•Wamp/Lamp•Camel(Arabic)
4
By Emran Omari
•Better for designers - templates make it far easier.•Better for developers - content in databases.•Better for site managers - publishing tools.•Better for visitors
Static vs dynamic sites.
5
By Emran Omari
Client-Side 4 Layers•Structure (Markup)=xHtml•Content =enclosed by markup•Presentation=CSS•Behavior = JavaScript
First Things First xHtml, CSS, JS and PHP
6
By Emran Omari
Functions generate Dynamic content and sub-markup using php and MySql
WordPress Core Themes-xHtml Markup-Css Presentation-Javascript behavior
7
By Emran Omari
WordPress Core (Database)1. wp_comments2. wp_commentmeta3. wp_links4. wp_posts5. wp_postmeta6. wp_terms7. wp_term_relationships8. wp_term_taxonomy9. wp_users10.wp_usermeta11.wp_options
1. wp_comments2. wp_commentmeta3. wp_links4. wp_posts5. wp_postmeta6. wp_terms7. wp_term_relationships8. wp_term_taxonomy9. wp_users10.wp_usermeta11.wp_options
8
By Emran Omari
WordPress Core (Structure)•Posts
•pages•Revisions•Attachement•Nav Menus• + our post types
•Links•Comments•Users
•Taxonomies•Categories•Tags•Link Categories•+ our taxonomies
9
By Emran Omari
Themes (Template Files)-index.php-style.css /* Theme Name: Rose
Theme URI: the-theme's-homepage Description: a-brief-descriptionAuthor: your-nameAuthor URI: your-URITemplate: parent-theme—optionalVersion: a-number—optional.General comments/License Statement if any. . */ /* Code Css */
=> Simple xhtml page + wp functions
10
11
By Emran Omari
Simple xhtml page
12
By Emran Omari
Short include tags<?php get_header(); ?> // header.php<?php get_footer(); ?> //footer.php<?php get_sidebar(); ?> //sidebar.php<?php comments_template(); ?> //comments.php<?php get_search_form(); ?> //searchform.php
<?php include (TEMPLATEPATH . '/file.php'); ?>
13
By Emran Omari
Header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head>
<title>Welcome</title><meta http-equiv="Content-Type" content="<?php
bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /><link rel='stylesheet' href='<?php bloginfo("stylesheet_url"); ?>' type='text/css' media='screen' />
<?php wp_enqueue_script('jquery'); ?><?php wp_head(); ?>
</head>
14
By Emran Omari
Header.php (dynamic title)
15
By Emran Omari
footer.php
<?php get_footer("lite"); ?> //footer-lite.php<?php get_footer("full"); ?>//footer-full.php
<div id="footer"><?php wp_footer(); ?>
</div></body></html>
16
By Emran Omari
sidebar.php
<?php get_sidebar(‘altern’); ?> //sidebar-altern.php
<div id="sidebar">*categories*pages*tags*Typed-taxonomies*static or dynamic adds*……….
</div>
17
By Emran Omari
wp_get_archives
<?php wp_get_archives(array('type' => 'postbypost', // or daily, weekly, monthly, yearly'limit' => 10, // maximum number shown'format' => 'html', // or select (dropdown), link, or custom'show_post_count' => false, // show number of posts per link'echo' => 1 // display results or return array
)); ?>
Old-school method
<?php wp_get_archives(“type=postbypost&limit=10” ); ?>
18
By Emran Omari
wp_tag_cloud
<?php wp_tag_cloud(array('smallest' => 10, // size of least used tag'largest' => 18, // size of most used tag'unit' => 'px', // unit for sizing'orderby' => 'name', // alphabetical'order' => 'ASC', // starting at A'exclude' => 6' // ID of tag to exclude from list'taxonomy' => 'post_tag' //name of typed taxonomy)); ?>
19
By Emran Omari
wp_list_categories
<?php wp_list_categories (array('orderby' => 'name', // alphabetical'order' => 'ASC', // starting at A'show_count' => 0, // do NOT show # of posts per cat'title_li' => __('Categories'), // include title list item'exclude' => 12, // ID of category to exclude'depth' => 0 // levels deep to go down cat tree)); ?>
20
By Emran Omari
wp_list_bookmarks
<?php wp_list_bookmarks(array('orderby' => 'name', // alphabetical'order' => 'ASC', // starting at A'limit' => -1, // unlimited, show ALL bookmarks'title_li' => __('Bookmarks'), // include list item title'title_before' => '<h2>', // tag before title'title_after' => '</h2>', // tag after title
)); ?>
21
By Emran Omari
Widgets (step 1)
<div id="sidebar"><?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) : ?>
*categories*pages*tags*Typed-taxonomies*static or dynamic adds*……….
<?php endif; ?></div>
22
By Emran Omari
Index.php<?php get_header(); ?>
*Content (the loop)<?php get_sidebar(); ?><?php get_footer(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); * post-by-postendwhile; else: * nothing foundendif;
?>
The loop
23
By Emran Omari
The loop<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2> <p>at <?php the_time('F jS, Y'); ?
> by <?php the_author(); ?></p> <?php the_content('Read Full
Article'); ?> <p><?php the_tags('Tags: ', ', ',
'<br />'); ?>Posted in <?php
the_category(', '); ?>| <?php
comments_popup_link('No Comments;', '1 Comment', '% Comments'); ?></p>
</div> <?php endwhile; ?> <?php next_posts_link('Older Entries'); ?> <?php previous_posts_link('Newer Entries'); ?> <?php else : ?><h2>Nothing Found</h2><?php endif; ?>
24
By Emran Omari
Inside The loop•$post (id, post_name, post_modified…)
•the_permalink() •the_ID() •the_author()•the_category()
OutSide The loop•next_posts_link(‘ ');•previous_posts_link(‘ ');•$query_stringposts_per_page=5&what_to_show=posts&orderby=date&order=DESC
25
26
By Emran Omari
Single.php (comment form)<?php
if (have_posts()) : while (have_posts()) : the_post(); * post-by-post?><div id="comment-box">
<?php comments_template(); ?> </div>
<?php endwhile; else: * nothing foundendif;
?>
Show Comments in multi post pages<?php $withcomments = 1; ?>
27
By Emran Omari
Comment LogicIs the post protected? (password required) Yes - display message and stop No - continueAre there any comments? Yes - Display them and continue No - don’t display anything and continueAre comments open? Yes – continue No - display message and stop
Is registration required? Yes - display message and stop No - display comment form
28
By Emran Omari
Customizing the Loop<?php
// The Query - Customize!
query_posts('showposts=5&cat=3');// The Loopif (have_posts()) : while
(have_posts()) : the_post();...endwhile; else:...endif;// Reset Querywp_reset_query();
?>
Add With preservequery_posts($query_string . '&showposts=6');
29
By Emran Omari
Multi Loops<?php
query_posts(array(
'cat': 2,
'posts_per_page': 7
));?>
<?php
query_posts(array(
'cat': -2,
'posts_per_page': 5
));?>
<?php
query_posts(array(
'cat': -2, 'offset': 5,
'posts_per_page': 5
));?>
<?php
query_posts(array(
'cat': -2, 'offset': 10,
'posts_per_page': 5
));?>
30
By Emran Omari
Other subjects to extend themes• Function.php• Register taxonomy• GD Custom Posts And Taxonomies Tools
• Custom Post Type UI• Register Post Type• Override wordpress functions• Page-templates• Custimize comments (delete & edit links)• shortcode (add_shortcode('home',
‘callBackStringFunctions');)• Conditional tags (is_single….)• Custom fileds (get_post_meta($post->ID,
‘nosidebar', true); )• Hooks, Actions and Filters (add_action,
add_filter)