Community Forums › Forums › Archived Forums › Design Tips and Tricks › CPT featured image does not display on category pages
Tagged: category page, CPT, exchange ecommerce
- This topic has 4 replies, 2 voices, and was last updated 10 years, 5 months ago by Brad Dalton.
-
AuthorPosts
-
June 1, 2014 at 10:51 am #107753psillariMember
WordPress Environment
Genesis Framework – parent theme
Dynamik Website Builder – child theme
iThemes Exchange ecommerce pluginIssue
The Exchange product posts which have been categorized via Exchange categories display in their appropriate category pages but without the featured image that is displaying in the individual product posts.Goal
I want the Product listing on the category pages to show the product featured image as well as the descriptive text which is showing.Exchange Instruction
iThemes notes that the Archive/Category pages of a site are controlled by the theme and not by Exchange and thus, by default, those pages won't pull in the featured images for the products listed on a category page.To have the images display, either in the archive.php or category.php file (whichever file my theme calls) I need to enter the following code right after the loop starts:
<?php it_exchange_set_product( $post->ID ); ?>Then to have the image appear where I want I enter the following code in the appropriate place:
<?php it_exchange( 'product', 'featured-image', array( 'size' => 'thumbnail' ) ); ?>My Skills
I have intermediate HTML & CSS skills but no real PHP skills – basically I can follow instructions and cut and paste.What I’ve Tried
I attempted several times to create a custom category page following different tutorials and include the above code but I’m obviously missing something in the coding of the pages as I have been unsuccessful.I think part of the problem is I’m not using the correct file to base my custom category page on. I don’t see where the loop starts so don’t know where to insert the above code. And since my PHP skills are nil I am unable to understand what’s going on with the code or spot my obvious errors in coding.
I also tried using the Custom Hooks feature of Dynamik but wasn’t successful there either.
At this point I’m going in circles and need some direction/help in solving my problem.
Pete
June 1, 2014 at 12:15 pm #107766Brad DaltonParticipantYou could hook it in from your child themes functions file conditionally using the loop_start hook.
The code you embedded is broken. You might want to embed it properly then it can be tested in different solutions.
Couldn't find a link to your archive page which would help people help you.
June 1, 2014 at 2:02 pm #107769psillariMemberBrad,
Thanks for the quick reply and for pointing out my oversight re; the code.
Here is the code, hopefully now formatted correctly, which is suggested to be placed right after the loop starts
<?php it_exchange_set_product( $post->ID ); ?>
The code for placement is
<?php it_exchange( 'product', 'featured-image', array( 'size' => 'thumbnail' ) ); ?>
The site I'm working on requires a logon to get to the development area. Happy to send it via email or a private reply if requested.
If I understand your suggestion I would place the hook in the functions file via Dynamik's Custom Function feature to enter it into the child's (Dynamik) function.php file.
Would your display images from your images folder article apply here as well as another option?
June 1, 2014 at 2:04 pm #107770psillariMemberThis reply has been marked as private.June 1, 2014 at 2:32 pm #107773Brad DaltonParticipantSorry but only moderators receive PM's.
Just wanted to have a look at the source code of the archive and the body classes.
Another option is to code a archive-cpt.php file.
The display images tutorial is not for featured images but there's many other code snippets which are.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.