- This topic has 12 replies, 3 voices, and was last updated 3 years, 10 months ago by
Support Team.
-
AuthorPosts
-
November 14, 2019 at 6:30 am #21286
karankcoresys
ParticipantPlease help:
Here is my code:<?php $custom_terms = get_terms('travel_locations'); foreach($custom_terms as $custom_term) { $term_link = get_term_link( $custom_term ); wp_reset_query(); $args = array('post_type' => 'itineraries', 'tax_query' => array( array( 'taxonomy' => 'travel_locations', 'field' => 'slug', 'terms' => $custom_term->slug, ), ), ); ?> <?php $loop = new WP_Query($args); if($loop->have_posts()) { ?> <a href="<?php echo $term_link;?>"> <img src="http://rankonone.com/dev/westchina/wp-content/uploads/2019/10/Altai.jpg"> <h2><?php echo $custom_term->name; ?></h2> </a> <?php while($loop->have_posts()) : $loop->the_post(); ?> <a href="<?php echo get_permalink(); ?>"> <h3><?php echo get_the_title()?></h3></a> <?php endwhile; ?> <?php }?>
November 14, 2019 at 11:00 am #21295wensolutions
KeymasterHello @karankcoresys,
The help you are asking for is beyond the support we offer for our Product. This has to be handled by the professional developer.
Hope you understand.
If you have any confusion related to the plugin then please let us know.
Thank you.
November 14, 2019 at 11:27 am #21296karankcoresys
ParticipantPlease, sir help, it’s not a big problem from your side, My client purchased the pro version of wptravel. We have the license key. It’s just the last problem we need to fix and our website will gonna complete.
November 14, 2019 at 12:22 pm #21303wensolutions
KeymasterHello @karankcoresys,
As for now, to resolve the issue please add below-given code inside the loop.
$term_featured_image_id = get_term_meta( $custom_term->ID, 'wp_travel_trip_type_image_id', true ); $image_url = wp_get_attachment_url( $term_featured_image_id );
Also, we cannot help you further regarding the code related issue as it may generate complex issues on client-side so we recommend you taking help from our professional developer.
Thank you.
November 16, 2019 at 1:56 pm #21341karankcoresys
ParticipantThank you for the reply, but it’s not worked, your plugin must have the taxonomy image display option.
i tried code but not worked.
please let me know how to use this code!
`<?php
$post_type = ‘itineraries’;
$custom_tax = ‘travel_locations’;
$custom_args = array(
‘parent’ => 0
);
$custom_terms = get_terms($custom_tax, $custom_args);
foreach($custom_terms as $custom_term) {
$term_link = get_term_link( $custom_term );
wp_reset_query();
$args = array(‘post_type’ => ‘itineraries’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘travel_locations’,
‘field’ => ‘slug’,
‘terms’ => $custom_term->slug,),
),
); ?>
<?php
$loop = new WP_Query($args);
if($loop->have_posts()) { ?>
<?php
while($loop->have_posts()) : $loop->the_post(); ?>
//some content here
<?php
endwhile;?>
<?php } }?>’November 18, 2019 at 6:37 am #21365Support Team
KeymasterHello @karankcoresys,
we are not sure you added the code in your side.
So please once replace your block of code with the code given below.
<?php $post_type = 'itineraries'; $custom_tax = 'travel_locations'; $custom_args = array( 'parent' => 0 ); $custom_terms = new WP_Term_Query(array( // use WP_Term_Query() for terms query instead of get_terms(). 'taxonomy' => $custom_tax , 'hide_empty' => false, )); foreach ($custom_terms->terms as $custom_term) { $term_link = get_term_link($custom_term); $term_featured_image_id = get_term_meta( $custom_term->term_id, 'wp_travel_trip_type_image_id', true ); // Gets id for thr current taxonomy term meta. $image_url = wp_get_attachment_url( $term_featured_image_id ); //THIS IS THE IMAGE URL YOU ARE LOOKING FOR. wp_reset_query(); $args = array( 'post_type' => $post_type, 'tax_query' => array( array( 'taxonomy' => 'travel_locations', 'field' => 'slug', 'terms' => $custom_term->slug ) ) ); ?> <?php $loop = new WP_Query($args); if ($loop->have_posts()) { ?> <?php while ($loop->have_posts()): $loop->the_post(); ?> //some content here <?php endwhile; ?> <?php } } ?>
Hope this helps.
Also, as mentioned in an earlier reply, helping with your code issues is beyond our support scope so we are unable to help you any further.
Thank you.
November 18, 2019 at 7:08 am #21366karankcoresys
ParticipantThank you for your reply!
I used this code, but it’s now showing an empty page. If my code issue is beyond the support. Just let me know how can I show all destinations on the page with the image in the grid style. please provide any shortcode, code or anything. I just want to show all locations/destinations on the page. Like this: http://rankonone.com/dev/westchina/destinations/, that will be ok if tours not come, just want to show destinations and image.
Thank you!
November 18, 2019 at 12:14 pm #21373Support Team
KeymasterHello @karankcoresys,
The code works fine on our side so you can just check the code properly and see what went wrong.
Further, You can use the shortcode for listing the trip as per the destination and for this refer to below given:
https://wptravel.io/documentations/user-documentation/#doc-shortcode-50
Thank you.
November 18, 2019 at 1:37 pm #21375karankcoresys
ParticipantHello,
Your code working like this: http://rankonone.com/dev/westchina/destinations-test/
Still no destination image.
I am talking about this: https://nimb.ws/VvBijL
November 19, 2019 at 4:43 am #21387Support Team
KeymasterHello @karankcoresys,
Can you please provide your admin login detail and FTP so that we can inspect the code in your side and find out the issues?
Email to send login detail:
Thank you.
November 20, 2019 at 5:20 am #21421karankcoresys
ParticipantThank you fix the problem! The support is so good!
November 20, 2019 at 5:23 am #21422November 20, 2019 at 5:44 am #21423Support Team
KeymasterHello @karankcoresys,
Thank you for the login detail.
When we tested your site we found that you have not used the code that we have provided. So we have added the code and fix the issue for you. Please verify the issue.
Also, we are unable to help you any further regarding the code issue so pease take help from the professional developer.
Thank you.
-
AuthorPosts
- The forum ‘WP Travel’ is closed to new topics and replies.