What are some common pitfalls when trying to display a menu horizontally using PHP in WordPress?
One common pitfall when displaying a menu horizontally using PHP in WordPress is not properly styling the menu items with CSS. To solve this issue, you can use the "wp_nav_menu" function in WordPress to generate the menu HTML markup and then apply CSS styling to make it display horizontally.
```php
<?php
// Display horizontal menu in WordPress
wp_nav_menu( array(
'theme_location' => 'primary',
'container' => 'ul',
'menu_class' => 'horizontal-menu',
) );
?>
```
In this code snippet, we are using the "wp_nav_menu" function to generate the menu with the specified theme location and container element. We are also assigning a CSS class "horizontal-menu" to the menu items, allowing us to style them horizontally using CSS.