In WordPress, there is a handy function that displays custom menus that are setup in Appearance > Menus, that function is
wp_nav_menu();. If you are setting up your menus this way (and you should be) I’m sure you are familiar with some of the limitations of what is output on the page. From a design standpoint, these menus can be rather difficult to work with.
Page anchors can be great for single page sites, or sites with long content that need to be navigable. However, you may not want you client digging around in the text view of their WordPress editor…I’m sure they don’t want to be in there either!
A little lesson in Client love
I’m a huge advocate for “Client Centric UX”. What I mean by that is focusing as much on the client’s user experience as we do on their target market’s user experience. Having a simple to use WordPress admin goes right along with this concept. Not everyone is familiar with WordPress…shocking, I know. Furthermore, there are a lot of people who are fairly tech-savvy but have no concept of what a “blog” does or what a “post” is. Read More
There are a lot of scenarios I can think of where you may need to do something like this, but let’s say for this particular example you would like to make your client’s life easy by allowing them to upload images to a post, and then having those images automatically output into an image slider on their published page…no plugins, no shortcodes, just magic.
So, you want to return some values from your WordPress Custom Fields (post_meta) on condition those values exist, eh? Don’t worry…it’s easy!
I’m assuming you have already figured out how to return your Custom Field values, but in case you haven’t, here is some general information from the codex:
$meta_values = get_post_meta($post_id, $key, $single);
This function returns the values of the custom fields with the specified key from the specified post. (Source: Function Reference/get post meta)