私のスペースに画像を追加する方法
WordPress
WordPress WordPress ...
WebWebWordPress WebWeb
jQuery WordPress
Web … orz
jQuery
WordPress
- WordPress
- WordPress
- WordPress
- jQuery
- WordPress Gallerific
1. WordPress
WordPress Ver 2.5
2. WordPress
:)
OK
[ gallery ]
OK
3. WordPress
w
- …
- XHTML …
…
XHTML
[ gallery itemtag="div" ]
…
4.
CSS
functions.php
functions.php
function remove_gallery_css() { return "
"; } add_filter('gallery_style', 'remove_gallery_css'); function fix_gallery_output( $output ){ $output = preg_replace("%
%", "", $output); /* br clear */ $output = preg_replace("%
%", "", $output); return $output; } add_filter('the_content', 'fix_gallery_output',11, 1);
$output = preg_replace("%
%", "", $output);
gallery-functions.php gallery-functions.php OK
/* */ [ gallery itemtag="li" icontag="span" captiontag="p" columns="0" ]
XHTML
XHTML
-
Caption #1
- ... ...
CSS :D
5.
size
"thumbnail", "medium", "large", "full" "thumbnail" "thumbnail", "medium", "large" > "medium"
[ gallery size="medium" ]
order
"ASC"
orderby
"menu_order ID" "RAND" order
itemtag
XHTML "dl"
icontag
XHTML "dt"
captiontag
XHTML "dd"
link
"file"
[ gallery link="file" ]
include
ID ID
rpgmaker 2000 EMポルトガル語を行うダウンロード
exclude
ID [ gallery exclude="21,32,43" ]
ID
include exclude include
ID URL &attachment_id=3595
CSS
6.
link
link="file"
lightbox
link="page"
- MIME_TYPE.php – image.php, video.php, audio.php, application.php, MIME type
- attachment.php
- single.php
- index.php
image.php MIME_TYPE.phpMIME_TYPE.php attachment.php single.php WordPress
MIME_TYPE.phpattachment.php single.php
single.php
…wp-includes media.php 500px
single.php the_content()
id)) { $att_image = wp_get_attachment_image_src( $post->id, "full-size"); ?>
is_attachment()the_content()
- echo $post->post_excerpt;
- echo $post->post_title;
- echo $post->post_content;
image.php attachment.php
image.php :) htmlOK
7. jQuery
jQuery
jQuery galleriffic
XHTML WordPress Gallerific
… orz
wp-includes media.php WordPress
functions.php XHTML
functions.php
/* */ remove_shortcode('gallery', 'gallery_shortcode'); /* */ add_shortcode('gallery', 'my_gallery_shortcode');
OK
gallery media.php :) functions.php media.php OK
携帯電話会社は、テキストメッセージのコピーを保持しない function my_gallery_shortcode($attr) { global $post, $wp_locale; static $instpe = 0; $instpe++; // Allow plugins/themes to override the default gallery template. $output = apply_filters('post_gallery', '', $attr); if ( $output != '' ) return $output; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if ( isset( $attr['orderby'] ) ) { $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); if ( !$attr['orderby'] ) unset( $attr['orderby'] ); } extract(shortcode_atts(array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '' ), $attr)); $id = intval($id); if ( 'RAND' == $order ) $orderby = 'none'; if ( !empty($include) ) { $include = preg_replace( '/[^0-9,]+/', '', $include ); $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( !empty($exclude) ) { $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); } else { $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); } if ( empty($attachments) ) return ''; if ( is_feed() ) { $output = "¥n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link($att_id, $size, true) . "¥n"; return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instpe}"; $output = apply_filters('gallery_style', " ¥n"; return $output; }
$output XHTML jQuery WordPress
functions.php WordPress jQuery gallery-functions.php
…
… orz :D
8. WordPress Gallerific
jQuery Gallerific WordPress
WordPressjQueryGalleriffic
8.1. Gallerific
Gallerific
Gallerific
HTML 5
"グラフィックアーティストは何をするか?" Example 2
Example 2
- css loader.gif
- css galleriffic-2.css
- js jquery.galleriffic.js
- js jquery.opacityrollover.js
Example 2 4jQuery WordPress
8.2
CSS Javascript WordPress functions.php
functions.php
/* JS */ if(!is_admin()){ function register_script(){ /* js */ wp_register_script('galleriffic', get_bloginfo('template_directory').'/js/jquery.galleriffic.js', array('jquery')); wp_register_script('opacity', get_bloginfo('template_directory').'/js/jquery.opacityrollover.js'); } function add_script(){ register_script(); if(is_page('gallery')){ wp_enqueue_script('galleriffic'); wp_enqueue_script('opacity'); } } add_action('wp_print_scripts','add_script',10); } /* CSS */ if(!is_admin()){ function add_my_stylesheet() { /* css */ wp_register_style('galleriffic-css', get_bloginfo('template_directory') . '/css/galleriffic.css'); if(is_page('gallery')){ wp_enqueue_style( 'galleriffic-css'); } } add_action('wp_print_styles', 'add_my_stylesheet'); }
if(is_page('gallery'))
gallery header.php wp_head() …
functions.php header.php
header.php
wp_head() wp_enqueue_script wp_enqueue_style Galleriffic WordPress
8.4. Galleriffic
WordPress [ gallery ]functions.php
functions.php
/* galleriffic */ add_shortcode('galleriffic', 'my_gallery_shortcode'); function my_gallery_shortcode($attr) { global $post, $wp_locale; static $instpe = 0; $instpe++; // Allow plugins/themes to override the default gallery template. $output = apply_filters('post_gallery', '', $attr); if ( $output != '' ) return $output; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if ( isset( $attr['orderby'] ) ) { $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); if ( !$attr['orderby'] ) unset( $attr['orderby'] ); } extract(shortcode_atts(array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => 'thumbnail', 'include' => '', 'exclude' => '' ), $attr)); $id = intval($id); if ( 'RAND' == $order ) $orderby = 'none'; if ( !empty($include) ) { $include = preg_replace( '/[^0-9,]+/', '', $include ); $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( !empty($exclude) ) { $exclude = preg_replace( '/[^0-9,]+/', '', $exclude ); $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); } else { $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); } if ( empty($attachments) ) return ''; if ( is_feed() ) { $output = "¥n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link($att_id, $size, true) . "¥n"; return $output; } $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instpe}"; $output = apply_filters('gallery_style', " "; } $output .= "
0 コメント:
コメントを投稿