WordPress Developer Ukraine, Kyiv
Build a Custom WordPress Navigation Menu Walker for Bootstrap 5

Build a Custom WordPress Navigation Menu Walker for Bootstrap 5

Build a custom nav menu walker for Bootstrap dropdowns wp_nav_menu() prints a menu as nested <ul> and <li> elements with WordPress classes. CSS frameworks expect their own markup: Bootstrap’s navbar wants nav-item and nav-link classes, a dropdown-menu list and a toggle with data-toggle="dropdown". The class that writes the menu HTML is Walker_Nav_Menu, and a child…
Add Custom Fields to the WordPress User Profile with User Meta

Add Custom Fields to the WordPress User Profile with User Meta

Add custom fields to the WordPress user profile User data that WordPress does not know, like a phone number, a department or a preference, is stored in user meta, the same key-value storage posts have. To let users and administrators edit it, add fields to the profile screen with two display hooks and save them…
Modify the WordPress Main Query with pre_get_posts: 5 Common Patterns

Modify the WordPress Main Query with pre_get_posts: 5 Common Patterns

Modify the WordPress main query with pre_get_posts: 5 common patterns WordPress builds and runs the main query (the one behind the Loop on the home page, archives and search) before the template is loaded. When archive.php starts, the posts are already fetched. The pre_get_posts action fires after the query object is created but before the…