Support » Plugin: Category Meta plugin » [Plugin: Category Meta plugin] Php help

  • willvbcfc


    I’m totally stuck with the php here, but I hope I’m being pretty clear with what I need and someone will kindly help me!

    I’m using the following category loop to create a schedule for a radio station:

    <div id="showcatheaders"><img src="<?php bloginfo('template_url'); ?>/images/lunchtime_show_title.png" /></div>
                <div id="lunchtimeshows">
      'orderby' => 'name',
      'order' => 'ASC'
      foreach($categories as $category) {
        echo '
          <div class="showboxtitle" style="background:url('. $category->description . ') no-repeat;">
          <a href="' . get_category_link( $category->term_id ) . '" class="nct" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>
    } ?>

    I’m calling up the category description for a background at the moment, but I would like to change that to a category meta called ‘catimg’.

    I also need to display a day & time meta called ‘timeandday’ one line break after the category name within the div class named ‘showboxtitle’.

    I’m totally stuck on how to modify the if (function_exists('get_terms_meta')) { $metaValue = get_terms_meta($category_id, $meta_key); } template into this category loop, so please, please help!

Viewing 1 replies (of 1 total)
  • Theoritically this should work, however in practice, the plugin seems to be corrupt and not work all the time. Try inserting the following somewhere above:

    <?php if (function_exists('get_terms_meta')) {
    $category = get_the_category();
    $catid = $category[0]->cat_ID;
    $catimage = get_terms_meta($catid, 'catimg');
    $cattime = get_terms_meta($catid, 'timeandday');
    } ?>

    In order to get the timeandday metadata to display as you desire, please add this straight after the div “showboxtitle”

    <br/><p class="timeandday"><?php echo $cattime; ?></p>

    And replace the category description inside the style=””
    with <?php echo $catimg; ?>

    I will try to post an use-case scenario with an example wordpress template to this week, if you are interested!

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Category Meta plugin] Php help’ is closed to new replies.