accomplish it with core: sliders, galleries and more
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.TRANSCRIPT
![Page 1: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/1.jpg)
Accomplish It With CoreSliders, Galleries & More.
WordCamp San Diego 2012#wcsd
@theandystratton
![Page 2: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/2.jpg)
Leveraging plugins?Custom themes or market-place...There are some common pitfalls.
![Page 3: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/3.jpg)
Missing features.Almost enough.
Close but not exact.
![Page 4: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/4.jpg)
Too many features.Bloated. Can be slow.
UX could overload user.
![Page 5: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/5.jpg)
Difficult to integrate.
![Page 6: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/6.jpg)
Painful user-experience.Some stray from core UI.
Some are confusing to use.
![Page 7: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/7.jpg)
Custom Theming?Even child-theming...
![Page 8: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/8.jpg)
Develop HTML/CSS/JS
SEPARATELY.Verifies browser compatibility.
Easy to troubleshoot later.
![Page 9: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/9.jpg)
Stay Organized.Quickly create theme files
from your HTML/CSS.
![Page 10: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/10.jpg)
Bundling Functionality:Traditional Plugins.
/mu-plugins/ Plugins.Library of auto-included code...
![Page 11: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/11.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/12.jpg)
![Page 13: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/13.jpg)
What makes sense?Should the functionality transfer
to other themes?Is the functionality optional?
![Page 14: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/14.jpg)
Building Stuff.Marketing Sliders.Photo Galleries.
Press Releases & More...
![Page 15: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/15.jpg)
Context is Queen.Examples are common denominators.
![Page 16: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/16.jpg)
Your content should dictate the
functionality you build.
![Page 17: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/17.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/18.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/19.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/20.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/21.jpg)
Custom CodeNerd Alert.
![Page 22: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/22.jpg)
Register thepost type.
![Page 23: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/23.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/24.jpg)
Add ameta box.
![Page 25: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/25.jpg)
Output themeta form.
![Page 26: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/26.jpg)
Handle savingmeta on save_post.
![Page 27: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/27.jpg)
1
2
3
![Page 28: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/28.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/29.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/30.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/31.jpg)
Pulling SlidesIt’s as easy as get_posts().
![Page 32: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/32.jpg)
Handle savingon save_post.
Pulling ourcustom slides.
![Page 33: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/33.jpg)
Custom TaxonomyWe could push this even further by assigning
context (tag/category).
![Page 34: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/34.jpg)
Creating a generic taxonomy.
![Page 35: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/35.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/36.jpg)
Pulling our slides via wcsd-content-tag
![Page 37: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/37.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/38.jpg)
Real WorldPage-specific sliders
QuotesStatistics
![Page 39: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/39.jpg)
![Page 40: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/40.jpg)
Slide Post TypeSelected by Content Tag or
individually via custom meta UI
![Page 41: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/41.jpg)
Statistic Post TypeUp to 8 pulled based on
Content Tag(s)
![Page 42: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/42.jpg)
Quote Post TypeSpecial widget, pulls quote
based on Content Tag(s)
![Page 43: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/43.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/44.jpg)
Photo GalleriesOf course: the Gallery API/shortcode.
![Page 45: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/45.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/46.jpg)
Use/Hack Plugins?Could be bloated code.
Could be insecure.Could take longer.
![Page 47: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/47.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/48.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/49.jpg)
Pulling Gallery Pages
![Page 50: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/50.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/51.jpg)
Pulling Gallery Pages
// Example Source
![Page 52: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/52.jpg)
Pulling Gallery Pages// Example Source
// See page-gallery.php
![Page 53: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/53.jpg)
What’s Possible?Screenshot time.
![Page 54: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/54.jpg)
page-galleries.php
![Page 55: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/55.jpg)
Gallery Thumb/PreviewFeatured image for child page.
page-galleries.php
![Page 56: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/56.jpg)
Gallery NamePost Title for child page.
page-galleries.php
![Page 57: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/57.jpg)
Gallery DescriptionPost Content for child page.
page-galleries.php
![Page 58: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/58.jpg)
page-gallery.php
![Page 59: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/59.jpg)
Image AttachmentsCustom markup calls lightbox.
page-gallery.php
![Page 60: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/60.jpg)
page-gallery.php
![Page 61: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/61.jpg)
Original Image URLwp_get_attachment_url( $id );
page-gallery.php
![Page 62: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/62.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/63.jpg)
Why Do This?
![Page 64: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/64.jpg)
Custom Markup.
![Page 65: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/65.jpg)
Extended Behaviors.
![Page 66: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/66.jpg)
Anal Retentive.Complete control over client output.
Maximum UX/empowerment.
![Page 67: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/67.jpg)
Leverage Core UI.
![Page 68: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/68.jpg)
Leverage Core UI.
![Page 69: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/69.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/70.jpg)
Wrap It Up.
![Page 71: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/71.jpg)
Sometimes you need
MOREFEATURESthan free plugins provide.
![Page 72: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/72.jpg)
Customizing plugins can be
MOREWORK
then using Core APIs.
![Page 73: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/73.jpg)
GET CREATIVEwith the free &
POWERFUL TOOLSyou’ve already got.
![Page 74: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/74.jpg)
Create usable & meaningful
EXPERIENCES.
![Page 75: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/75.jpg)
Core API’s keep you
COMPATIBLE.Upgrades / Environment / Security
Other Plugins
![Page 76: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/76.jpg)
Use
CONTEXTwhen solving problems.
What makes sense?
![Page 77: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/77.jpg)
Add
CONTEXTto your
CONTENTLike relating different types of content via taxonomy.
![Page 78: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/78.jpg)
Serve your users’
BEST INTERESTand you
CAN’T FAIL
![Page 79: Accomplish It With Core: Sliders, Galleries and More](https://reader034.vdocument.in/reader034/viewer/2022051818/54c0d31c4a7959eb128b4570/html5/thumbnails/79.jpg)
Gracias, amigos.