On many sites ( particularly CMS style business sites) there are 2, 3 4 or sometimes more boxes usually containing a title, icon and some text. These appear under the header linking to strategic parts of the site.
I have set up my custom theme so that the user can decide which parts of the site to link these boxes to via the theme options; but I can think of at least 2 or three other ways of doing this, and I’m wondering if I’ve made the right choice.
The alternative options include
- Setting it up as a WordPress custom menu ( which would only display the first 4 links in my case ) (though wrt menus, I was really hoping to display these 4 links in div’s not ul’s so I’m not sure about menus
- a custom post type where the user could set up ’tiles’ or something like that, working in a similar way.
- I also could imagine a special category and using a query but I don’t think that would work for me.
Has anyone got any wisdom/experience/pros&cons to share on this? Is there any reason to completely avoid one of the options?
On my website, I’ve used Custom Post Types to achieve a slightly more complex version of what you’re trying to do.
My requirements were;
I decided that CPTs were the way forward; this is the interface I’ve developed in the admin area of our somewhat-bespoke WP install.
The code for the Custom Post Type itself is fairly straightforward. I created a folder in my
plugins
directory calledsf-featured-items
and created a similarly-named php file.Here is the full code. It looks a lot more complex than it actually is!
The added complexity is something which you may not need – the link to the article. Looking back, I could’ve left this off entirely and simply used the rich text editor’s built-in hyperlinking function.
The code for the front-end is quite simple too:
WP_Query
)featured-item
posts_per_page => 3
;<?php while ( $query->have_posts() ) : $query->the_post(); ?>
…
If you want to attempt this, feel free to pester me for additional information.