Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter jonoc73

    (@jonoc73)

    Ok, I have a custom fields key of gt_guides and there are a list of checkboxes for the staff giving values of Phil Rob Nic and Jef etc. Each has their own php file with a div and some contact info like this:

    <div id="guidewrap">
    <div class="guide"><a href="https://www.website.com/guides/phil"><img src="/images/guides/phil.png"/></a></div>
    <div class="details"><a href="https://www.website.com/guides/phil">Phil</a></div>
    <div class="contact">Email: <a href="mailto:[email protected]" title="Email">[email protected]</a></div>

    I want to display the div containing their contact details if their name is selected in the checkbox. If their name isn’t checked then I don’t want anything to show.

    The above code does word but I was wanting to know what I should remove from it as it was originally written to echo a list of names like Phil, Rob, Nic instead of including a php file.

    Thanks Jono.

    Thread Starter jonoc73

    (@jonoc73)

    Sorry guys, yes I should have written more to explain!

    At the moment the above script was written to display guide names if they were filled in in a custom field. They would display like: John, Kev, Peter

    Instead of just their name I wanted to display a div containing things like a small images, email and phone details – this was via the TEMPLATEPATH line.

    However I am still using the same code as if they were a list of names including the ‘comma’ between them.

    So what would I take out of the above code?

    Thanks for your help once more.

    Jono.

    Thread Starter jonoc73

    (@jonoc73)

    I have figured it out – I need to put the breadcrumb in the loop.

    Thread Starter jonoc73

    (@jonoc73)

    What would I take out if I didn’t want a comma’ed list? I just wanted a list of the included templates?

    Thanks J

    Thread Starter jonoc73

    (@jonoc73)

    I took a look at the code again and it’s simple really isn’t it!

    I replace

    if ('John' == $guide )
    {$out .= $guide  . ' is a man' . $between;}

    with

    if ('John' == $guide )
    {include(TEMPLATEPATH . '/guides/john.php'); }

    Thanks for your help.

    Jonathan

    Thread Starter jonoc73

    (@jonoc73)

    Michael, You’re helping loads – thanks once again.

    When I asked if I was able to do something with each value I meant doing something like including a template path for example.

    I should have explained it more sorry.

    If the value is John I want to include a template where I can include his photo, contact info etc.

    <?php } else { include(TEMPLATEPATH . '/guides/john.php'); } ?>

    If the value includes Mary I want to include a template where I can include her photo, contact info etc.

    <?php } else { include(TEMPLATEPATH . '/guides/mary.php'); } ?>

    Thanks for your help so far – it’s been great.

    Jonathan

    Thread Starter jonoc73

    (@jonoc73)

    That’s great – thanks for your help it works, but it’s not too pretty though. How would I add a space and a comma into the code to get something like: John, Ben, Claire

    Also am I able to do something with each value. Say I used the if statement shown in the first post above, if the value is John do this and if the value is Ben do that?

    Thanks Jonathan

    Thread Starter jonoc73

    (@jonoc73)

    Thanks Michael, I have probably done this wrong, but put the above into the code and it just returns the word Array instead of the tour guides names.

    <?php $single=false; echo get_post_meta($post->ID, "guides", $single); ?>

    Thanks Jono.

    Thread Starter jonoc73

    (@jonoc73)

    Thanks stwlf but how should I add the F j, Y string into the above code? I assume I add it to the echo line but have tried all sorts of combinations but can’t get it to work??

Viewing 9 replies - 1 through 9 (of 9 total)