Facebook Pixel
Searching...
English
EnglishEnglish
EspañolSpanish
简体中文Chinese
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
Bahasa IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Smashing WordPress

Smashing WordPress

Beyond the Blog
by Thord Daniel Hedengren 2012 352 pages
3.78
100+ ratings
Listen

Key Takeaways

1. WordPress themes: The foundation of site design and functionality

A theme must always contain a style sheet file called style.css.

Theme structure. WordPress themes consist of template files, style sheets, and optional additional files like functions.php. The style.css file is crucial as it contains the theme's metadata and styling information. Template files such as index.php, header.php, footer.php, and sidebar.php control the layout and content display.

Essential components:

  • style.css: Theme metadata and styling
  • index.php: Main template file
  • header.php and footer.php: Site header and footer
  • sidebar.php: Sidebar content
  • functions.php: Theme-specific functionality

Template hierarchy. WordPress uses a specific hierarchy to determine which template file to use for different types of content. Understanding this hierarchy allows developers to create more tailored and flexible themes.

2. Mastering the WordPress loop for dynamic content display

The loop is the heart of WordPress, and it resides in your theme's template files.

Loop basics. The WordPress loop is a PHP-based system that retrieves and displays content from the database. It's essential for creating dynamic websites, as it allows for the flexible output of posts, pages, and custom content types.

Key loop components:

  • have_posts(): Checks if there are posts to display
  • the_post(): Sets up each post's data
  • the_content(): Displays the post content
  • the_title(): Outputs the post title

Advanced techniques. Developers can customize the loop using query_posts() or WP_Query to alter the default behavior, such as changing the number of posts displayed or filtering by specific criteria.

3. Child themes: Extending functionality while preserving updatability

Child themes let you create themes that rely on other themes, called parent themes, as templates, by changing parts of the parent theme to suit your own needs.

Benefits of child themes:

  • Maintain updatability of the parent theme
  • Customize design and functionality without altering core files
  • Easier theme development and maintenance

Creating a child theme. To create a child theme, developers need to create a new folder in the wp-content/themes directory and include a style.css file with the necessary theme information and a Template: line pointing to the parent theme.

Overriding parent theme files. Child themes can override specific template files from the parent theme by including files with the same name in the child theme directory. This allows for targeted customization without duplicating the entire parent theme.

4. Custom post types and taxonomies: Tailoring WordPress to specific needs

Custom post types are an extremely powerful tool.

Custom post types. These allow developers to create content types beyond the default posts and pages. This feature is particularly useful for creating specialized content such as products, events, or portfolio items.

Creating custom post types:

  • Use register_post_type() function
  • Define labels, supports, and other arguments
  • Hook into the 'init' action to register the post type

Custom taxonomies. These provide additional ways to organize and classify content beyond categories and tags. Custom taxonomies can be hierarchical (like categories) or non-hierarchical (like tags).

Implementing custom taxonomies:

  • Use register_taxonomy() function
  • Define labels, hierarchical status, and other arguments
  • Associate with specific post types

5. Plugins vs. functions.php: Choosing the right approach for features

Only use functions.php when the added functionality is unique to your theme.

Functions.php usage. The functions.php file is specific to a theme and is ideal for theme-specific functionality. It's loaded automatically when the theme is active and can be used to enqueue scripts and styles, register sidebars, and add theme support for various features.

Plugin benefits:

  • Portability across themes
  • Easier maintenance and updates
  • Ability to activate/deactivate functionality without changing theme files

Decision factors:

  • Functionality lifespan (temporary vs. long-term)
  • Relevance to specific theme or site-wide feature
  • Potential for reuse across multiple projects

6. Integrating social media and enhancing user engagement

There is no doubt that the social web is important these days, with Facebook, Twitter, and Google+ being the most prominent examples.

Social media integration. WordPress sites can benefit from integrating social media features to increase engagement and reach. This can include sharing buttons, social login options, and embedded content from social platforms.

Integration methods:

  • Using official platform SDKs and APIs
  • Implementing sharing buttons and widgets
  • Displaying social media feeds on the site

User engagement techniques:

  • Implementing comment systems (native or third-party)
  • Creating user-submitted content features
  • Developing rating and review systems

7. Pushing WordPress beyond blogging: Unconventional use cases

WordPress can be used for projects even further from its bloggish roots, as this chapter will show.

Expanding WordPress functionality. While WordPress began as a blogging platform, it has evolved into a versatile content management system capable of powering various types of websites and applications.

Unconventional WordPress projects:

  • Job boards
  • Knowledge bases and FAQs
  • E-commerce platforms
  • Membership sites
  • Directory listings

Implementation strategies:

  • Leverage custom post types and taxonomies
  • Utilize plugins for specialized functionality
  • Develop custom themes tailored to specific use cases
  • Extend core WordPress features through hooks and filters

Last updated:

Review Summary

3.78 out of 5
Average of 100+ ratings from Goodreads and Amazon.

Smashing WordPress receives mixed reviews, averaging 3.78 out of 5 stars. Readers praise its technical depth and usefulness for intermediate to advanced WordPress developers. The book covers theme and plugin development, customization, and security. Some appreciate its clear examples and code snippets, while others find the writing style challenging. Critics note outdated information and typos in code examples. Many readers recommend it as a valuable reference for those looking to extend WordPress functionality beyond basic blogging.

Your rating:

About the Author

Thord Daniel Hedengren is a Swedish web developer, designer, and author known for his expertise in WordPress. He has written multiple books on web development and content management systems, with a focus on WordPress. Hedengren's writing style is described as technical yet accessible, providing in-depth explanations and practical examples for developers of various skill levels. His work with Smashing Magazine, a popular web design and development resource, has contributed to his reputation in the field. Hedengren's books often cover advanced topics, making them particularly valuable for those looking to expand their WordPress skills beyond the basics.

Download PDF

To save this Smashing WordPress summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.54 MB     Pages: 9

Download EPUB

To read this Smashing WordPress summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 3.29 MB     Pages: 6
0:00
-0:00
1x
Dan
Andrew
Michelle
Lauren
Select Speed
1.0×
+
200 words per minute
Create a free account to unlock:
Bookmarks – save your favorite books
History – revisit books later
Ratings – rate books & see your ratings
Unlock unlimited listening
Your first week's on us!
Today: Get Instant Access
Listen to full summaries of 73,530 books. That's 12,000+ hours of audio!
Day 4: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 7: Your subscription begins
You'll be charged on Nov 28,
cancel anytime before.
Compare Features Free Pro
Read full text summaries
Summaries are free to read for everyone
Listen to summaries
12,000+ hours of audio
Unlimited Bookmarks
Free users are limited to 10
Unlimited History
Free users are limited to 10
What our users say
30,000+ readers
“...I can 10x the number of books I can read...”
“...exceptionally accurate, engaging, and beautifully presented...”
“...better than any amazon review when I'm making a book-buying decision...”
Save 62%
Yearly
$119.88 $44.99/yr
$3.75/mo
Monthly
$9.99/mo
Try Free & Unlock
7 days free, then $44.99/year. Cancel anytime.
Settings
Appearance