NAIJADEALZ
Forum Replies Created
-
I got the usual alphabetical list without the logo, plus your echo ‘am inside else’
Here is the code getting executed
<div class="itemboxinner"> <?php echo $PPTDesign->TaxonomyDisplay(3,$thistax,1); ?> <?php foreach( (array) $terms as $term){ echo wp_get_attachment_image( $term->image_id, '' ); echo $term->name; echo "<div style='margin: 0 10px 10px 0; float: left'><img src='$term' /></div>"; print apply_filters( 'taxonomy-images-queried-term-image', '' );}?> </div><!-- end itembox innner -->
The else condition is getting executed Tarun, when i change the number of columns displayed from 3 to 2, i see the change.
code is like this now but all i get is an empty image box.
<?php /* Template Name: [Naija Stores List Template] */ global $userdata; get_currentuserinfo(); // grabs the user info and puts into vars $wpdb->hide_errors(); nocache_headers(); $thistax = get_post_meta($post->ID, 'type', true); $image_id = apply_filters( 'taxonomy-images-queried-term-image-id', 0 ); $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' => 'store') ); if($thistax == ""){ if(current_user_can('administrator')){ if(isset($_GET['type'])){ update_post_meta($post->ID, 'type', $_GET['type']); }else{ wp_die( 'Select the list type: <form action="" method="get"><select name="type"><option value="location">Country/State/City List</option><option value="store">Stores List</option></select><input name="" type="submit" value="Save Selection" /></form>' ); } }else{ wp_die( 'This page has not yet been setup.' ); } } $GLOBALS['LOADTHISTAX'] = $thistax; $GLOBALS['COLUMNS'] = "3"; $hookContent = premiumpress_pagecontent("taxonomy"); /* HOOK V7 */ if(strlen($hookContent) > 20 ){ // HOOK DISPLAYS CONTENT get_header(); echo $hookContent; get_footer(); }elseif(file_exists(str_replace("functions/","",THEME_PATH)."/themes/".get_option('theme')."/_tpl_taxonomy.php")){ include(str_replace("functions/","",THEME_PATH)."/themes/".get_option('theme').'/_tpl_taxonomy.php'); }else{ get_header( ); ?> <div class="itembox"> <h1><?php the_title(); ?></h1> <div class="itemboxinner"> <?php echo $PPTDesign->TaxonomyDisplay(3,$thistax,1); ?> <?php foreach( (array) $terms as $term){ echo wp_get_attachment_image( $term->image_id, '' ); echo $term->name; echo "<div style='margin: 0 10px 10px 0; float: left'><img src='$term' /></div>"; print apply_filters( 'taxonomy-images-queried-term-image', '' );}?> </div><!-- end itembox innner --> </div><!-- end itembox --> <?php get_footer(); } /* ============================================================================= -- END FILE ========================================================================== */ ?>
Dear Tarun,
Thanks a lot.I have changed to ‘store’
code is now this:
<?php /* Template Name: [Example Ke] */ /* ============================================================================= THIS FILE SHOULD NOT BE EDITED // UPDATED: 16TH MARCH 2012 ========================================================================== */ global $userdata; get_currentuserinfo(); // grabs the user info and puts into vars $wpdb->hide_errors(); nocache_headers(); $thistax = get_post_meta($post->ID, 'type', true); $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' => 'store') ); if($thistax == ""){ if(current_user_can('administrator')){ if(isset($_GET['type'])){ update_post_meta($post->ID, 'type', $_GET['type']); }else{ wp_die( 'Select the list type: <form action="" method="get"><select name="type"><option value="location">Country/State/City List</option><option value="store">Stores List</option></select><input name="" type="submit" value="Save Selection" /></form>' ); } }else{ wp_die( 'This page has not yet been setup.' ); } } $GLOBALS['LOADTHISTAX'] = $thistax; $GLOBALS['COLUMNS'] = "3"; /* ============================================================================= LOAD IN PAGE CONTENT // V7 // 16TH MARCH ========================================================================== */ $hookContent = premiumpress_pagecontent("taxonomy"); /* HOOK V7 */ if(strlen($hookContent) > 20 ){ // HOOK DISPLAYS CONTENT get_header(); echo $hookContent; get_footer(); }elseif(file_exists(str_replace("functions/","",THEME_PATH)."/themes/".get_option('theme')."/_tpl_taxonomy.php")){ include(str_replace("functions/","",THEME_PATH)."/themes/".get_option('theme').'/_tpl_taxonomy.php'); }else{ /* ============================================================================= LOAD IN PAGE DEFAULT DISPLAY // UPDATED: 25TH MARCH 2012 ========================================================================== */ get_header( ); ?> <div class="itembox"> <h1><?php the_title(); ?></h1> <div class="itemboxinner"> <?php echo $PPTDesign->TaxonomyDisplay(3,$thistax,1); ?> <?php if ( ! empty( $terms ) ) { echo '<ul class="links">';?> <?php foreach( (array) $terms as $term ) { echo '<li>'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumb' ) . '</a>'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . $term->name . '</a>'; echo '</li>'; } echo '</ul>'; }?> </div><!-- end itembox innner --> </div><!-- end itembox --> <?php get_footer(); } /* ============================================================================= -- END FILE ========================================================================== */ ?>
and output is just a list of stores listed alphabetically, no image.
My code looks like this now, still not working
<?php /* Template Name: [Example Ke] */ /* ============================================================================= THIS FILE SHOULD NOT BE EDITED // UPDATED: 16TH MARCH 2012 ========================================================================== */ global $userdata; get_currentuserinfo(); // grabs the user info and puts into vars $wpdb->hide_errors(); nocache_headers(); $thistax = get_post_meta($post->ID, 'type', true); $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' => 'stores') ); if($thistax == ""){ if(current_user_can('administrator')){ if(isset($_GET['type'])){ update_post_meta($post->ID, 'type', $_GET['type']); }else{ wp_die( 'Select the list type: <form action="" method="get"><select name="type"><option value="location">Country/State/City List</option><option value="store">Stores List</option></select><input name="" type="submit" value="Save Selection" /></form>' ); } }else{ wp_die( 'This page has not yet been setup.' ); } } $GLOBALS['LOADTHISTAX'] = $thistax; $GLOBALS['COLUMNS'] = "3"; /* ============================================================================= LOAD IN PAGE CONTENT // V7 // 16TH MARCH ========================================================================== */ $hookContent = premiumpress_pagecontent("taxonomy"); /* HOOK V7 */ if(strlen($hookContent) > 20 ){ // HOOK DISPLAYS CONTENT get_header(); echo $hookContent; get_footer(); }elseif(file_exists(str_replace("functions/","",THEME_PATH)."/themes/".get_option('theme')."/_tpl_taxonomy.php")){ include(str_replace("functions/","",THEME_PATH)."/themes/".get_option('theme').'/_tpl_taxonomy.php'); }else{ /* ============================================================================= LOAD IN PAGE DEFAULT DISPLAY // UPDATED: 25TH MARCH 2012 ========================================================================== */ get_header( ); ?> <div class="itembox"> <h1><?php the_title(); ?></h1> <div class="itemboxinner"> <?php echo $PPTDesign->TaxonomyDisplay(3,$thistax,1); ?> <?php if ( ! empty( $terms ) ) { echo '<ul class="links">';?> <?php foreach( (array) $terms as $term ) { echo '<li>'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumb' ) . '</a>'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . $term->name . '</a>'; echo '</li>'; } echo '</ul>'; }?> </div><!-- end itembox innner --> </div><!-- end itembox --> <?php get_footer(); } /* ============================================================================= -- END FILE ========================================================================== */ ?>
Dear Tarun,
Thank you for taking time out to reply.
I have tried the code, however, it just returns a blank page, no store list or images.
The template code is as follows. I am a complete newbie to php. so please help some more
<?php /** * Template Name: Example ke * * This is an example template for you to customize. * It may not fit exactly in with your theme because all themes are different. * It's always best to work with your theme's page.php to get things right. */ get_header(); $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' => 'stores') ); if ( ! empty( $terms ) ) { echo '<ul class="links">'; foreach( (array) $terms as $term ) { echo '<li>'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumb' ) . '</a>'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . $term->name . '</a>'; echo '</li>'; } echo '</ul>'; } get_footer(); ?>
Hi Agnes,
Could you please share your template code for displaying the list of items in a taxnonomy and their associated images?
My site is here Naijadeals.com and I’m trying to do a list of stores and their logo images.
The taxonomy name is ‘stores’ and I’d like to list the names of the stores, as well as their images.
Thank you