SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Eight Key Functions to Kick-Start Wordpress Theme Development
The majority of website developers will find themselves working in
WordPress and the design and development of Themes is all part of the
process. Once you begin developing themes you’ll soon realize that many
functions can be standardized and put into a basic starter kit which gives you
a launch pad for the rest of your development.
To build your starter’s kit you need to pinpoint the most common functions and
include them all in the functions.php file. Below we’ve collated eight key functions
you should include in your starter kit.
1. Custom Menu Support
WordPress 3.0 saw the introduction of the navigation menu feature which
allows for the instinctive creation of navigation menus within themes. A
standard theme requires at least a main navigation menu, traditionally
positioned in the header and sometimes a secondary navigation menu in the
footer. To achieve this you need to register both these menus in the
functions.php in the format shown below.
These menus are now registered but you need to tell the theme where to position
them. The “Main Menu” is going to appear in the header so in the header.php you
input the following:
You then need to check if the “main_menu” menu is defined and then if it has been
you then insert its contents. If not you can fall back to the default
wp_list_pages() which can be customised to display links as necessary.
2. Custom Avatar Support
Most people who comment online, as is common with WordPress sites,
have their own personal avatar. There are some who don’t and if you don’t
particularly like the avatars provided as default by WordPress you can
customise them. To do this add the following code to your functions.php
file.
3. Style your Visual Editor
This function allows for custom CSS to style WordPress TinyMCE visual editor. You
need to create a CSS file named editor-style.css and paste your styles within. In
your functions.php you then insert
add_editor_style();
It then makes sense to setup the editor for right-to-left languages and create a
further CSS file called editor-style-rtl.css in the theme directory and then include
the following code as a minimum.
4. Featured Image Function
This function allows you to choose a representative image for all posts,
pages and custome posts. To enable this you need to include the following
in your functions.php file.
add_theme_support( ‘post-thumbnails’ );
You can leave it like this but it would be detrimental to your website
development. Instead you should define the thumbnail sizes for your
featured posts. To do this you need to take advantage of the
add_image_size() function which tells WordPress to make copies of the
chosen image in defined sizes which you would code as below:
5. Post Formats
The post formats function allows to customise how your posts are styled
and presented. There are nine different standard formats offered by
WordPress: aside, gallery, link, image, quote, status, video, audio, and
chat. To add this functionality you need to specify the type of post format
you want to use in your functions.php file for example:
6. Basic Pagination
Your themes may all have different pagination needs but beginning with the
following defaults will see you well:
7. Content Width Definition
The content width function allows you to specify maximum widths for videos,
images and other embedded content. It means that if you choose to paste a
YouTube URL into the WordPress editor the CMS will automatically display the
video and it won’t exceed the maximum width set, if you use the
$content_width variable in your functions.php file as below.
8. Add Dynamic Sidebar
The theme that you’re developing will need at least one sidebar. Defining a
sidebar is pretty straightforward, you simply need to add the below to your
functions.php file. Doing so will register and define your “Main Sidebar”.
When you want more than one you can edit the above code and register
further as necessary.
These eight functions are likely to be central to all your WordPress theme
developments. All developers should have them in their arsenal to get off to
a quick and easy start.
For some more Website Development related
post visit our Blog
Like us on Facebook Follow us on Twitter

Contenu connexe

Dernier

call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
vikas rana
 

Dernier (15)

2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptx
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 

En vedette

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Eight key functions to kick start wordpress theme development

  • 1. Eight Key Functions to Kick-Start Wordpress Theme Development The majority of website developers will find themselves working in WordPress and the design and development of Themes is all part of the process. Once you begin developing themes you’ll soon realize that many functions can be standardized and put into a basic starter kit which gives you a launch pad for the rest of your development.
  • 2. To build your starter’s kit you need to pinpoint the most common functions and include them all in the functions.php file. Below we’ve collated eight key functions you should include in your starter kit. 1. Custom Menu Support WordPress 3.0 saw the introduction of the navigation menu feature which allows for the instinctive creation of navigation menus within themes. A standard theme requires at least a main navigation menu, traditionally positioned in the header and sometimes a secondary navigation menu in the footer. To achieve this you need to register both these menus in the functions.php in the format shown below.
  • 3. These menus are now registered but you need to tell the theme where to position them. The “Main Menu” is going to appear in the header so in the header.php you input the following: You then need to check if the “main_menu” menu is defined and then if it has been you then insert its contents. If not you can fall back to the default wp_list_pages() which can be customised to display links as necessary.
  • 4. 2. Custom Avatar Support Most people who comment online, as is common with WordPress sites, have their own personal avatar. There are some who don’t and if you don’t particularly like the avatars provided as default by WordPress you can customise them. To do this add the following code to your functions.php file.
  • 5. 3. Style your Visual Editor This function allows for custom CSS to style WordPress TinyMCE visual editor. You need to create a CSS file named editor-style.css and paste your styles within. In your functions.php you then insert add_editor_style(); It then makes sense to setup the editor for right-to-left languages and create a further CSS file called editor-style-rtl.css in the theme directory and then include the following code as a minimum.
  • 6. 4. Featured Image Function This function allows you to choose a representative image for all posts, pages and custome posts. To enable this you need to include the following in your functions.php file. add_theme_support( ‘post-thumbnails’ ); You can leave it like this but it would be detrimental to your website development. Instead you should define the thumbnail sizes for your featured posts. To do this you need to take advantage of the add_image_size() function which tells WordPress to make copies of the chosen image in defined sizes which you would code as below:
  • 7. 5. Post Formats The post formats function allows to customise how your posts are styled and presented. There are nine different standard formats offered by WordPress: aside, gallery, link, image, quote, status, video, audio, and chat. To add this functionality you need to specify the type of post format you want to use in your functions.php file for example:
  • 8. 6. Basic Pagination Your themes may all have different pagination needs but beginning with the following defaults will see you well:
  • 9. 7. Content Width Definition The content width function allows you to specify maximum widths for videos, images and other embedded content. It means that if you choose to paste a YouTube URL into the WordPress editor the CMS will automatically display the video and it won’t exceed the maximum width set, if you use the $content_width variable in your functions.php file as below.
  • 10. 8. Add Dynamic Sidebar The theme that you’re developing will need at least one sidebar. Defining a sidebar is pretty straightforward, you simply need to add the below to your functions.php file. Doing so will register and define your “Main Sidebar”. When you want more than one you can edit the above code and register further as necessary. These eight functions are likely to be central to all your WordPress theme developments. All developers should have them in their arsenal to get off to a quick and easy start.
  • 11. For some more Website Development related post visit our Blog Like us on Facebook Follow us on Twitter