Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Flexform › Modify the portfolio-carousel.php to display custom post types
New Landing › How can we help? › Themeforest Theme Support › Flexform › Modify the portfolio-carousel.php to display custom post types
- This topic has 117 replies, 5 voices, and was last updated 11 years by Melanie – SUPPORT.
-
Posted in: Flexform
-
August 21, 2013 at 5:25 pm #17550This reply has been marked as private.August 21, 2013 at 5:42 pm #17551This reply has been marked as private.August 21, 2013 at 6:09 pm #17552
Hi Sam,
Sorry, didn’t check the code fully. Try this amended version, hopefully my edits work!
// Create a query for the custom taxonomy function related_posts_by_taxonomy( $post_id, $taxonomy, $args=array() ) { $query = new WP_Query(); $terms = wp_get_object_terms( $post_id, $taxonomy ); // Make sure we have terms from the current post if ( count( $terms ) ) { $post_ids = get_objects_in_term( $terms[0]->term_id, $taxonomy ); $post = get_post( $post_id ); $post_type = get_post_type( $post ); $args = wp_parse_args( $args, array( 'post_type' => $post_type, 'post__not_in' => array($post_id ), 'taxonomy' => $taxonomy ) ); $query = new WP_Query( $args ); } // Return our results in query form return $query; }
– Ed
August 21, 2013 at 6:19 pm #17555This reply has been marked as private.August 21, 2013 at 6:31 pm #17559This reply has been marked as private.August 21, 2013 at 6:39 pm #17562This reply has been marked as private.August 21, 2013 at 6:48 pm #17563This reply has been marked as private.August 22, 2013 at 11:30 am #17647Good afternoon Ed,
Thought id give it one last go myself – after some digging it turns out Pippin (easy content types) has a plugin called ‘related posts by taxonomy’ which supposedly provides the correct code for this and allows me to replace $related_posts_query->the_post(); with a simple echo pippin_related_posts();
This works but strangely the output is also a continuous stream in the same way the solution you provided yesterday!
I have disabled all plugins except: Easy Content Types, Custom Post Type Permalinks and Related Posts by Taxonomy.
I am not sure how to proceed – I could add echo pippin_related_posts(); to the 2013 theme to see if it works but that doesn’t really help me! …I have now contacted Pippin for some advice.
Thanks for all your help here Ed, if you do have any thoughts as to what may be causing this please do let me know.
Regards
Sam
August 23, 2013 at 9:42 am #17854Ed,
Think I was perhaps barking up the wrong tree and went off on a tangent!
I have gone back to the code you provided and it seems the continuous stream of thumbs likely indicates that the code is missing something…
$related_posts_query = related_posts_by_taxonomy( $post->ID, ‘article-category’ );
A. = a continuous stream of thumbnails of the current post – no related items present.
$related_posts_query = related_posts_by_taxonomy( $post->ID, ” );
B. = one thumb displayed – but this is the current post, not the related one.
So I finally admit defeat! lol – thanks for all your help on this Ed, can’t believe this little issue is such a tricky bugger!
So on that note let’s close this thread shall we as everything else is good and my migration begins Monday…
Have a great weekend!
Regards
Sam
August 23, 2013 at 11:47 am #17899ok, it comes down to this bit of the code for functions.php:
$args = wp_parse_args( $args, array(
‘post_type’ => $post_type,
‘post__not_in’ => array($post_id ),
‘taxonomy’ => $taxonomy
) );With it – the thumbnails of the current post are shown over and over again.
Without it – only one thumb of the current post shows – no related items.
This is the same behavior if I remove the ‘article-category’ part from the
$related_posts_query = related_posts_by_taxonomy( $post->ID, ‘article-category’ );
which replaces the original on line 247 of single.php
$related_posts_query->the_post();
So, I’m clearly no expert but I would say that the query is dodgy… perhaps Pippin will shine a light upon the situation.
Never mind, could be time for that developer I guess …and several beers for me!
Ciao ;0)
August 23, 2013 at 6:58 pm #17958This reply has been marked as private.August 26, 2013 at 10:18 am #18123This reply has been marked as private.August 28, 2013 at 11:48 am #18550Fantastic!
-
Posted in: Flexform
You must be logged in and have valid license to reply to this topic.