WordPress.org

Ready to get started?Download WordPress

Forums

In Single show Custom fields in a category (3 posts)

  1. 2bak860
    Member
    Posted 9 years ago #

    I'm designing a hotel directory website. I want to show custom field tags for posts in category 3 (as well as the_content). To my mind it should go:

    <?php if (is_category(3)) {?>

    • Address: <?php echo c2c_get_custom('Address'); ?>
    • Bookings: <?php echo c2c_get_custom('Telephone'); ?>
    • Price Category: <?php echo c2c_get_custom('Price Category'); ?>
    • Nearest Beach: <?php echo c2c_get_custom('Nearest Beach'); ?>

    <?php the_content('<p class="serif">Read the rest of this entry »'); ?>
    <?php } ?>

    <?php else (is_category()) {?>
    <?php the_content('<p class="serif">Read the rest of this entry »'); ?>
    <?php } ?>

  2. 2bak860
    Member
    Posted 9 years ago #

    Well, I eventually found a way of doing it - thought I'd include it if anyone needed help on the same subject.

    <?php if ( !(in_category('2')) ) { ?>

    • Region: <?php the_category(' > '); ?>
    • Address: <?php echo c2c_get_custom('Address'); ?>
    • Bookings: <?php echo c2c_get_custom('Telephone'); ?>
    • Type of Accommodation: <?php echo c2c_get_custom('Type of Accommodation'); ?>
    • Price Category: <?php echo c2c_get_custom('Price Category'); ?>
    • Nearest Beach: <?php echo c2c_get_custom('Nearest Beach'); ?>

    <?php the_content('<p class="serif">Read the rest of this entry »'); ?>
    <?php link_pages('Pages: ', '', 'number'); ?>
    <?php } ?>

    <?php if ( !(in_category('15')) ) { ?>
    <?php the_content('<p class="serif">Read the rest of this entry »'); ?>
    <?php link_pages('Pages: ', '', 'number'); ?>
    <?php } ?>

  3. subirghosh
    Member
    Posted 9 years ago #

    Sounds interesting. Is your site up and running, so that we can have a preview?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.