Skip to content

gbaptista/magic-posts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic Posts 0.0.8

WordPress Plugin: Create Custom Post Types and Custom Fields with scaffolds.

Download: http://wordpress.org/extend/plugins/magic-posts/

Scaffolding

Custom Post Types

'Singular Term' description:mini-editor
Product Price:string 'In Stock':string Shipping:string Description:editor
'Travel Album' photos:gallery
Celebrity Profile:image[200x200:crop] Album:gallery[150x150:crop, 800x600, 1024x768]
Article editor:true

All WordPress Default Posts

[post] Photos:gallery

All WordPress Default Pages

[page] Illustration:image Credits:string

Post ID, Page ID or Custom Post Type ID

[378] Name:string Profile:image

Retrieving Data

Article Name:string

Current Post

<h4><?php echo magic_posts('Name'); ?></h4>

Post ID

<h4><?php echo magic_posts(137, 'Name'); ?></h4>

Retrieving Images

Travel Album:gallery[150x150:crop, 800x600, 1024x768] Profile:image[200x200:crop]

Current Post

<?php $image = magic_posts('Profile'); ?>
 
<img src="<?php echo $image->url('200x200:crop'); ?>" alt="<?php echo $image->alt(); ?>" />
<?php foreach(magic_posts('Album') as $image) { ?>

  <a target="_blank" href="<?php echo $image->url('800x600'); ?>">
    <img src="<?php echo $image->url('150x150:crop'); ?>" alt="<?php echo $image->alt(); ?>" />
  </a>

  <br />

<?php } ?>

Post ID

$image = magic_posts(169, 'Profile');
foreach(magic_posts(169, 'Album') as $image)

Image Data Reference

Travel Profile:image Album:gallery
$image = magic_posts('Profile');
foreach(magic_posts('Album') as $image)
echo $image->url() . '<br />';

echo $image->url('800x600') . '<br />';

echo $image->url('100x100:crop') . '<br />';

echo $image->id() . '<br />';

echo $image->title() . '<br />';

echo $image->legend() . '<br />';

echo $image->alt() . '<br />';

echo $image->description() . '<br />';

print_r($image->post());

echo $image->post('ID') . '<br />';
/*
 All [post] attributes:
   ID, post_author, post_date, post_date_gmt, post_content, post_title,
   post_excerpt, post_status, comment_status, ping_status, post_password,
   post_name, to_ping, pinged, post_modified, post_modified_gmt,
   post_content_filtered, post_parent, guid, menu_order, post_type,
   post_mime_type, comment_count, filter
*/

print_r($image->post_meta());

echo $image->post_meta('_wp_attachment_image_alt') . '<br />';
/*
 All [post_meta] attributes:
   _wp_attached_file, _wp_attachment_metadata,
   _wp_attachment_image_alt, _edit_lock
*/

print_r($image->metadata());

echo $image->metadata('height') . '<br />';
/*
 All [metadata] attributes:
   width, height, file, sizes, image_meta
*/

print_r($image->image_meta());

echo $image->image_meta('focal_length') . '<br />';
/*
 All [image_meta] attributes:
   aperture, credit, camera, caption, created_timestamp,
   copyright, focal_length, iso, shutter_speed, title
*/

Migrations

'Old Post Type' => 'New Post Type'

'Post Type' ['Old Field' => 'New Field', 'Old FieldB' => 'New FieldB']

[136] [OldField => NewField]

[post] [TheOldField => 'My NewField']

[page] ['My OldField' => TheNewField]

Command Reference

Command Description
title:false Disable WordPress Title. default:true
editor:true Enable WordPress Editor. default:false
'My Field':string Text field.
'My Field':text Textarea field.
'My Field':editor Custom Wordpress Editor.
'My Field':mini-editor Custom Wordpress Mini-Editor (teeny).
'My Field':image Unique image from Media Library.
'My Field':image[100x100:crop, 800x600] Unique image custom sizes.
'My Field':gallery Multiple images from Media Library.
'My Field':gallery[80x70:crop, 500x400, 10x20:crop] Multiple images custom sizes.

Custom Post Types Features

WordPress Post Feature Default
title true
editor false
author false
thumbnail false
excerpt false
trackbacks false
custom-fields false
comments false
revisions false
page-attributes false
post-formats false

Demos

Magic Posts Magic Posts Magic Posts Magic Posts

Online Demo: http://gbaptista.com/galeria-de-imagens/

About

WordPress Plugin: Create Custom Post Types and Custom Fields with scaffolds.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published