WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building a WordPress options panel.

In my options panel I added the following, this creates a Yes/No dropdown menu asking whether or not the user wants to display breacrumbs - I want to be able to hide (or simply not call) the breadcrumbs when a user selects no:

array( "name" => "Display breadcrumbs on post pages?",
    "desc" => "Choose whether or not to display breadcrumbs, that is, the post trail.",
    "id" => $shortname."_breadcrumbs",
    "type" => "select",
    "options" => array("Yes", "No"),
    "std" => "Yes"),

Normally I would use something like this to call the above function:

<?php echo get_option('to_breadcrumbs'); ?>

But breadcrumbs have their own function, and I call them like so:

<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>

One possible solution that could be applied in other uses would be to add a div class with the hide property around the function I am calling when "No" is selected. Any help?

share|improve this question

migrated from stackoverflow.com Sep 29 '11 at 11:01

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

Why not just check the options before calling dimox_breadcrumbs() like so:

    // Check if the user wants breadcrumbs, default to "Yes" if no option set
    if(strcmp(get_option("to_breadcrumbs", "Yes"), "Yes") == 0){
         if (function_exists('dimox_breadcrumbs')) {
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.