SlideShare a Scribd company logo
WORDPRESS 
CUZTOM 
HELPER 
- A helper to make the life of Wordpress developers easier. 
_ Ante Primorac (@anteprimorac) 
_ Web Developer @ Slicejack 
_ 2nd WordPress Meetup Split
WHAT DO WE USE 
CUZTOM FOR? 
_ Post types 
_ Taxonomies 
_ Meta Boxes 
_ Post meta 
_ Term meta 
_ User meta
HOW TO USE CUZTOM? 
1 CLONE REPOSITORY TO INC/CUZTOM/ 
slicejack:inc ante$ git clone https://github.com/gizburdt/wp-cuztom.git cuztom 
2 CREATE CUZTOM.PHP AND LET THE MAGIC BEGIN 
<?php 
define( 'CUZTOM_TEXTDOMAIN', 'slicejack' ); 
define( 'CUZTOM_URL', get_template_directory_uri() . '/inc/cuztom' ); 
require( 'cuztom/cuztom.php' );
BOOKS LIBRARY 
1 CREATE CUSTOM POST TYPE - BOOK 
$books = new Cuztom_Post_Type( 'book', array( 
'has_archive' => true, 
'rewrite' => array( 
'slug' => 'books' 
), 
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ) 
) );
WordPress Cuztom Helper
BOOKS LIBRARY 
2 CREATE CUSTOM TAXONOMY - BOOK CATEGORY 
$book_category = new Cuztom_Taxonomy( 'Book Category', 'book' );
WordPress Cuztom Helper
BOOKS LIBRARY 
3 CREATE METABOX - INFO 
$books->add_meta_box( 
'info', 
'Info', 
array( 
array( 
'name' => 'author', 
'label' => 'Author', 
'type' => 'text' 
), 
array( 
'name' => 'date', 
'label' => 'Date', 
'type' => 'date' 
), 
array( 
'name' => 'price', 
'label' => 'Price', 
'type' => 'text' 
), 
array( 
'name' => 'number_of_pages', 
'label' => 'Number of pages', 
'type' => 'text' 
), 
array( 
'name' => 'bind_type', 
'label' => 'Bind type', 
'type' => 'select', 
'options' => array( 
'hardcover' => 'Hardcover', 
'double-wire' => 'Double wire', 
'spiral' => 'Spiral' 
), 
'default_value' => 'hardcover' 
), 
array( 
'name' => 'size', 
'label' => 'Size', 
'type' => 'select', 
'options' => array( 
'a5' => 'A5', 
'a4' => 'A4', 
'a3' => 'A3' 
), 
'default_value' => 'a4' 
) 
) 
);
FIELD TYPES 
_ text - a simple text field 
_ textarea - a large textarea for multiple lines of text 
_ checkbox - a simple boolean entry 
_ yesno - allows choice of yes/no (pre-made extension of radio) 
_ select - combo box selection 
_ multi_select - multi select selection 
_ checkboxes - a checkbox group 
_ radios - a radio group 
_ wysiwyg - an editor with the same controls as the standard WordPress editor 
_ image - image upload box 
_ file - file upload box 
_ date - date selection 
_ datetime - date and time (hour+minutes) selection 
_ time - time (hour+minutes) selection 
_ color - color selection 
_ post_select - allows inner-post references via a combo-box 
_ post_checkboxes - allows inner-post references via a checkbox group 
_ term_select - allows category references via a combo-box 
_ term_checkboxes - allows category references via a checkbox group 
_ hidden - a hidden field (oſten used to store information not visible to the user).
WordPress Cuztom Helper
BOOKS LIBRARY 
4 TEMPLATE 
<div class="entry-content"> 
<?php 
$bind_types = array( 
'hardcover' => __( 'Hardcover', 'slicejack' ), 
'double-wire' => __( 'Double wire', 'slicejack' ), 
'spiral' => __( 'Spiral', 'slicejack' ) 
); 
$sizes = array( 
'a5' => __( 'A5', 'slicejack' ), 
'a4' => __( 'A4', 'slicejack' ), 
'a3' => __( 'A3', 'slicejack' ) 
); 
?> 
<strong><?php _e( 'Author:', 'slicejack' ); ?></strong> <?php echo get_post_meta( get_the_id(), 
'_info_author', true ); ?><br /> 
<strong><?php _e( 'Date:', 'slicejack' ); ?></strong> <?php echo date( 'd.m.Y.', 
get_post_meta( get_the_id(), '_info_date', true ) ); ?><br /> 
<strong><?php _e( 'Price:', 'slicejack' ); ?></strong> $<?php echo get_post_meta( get_the_id(), 
'_info_price', true ); ?><br /> 
<strong><?php _e( 'Number of pages:', 'slicejack' ); ?></strong> <?php echo 
get_post_meta( get_the_id(), '_info_number_of_pages', true ); ?><br /> 
<strong><?php _e( 'Bind type:', 'slicejack' ); ?></strong> <?php echo 
$bind_types[ get_post_meta( get_the_id(), '_info_bind_type', true ) ]; ?><br /> 
<strong><?php _e( 'Size:', 'slicejack' ); ?></strong> <?php echo 
$sizes[ get_post_meta( get_the_id(), '_info_size', true ) ]; ?> 
</div><!-- .entry-content -->
WordPress Cuztom Helper
FEATURED LIBRARY 
1 ADD METABOX TO PAGE TEMPLATE 
if ( is_admin() ) : 
$pid = 0; 
if( array_key_exists( 'post', $_GET ) ) 
$pid = $_GET['post']; 
elseif ( array_key_exists( 'post_ID', $_POST ) ) 
$pid = $_POST['post_ID']; 
$page_template = basename( get_post_meta( $pid, '_wp_page_template', true ) ); 
if ( 'featured-library.php' == $page_template ) : $cpage = new Cuztom_Post_Type( 'page' ); 
$cpage 
->remove_post_type_support( array( 'editor', 'thumbnail' ) ) 
->add_meta_box( 
'library', 
'Library', 
array( 
'bundle', 
array( 
array( 
'name' => 'book', 
'label' => 'Book', 
'type' => 'post_select', 
'args' => array( 
'post_type' => 'book', 
'show_option_none' => 'None' 
) 
)
FEATURED LIBRARY 
2 PAGE TEMPLATE 
<?php 
// Start the Loop. 
while ( have_posts() ) : the_post(); 
?> 
<?php 
the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></ 
header><!-- .entry-header -->' ); 
?> 
<?php 
$library = get_post_meta( get_the_id(), '_library', true ); 
foreach( $library as $book ) : 
$post = get_post( $book['_book'] ); 
setup_postdata( $post ); 
get_template_part( 'book' ); 
endforeach; 
wp_reset_postdata(); 
endwhile; 
?>
CUSTOM FIELD TYPE 
1 CREATE YOURFIELD.CLASS.PHP AND SAVE IT TO 
<?php 
if( ! defined( 'ABSPATH' ) ) exit; 
class Cuztom_Field_Ip extends Cuztom_Field 
{ 
var $_supports_repeatable = true; 
var $_supports_bundle = true; 
var $_supports_ajax = true; 
var $css_classes = array( 'cuztom-input', 'cuztom-ip' ); 
function _output( $value ) 
{ 
$output = ''; 
$output .= '<input type="text" ' . $this->output_name() . ' ' . $this->output_id() . ' ' . 
$this->output_css_class() . ' value="' . ( ! empty( $value ) ? $value : '0.0.0.0' ) . '" />'; 
$output .= $this->output_explanation(); 
return $output; 
} 
INC/CUZTOM/CLASSES/FIELDS
CUSTOM FIELD TYPE 
1 CREATE YOURFIELD.CLASS.PHP AND SAVE IT TO 
function save_value( $value ) { 
return filter_var( $value, FILTER_VALIDATE_IP ) ? $value : '0.0.0.0'; 
} 
} 
INC/CUZTOM/CLASSES/FIELDS
CUSTOM FIELD TYPE 
2 INCLUDE FIELD TYPE CLASS 
private function includes() 
{ 
/*...*/ 
include( CUZTOM_DIR . 'classes/fields/ip.class.php' ); 
}
CONTRIBUTE ON GITHUB 
https://github.com/gizburdt/wp-cuztom
THANK 
YOU! 
_ Ante Primorac (@anteprimorac) 
_ Web Developer @ Slicejack 
_ 2nd WordPress Meetup Split
Ad

More Related Content

What's hot (20)

Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moose
thashaa
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
Vic Metcalfe
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012
xSawyer
 
OO Perl with Moose
OO Perl with MooseOO Perl with Moose
OO Perl with Moose
Nelo Onyiah
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
Jeff Carouth
 
WordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPressWordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPress
Alena Holligan
 
An (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to PythonAn (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to Python
Nicholas Tollervey
 
Wsomdp
WsomdpWsomdp
Wsomdp
riahialae
 
My sql presentation
My sql presentationMy sql presentation
My sql presentation
Nikhil Jain
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
Mike Whitaker
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
David Golden
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma Introdução
Ígor Bonadio
 
Smelling your code
Smelling your codeSmelling your code
Smelling your code
Raju Mazumder
 
(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit
Olaf Alders
 
Mkscript sh
Mkscript shMkscript sh
Mkscript sh
Ben Pope
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
Kris Wallsmith
 
PHP Tutorial (funtion)
PHP Tutorial (funtion)PHP Tutorial (funtion)
PHP Tutorial (funtion)
Tinnakorn Puttha
 
performance vamos dormir mais?
performance vamos dormir mais?performance vamos dormir mais?
performance vamos dormir mais?
tdc-globalcode
 
PHP 1
PHP 1PHP 1
PHP 1
Mohammed Abutabikh
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
anzhong70
 
Introduction to Moose
Introduction to MooseIntroduction to Moose
Introduction to Moose
thashaa
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
Vic Metcalfe
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012
xSawyer
 
OO Perl with Moose
OO Perl with MooseOO Perl with Moose
OO Perl with Moose
Nelo Onyiah
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
Jeff Carouth
 
WordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPressWordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPress
Alena Holligan
 
An (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to PythonAn (Inaccurate) Introduction to Python
An (Inaccurate) Introduction to Python
Nicholas Tollervey
 
My sql presentation
My sql presentationMy sql presentation
My sql presentation
Nikhil Jain
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
Mike Whitaker
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
David Golden
 
Ruby - Uma Introdução
Ruby - Uma IntroduçãoRuby - Uma Introdução
Ruby - Uma Introdução
Ígor Bonadio
 
(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit
Olaf Alders
 
Mkscript sh
Mkscript shMkscript sh
Mkscript sh
Ben Pope
 
Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)Introducing Assetic (NYPHP)
Introducing Assetic (NYPHP)
Kris Wallsmith
 
performance vamos dormir mais?
performance vamos dormir mais?performance vamos dormir mais?
performance vamos dormir mais?
tdc-globalcode
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
anzhong70
 

Similar to WordPress Cuztom Helper (20)

Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
Yusuke Wada
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress site
references
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
Adam Tomat
 
Dig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoDig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup Cairo
Mohamed Mosaad
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmd
iKlaus
 
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
allilevine
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
Pierre MARTIN
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
Tammy Hart
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An Analysis
Justin Finkelstein
 
WordPress as an application framework
WordPress as an application frameworkWordPress as an application framework
WordPress as an application framework
Dustin Filippini
 
Speed Things Up with Transients
Speed Things Up with TransientsSpeed Things Up with Transients
Speed Things Up with Transients
Cliff Seal
 
Quality code by design
Quality code by designQuality code by design
Quality code by design
WP Developers Club
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
Chris Wilcoxson
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
Kyle Cearley
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
camp_drupal_ua
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
Night Sailer
 
Lettering js
Lettering jsLettering js
Lettering js
davatron5000
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
Nate Abele
 
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Cliff Seal
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
Bradley Holt
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress site
references
 
[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018[WLDN] Supercharging word press development in 2018
[WLDN] Supercharging word press development in 2018
Adam Tomat
 
Dig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoDig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup Cairo
Mohamed Mosaad
 
Propel sfugmd
Propel sfugmdPropel sfugmd
Propel sfugmd
iKlaus
 
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
WordCamp Montreal 2015: Combining Custom Post Types, Fields, and Meta Boxes t...
allilevine
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
Pierre MARTIN
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
Tammy Hart
 
Open Source Search: An Analysis
Open Source Search: An AnalysisOpen Source Search: An Analysis
Open Source Search: An Analysis
Justin Finkelstein
 
WordPress as an application framework
WordPress as an application frameworkWordPress as an application framework
WordPress as an application framework
Dustin Filippini
 
Speed Things Up with Transients
Speed Things Up with TransientsSpeed Things Up with Transients
Speed Things Up with Transients
Cliff Seal
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
Chris Wilcoxson
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
Kyle Cearley
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
camp_drupal_ua
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
Night Sailer
 
The Zen of Lithium
The Zen of LithiumThe Zen of Lithium
The Zen of Lithium
Nate Abele
 
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Temporary Cache Assistance (Transients API): WordCamp Birmingham 2014
Cliff Seal
 
Ad

Recently uploaded (20)

IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Ad

WordPress Cuztom Helper

  • 1. WORDPRESS CUZTOM HELPER - A helper to make the life of Wordpress developers easier. _ Ante Primorac (@anteprimorac) _ Web Developer @ Slicejack _ 2nd WordPress Meetup Split
  • 2. WHAT DO WE USE CUZTOM FOR? _ Post types _ Taxonomies _ Meta Boxes _ Post meta _ Term meta _ User meta
  • 3. HOW TO USE CUZTOM? 1 CLONE REPOSITORY TO INC/CUZTOM/ slicejack:inc ante$ git clone https://github.com/gizburdt/wp-cuztom.git cuztom 2 CREATE CUZTOM.PHP AND LET THE MAGIC BEGIN <?php define( 'CUZTOM_TEXTDOMAIN', 'slicejack' ); define( 'CUZTOM_URL', get_template_directory_uri() . '/inc/cuztom' ); require( 'cuztom/cuztom.php' );
  • 4. BOOKS LIBRARY 1 CREATE CUSTOM POST TYPE - BOOK $books = new Cuztom_Post_Type( 'book', array( 'has_archive' => true, 'rewrite' => array( 'slug' => 'books' ), 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ) ) );
  • 6. BOOKS LIBRARY 2 CREATE CUSTOM TAXONOMY - BOOK CATEGORY $book_category = new Cuztom_Taxonomy( 'Book Category', 'book' );
  • 8. BOOKS LIBRARY 3 CREATE METABOX - INFO $books->add_meta_box( 'info', 'Info', array( array( 'name' => 'author', 'label' => 'Author', 'type' => 'text' ), array( 'name' => 'date', 'label' => 'Date', 'type' => 'date' ), array( 'name' => 'price', 'label' => 'Price', 'type' => 'text' ), array( 'name' => 'number_of_pages', 'label' => 'Number of pages', 'type' => 'text' ), array( 'name' => 'bind_type', 'label' => 'Bind type', 'type' => 'select', 'options' => array( 'hardcover' => 'Hardcover', 'double-wire' => 'Double wire', 'spiral' => 'Spiral' ), 'default_value' => 'hardcover' ), array( 'name' => 'size', 'label' => 'Size', 'type' => 'select', 'options' => array( 'a5' => 'A5', 'a4' => 'A4', 'a3' => 'A3' ), 'default_value' => 'a4' ) ) );
  • 9. FIELD TYPES _ text - a simple text field _ textarea - a large textarea for multiple lines of text _ checkbox - a simple boolean entry _ yesno - allows choice of yes/no (pre-made extension of radio) _ select - combo box selection _ multi_select - multi select selection _ checkboxes - a checkbox group _ radios - a radio group _ wysiwyg - an editor with the same controls as the standard WordPress editor _ image - image upload box _ file - file upload box _ date - date selection _ datetime - date and time (hour+minutes) selection _ time - time (hour+minutes) selection _ color - color selection _ post_select - allows inner-post references via a combo-box _ post_checkboxes - allows inner-post references via a checkbox group _ term_select - allows category references via a combo-box _ term_checkboxes - allows category references via a checkbox group _ hidden - a hidden field (oſten used to store information not visible to the user).
  • 11. BOOKS LIBRARY 4 TEMPLATE <div class="entry-content"> <?php $bind_types = array( 'hardcover' => __( 'Hardcover', 'slicejack' ), 'double-wire' => __( 'Double wire', 'slicejack' ), 'spiral' => __( 'Spiral', 'slicejack' ) ); $sizes = array( 'a5' => __( 'A5', 'slicejack' ), 'a4' => __( 'A4', 'slicejack' ), 'a3' => __( 'A3', 'slicejack' ) ); ?> <strong><?php _e( 'Author:', 'slicejack' ); ?></strong> <?php echo get_post_meta( get_the_id(), '_info_author', true ); ?><br /> <strong><?php _e( 'Date:', 'slicejack' ); ?></strong> <?php echo date( 'd.m.Y.', get_post_meta( get_the_id(), '_info_date', true ) ); ?><br /> <strong><?php _e( 'Price:', 'slicejack' ); ?></strong> $<?php echo get_post_meta( get_the_id(), '_info_price', true ); ?><br /> <strong><?php _e( 'Number of pages:', 'slicejack' ); ?></strong> <?php echo get_post_meta( get_the_id(), '_info_number_of_pages', true ); ?><br /> <strong><?php _e( 'Bind type:', 'slicejack' ); ?></strong> <?php echo $bind_types[ get_post_meta( get_the_id(), '_info_bind_type', true ) ]; ?><br /> <strong><?php _e( 'Size:', 'slicejack' ); ?></strong> <?php echo $sizes[ get_post_meta( get_the_id(), '_info_size', true ) ]; ?> </div><!-- .entry-content -->
  • 13. FEATURED LIBRARY 1 ADD METABOX TO PAGE TEMPLATE if ( is_admin() ) : $pid = 0; if( array_key_exists( 'post', $_GET ) ) $pid = $_GET['post']; elseif ( array_key_exists( 'post_ID', $_POST ) ) $pid = $_POST['post_ID']; $page_template = basename( get_post_meta( $pid, '_wp_page_template', true ) ); if ( 'featured-library.php' == $page_template ) : $cpage = new Cuztom_Post_Type( 'page' ); $cpage ->remove_post_type_support( array( 'editor', 'thumbnail' ) ) ->add_meta_box( 'library', 'Library', array( 'bundle', array( array( 'name' => 'book', 'label' => 'Book', 'type' => 'post_select', 'args' => array( 'post_type' => 'book', 'show_option_none' => 'None' ) )
  • 14. FEATURED LIBRARY 2 PAGE TEMPLATE <?php // Start the Loop. while ( have_posts() ) : the_post(); ?> <?php the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></ header><!-- .entry-header -->' ); ?> <?php $library = get_post_meta( get_the_id(), '_library', true ); foreach( $library as $book ) : $post = get_post( $book['_book'] ); setup_postdata( $post ); get_template_part( 'book' ); endforeach; wp_reset_postdata(); endwhile; ?>
  • 15. CUSTOM FIELD TYPE 1 CREATE YOURFIELD.CLASS.PHP AND SAVE IT TO <?php if( ! defined( 'ABSPATH' ) ) exit; class Cuztom_Field_Ip extends Cuztom_Field { var $_supports_repeatable = true; var $_supports_bundle = true; var $_supports_ajax = true; var $css_classes = array( 'cuztom-input', 'cuztom-ip' ); function _output( $value ) { $output = ''; $output .= '<input type="text" ' . $this->output_name() . ' ' . $this->output_id() . ' ' . $this->output_css_class() . ' value="' . ( ! empty( $value ) ? $value : '0.0.0.0' ) . '" />'; $output .= $this->output_explanation(); return $output; } INC/CUZTOM/CLASSES/FIELDS
  • 16. CUSTOM FIELD TYPE 1 CREATE YOURFIELD.CLASS.PHP AND SAVE IT TO function save_value( $value ) { return filter_var( $value, FILTER_VALIDATE_IP ) ? $value : '0.0.0.0'; } } INC/CUZTOM/CLASSES/FIELDS
  • 17. CUSTOM FIELD TYPE 2 INCLUDE FIELD TYPE CLASS private function includes() { /*...*/ include( CUZTOM_DIR . 'classes/fields/ip.class.php' ); }
  • 18. CONTRIBUTE ON GITHUB https://github.com/gizburdt/wp-cuztom
  • 19. THANK YOU! _ Ante Primorac (@anteprimorac) _ Web Developer @ Slicejack _ 2nd WordPress Meetup Split