+ All Categories
Home > Technology > Accomplish It With Core: Sliders, Galleries and More

Accomplish It With Core: Sliders, Galleries and More

Date post: 22-Jan-2015
Category:
Upload: andy-stratton
View: 3,726 times
Download: 2 times
Share this document with a friend
Description:
Building custom theme/plugin functionality using powerful built-in core API's / libraries. Thinking about things in terms of core functionality and rolling your own.
Popular Tags:
79
Accomplish It With Core Sliders, Galleries & More. WordCamp San Diego 2012 #wcsd @theandystratton
Transcript
Page 1: Accomplish It With Core: Sliders, Galleries and More

Accomplish It With CoreSliders, Galleries & More.

WordCamp San Diego 2012#wcsd

@theandystratton

Page 2: Accomplish It With Core: Sliders, Galleries and More

Leveraging plugins?Custom themes or market-place...There are some common pitfalls.

Page 3: Accomplish It With Core: Sliders, Galleries and More

Missing features.Almost enough.

Close but not exact.

Page 4: Accomplish It With Core: Sliders, Galleries and More

Too many features.Bloated. Can be slow.

UX could overload user.

Page 5: Accomplish It With Core: Sliders, Galleries and More

Difficult to integrate.

Page 6: Accomplish It With Core: Sliders, Galleries and More

Painful user-experience.Some stray from core UI.

Some are confusing to use.

Page 7: Accomplish It With Core: Sliders, Galleries and More

Custom Theming?Even child-theming...

Page 8: Accomplish It With Core: Sliders, Galleries and More

Develop HTML/CSS/JS

SEPARATELY.Verifies browser compatibility.

Easy to troubleshoot later.

Page 9: Accomplish It With Core: Sliders, Galleries and More

Stay Organized.Quickly create theme files

from your HTML/CSS.

Page 10: Accomplish It With Core: Sliders, Galleries and More

Bundling Functionality:Traditional Plugins.

/mu-plugins/ Plugins.Library of auto-included code...

Page 11: Accomplish It With Core: Sliders, Galleries and More

Develop Faster:

Script will load all PHP files in your theme’s /lib/ directory

Keep related code together in well-named files.

Page 12: Accomplish It With Core: Sliders, Galleries and More
Page 13: Accomplish It With Core: Sliders, Galleries and More

What makes sense?Should the functionality transfer

to other themes?Is the functionality optional?

Page 14: Accomplish It With Core: Sliders, Galleries and More

Building Stuff.Marketing Sliders.Photo Galleries.

Press Releases & More...

Page 15: Accomplish It With Core: Sliders, Galleries and More

Context is Queen.Examples are common denominators.

Page 16: Accomplish It With Core: Sliders, Galleries and More

Your content should dictate the

functionality you build.

Page 17: Accomplish It With Core: Sliders, Galleries and More

Marketing Sliders.Typical in many business/sales sites.

Not just your blog posts.Promotions, teasers, and more.

Page 18: Accomplish It With Core: Sliders, Galleries and More

Banner/Image

Headline & TextLorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur porttitor tempor dui.

Call to Action/Button »1

2

3

What’s in a slide?

Page 19: Accomplish It With Core: Sliders, Galleries and More

Custom Post TypeThese pieces map perfectly to a custom post

type with minimal custom fields.

Page 20: Accomplish It With Core: Sliders, Galleries and More

Mapping Fields

Slide Data Custom Post TypeBanner/Image Featured ImageHeadline Post TitleText Post ContentCall to Action Text Custom Field or Post ContentCall to Action URL Custom Field or Post ContentSlide Order Menu OrderDisplay/Hide Publish Status*

* We could use a custom taxonomy

Page 21: Accomplish It With Core: Sliders, Galleries and More

Custom CodeNerd Alert.

Page 22: Accomplish It With Core: Sliders, Galleries and More

Register thepost type.

Page 23: Accomplish It With Core: Sliders, Galleries and More

There’s a lot moreyou can do with

Custom Post Types.See Jared’s presentation later!

Page 24: Accomplish It With Core: Sliders, Galleries and More

Add ameta box.

Page 25: Accomplish It With Core: Sliders, Galleries and More

Output themeta form.

Page 26: Accomplish It With Core: Sliders, Galleries and More

Handle savingmeta on save_post.

Page 27: Accomplish It With Core: Sliders, Galleries and More

1

2

3

Page 28: Accomplish It With Core: Sliders, Galleries and More

1

2

3

Featured ImageWill be used in our markup as the slide background/banner image.

Page 29: Accomplish It With Core: Sliders, Galleries and More

1

2

3

Headline/TextPost title and content used for the

headling/text of the slide.

Page 30: Accomplish It With Core: Sliders, Galleries and More

1

2

3

Call to ActionCustom fields managed via meta box UI for better user experience for our non-tech business users.

Page 31: Accomplish It With Core: Sliders, Galleries and More

Pulling SlidesIt’s as easy as get_posts().

Page 32: Accomplish It With Core: Sliders, Galleries and More

Handle savingon save_post.

Pulling ourcustom slides.

Page 33: Accomplish It With Core: Sliders, Galleries and More

Custom TaxonomyWe could push this even further by assigning

context (tag/category).

Page 34: Accomplish It With Core: Sliders, Galleries and More

Creating a generic taxonomy.

Page 35: Accomplish It With Core: Sliders, Galleries and More

General TaxonomyAssigning to all our post types allows us to

assign context and relate things.

Page 36: Accomplish It With Core: Sliders, Galleries and More

Pulling our slides via wcsd-content-tag

Page 37: Accomplish It With Core: Sliders, Galleries and More

Contextual UsesRelate other post types to posts/pages

e.g. quotes, testimonials, press releases, slides

Page 38: Accomplish It With Core: Sliders, Galleries and More

Real WorldPage-specific sliders

QuotesStatistics

Page 39: Accomplish It With Core: Sliders, Galleries and More
Page 40: Accomplish It With Core: Sliders, Galleries and More

Slide Post TypeSelected by Content Tag or

individually via custom meta UI

Page 41: Accomplish It With Core: Sliders, Galleries and More

Statistic Post TypeUp to 8 pulled based on

Content Tag(s)

Page 42: Accomplish It With Core: Sliders, Galleries and More

Quote Post TypeSpecial widget, pulls quote

based on Content Tag(s)

Page 43: Accomplish It With Core: Sliders, Galleries and More

Contact DataWidget output based on matching Content Tag

for location (defaults to general if no tags match)

Page 44: Accomplish It With Core: Sliders, Galleries and More

Photo GalleriesOf course: the Gallery API/shortcode.

Page 45: Accomplish It With Core: Sliders, Galleries and More

But What If?You’ve got custom HTML/CSS already.You can’t duplicate it with [gallery].

Page 46: Accomplish It With Core: Sliders, Galleries and More

Use/Hack Plugins?Could be bloated code.

Could be insecure.Could take longer.

Page 47: Accomplish It With Core: Sliders, Galleries and More

Image Attachments.They’re a post type.You can query ‘em.

You can do anything with ‘em.

Page 48: Accomplish It With Core: Sliders, Galleries and More

Galleries of Galleries.Photo Galleries parent page can

list all child pages (galleries).Can display photos via templates or

quick call shortcode API.

Page 49: Accomplish It With Core: Sliders, Galleries and More

Pulling Gallery Pages

Page 50: Accomplish It With Core: Sliders, Galleries and More

Pulling Gallery Pages

// Loop through $galleries and use// get_the_post_thumbnail($id, ‘size’);// to pull the featured image

// Output with your custom markup!

Page 51: Accomplish It With Core: Sliders, Galleries and More

Pulling Gallery Pages

// Example Source

Page 52: Accomplish It With Core: Sliders, Galleries and More

Pulling Gallery Pages// Example Source

// See page-gallery.php

Page 53: Accomplish It With Core: Sliders, Galleries and More

What’s Possible?Screenshot time.

Page 54: Accomplish It With Core: Sliders, Galleries and More

page-galleries.php

Page 55: Accomplish It With Core: Sliders, Galleries and More

Gallery Thumb/PreviewFeatured image for child page.

page-galleries.php

Page 56: Accomplish It With Core: Sliders, Galleries and More

Gallery NamePost Title for child page.

page-galleries.php

Page 57: Accomplish It With Core: Sliders, Galleries and More

Gallery DescriptionPost Content for child page.

page-galleries.php

Page 58: Accomplish It With Core: Sliders, Galleries and More

page-gallery.php

Page 59: Accomplish It With Core: Sliders, Galleries and More

Image AttachmentsCustom markup calls lightbox.

page-gallery.php

Page 60: Accomplish It With Core: Sliders, Galleries and More

page-gallery.php

Page 61: Accomplish It With Core: Sliders, Galleries and More

Original Image URLwp_get_attachment_url( $id );

page-gallery.php

Page 62: Accomplish It With Core: Sliders, Galleries and More

CaptionCan be post_title, post_excerpt,

or post_content (Title, Caption, or Description)

page-gallery.php

Page 63: Accomplish It With Core: Sliders, Galleries and More

Why Do This?

Page 64: Accomplish It With Core: Sliders, Galleries and More

Custom Markup.

Page 65: Accomplish It With Core: Sliders, Galleries and More

Extended Behaviors.

Page 66: Accomplish It With Core: Sliders, Galleries and More

Anal Retentive.Complete control over client output.

Maximum UX/empowerment.

Page 67: Accomplish It With Core: Sliders, Galleries and More

Leverage Core UI.

Page 68: Accomplish It With Core: Sliders, Galleries and More

Leverage Core UI.

Page 69: Accomplish It With Core: Sliders, Galleries and More

More Attachments.PDF’s can be attached (e.g. press releases)

‘post_mime_type’ => ‘application/pdf’Anything, really.

Page 70: Accomplish It With Core: Sliders, Galleries and More

Wrap It Up.

Page 71: Accomplish It With Core: Sliders, Galleries and More

Sometimes you need

MOREFEATURESthan free plugins provide.

Page 72: Accomplish It With Core: Sliders, Galleries and More

Customizing plugins can be

MOREWORK

then using Core APIs.

Page 73: Accomplish It With Core: Sliders, Galleries and More

GET CREATIVEwith the free &

POWERFUL TOOLSyou’ve already got.

Page 74: Accomplish It With Core: Sliders, Galleries and More

Create usable & meaningful

EXPERIENCES.

Page 75: Accomplish It With Core: Sliders, Galleries and More

Core API’s keep you

COMPATIBLE.Upgrades / Environment / Security

Other Plugins

Page 76: Accomplish It With Core: Sliders, Galleries and More

Use

CONTEXTwhen solving problems.

What makes sense?

Page 77: Accomplish It With Core: Sliders, Galleries and More

Add

CONTEXTto your

CONTENTLike relating different types of content via taxonomy.

Page 78: Accomplish It With Core: Sliders, Galleries and More

Serve your users’

BEST INTERESTand you

CAN’T FAIL

Page 79: Accomplish It With Core: Sliders, Galleries and More

Gracias, amigos.


Recommended