Re: How to list content relevant to a logged-in member’s interests (WAS: 1.2.6 upgrade – xprofile_get_fi
Have cleaned up the code and plugged in the code suggested by @hnla – gets rid of the need for implode/explode and also allows for the list of tags from the member profile to be live:
`
<?php //for use in the loop, list 5 post titles related to user profile interest areas
$backup = $post; // backup the current object
//Fetch profile tags from custom field ‘Areas of Interest’
$profileTagFull = xprofile_get_field_data( ’25’ , bp_loggedin_user_id() );//Fetch the text for the tags
$profileargs=array(
‘tag_slug__in’ => $profileTagFull,
‘post__not_in’ => array($post->ID),
‘showposts’=>5,
‘orderby’ => rand,
‘order’ => DESC,
‘caller_get_posts’=>1
);
?>
Content of Interest
- <a href="tag/”>
-
<?php
- cat_name . ‘: ‘; ?><a href="” rel=”bookmark” title=””>
- No related content
$profile_query = new WP_Query($profileargs);
if( $profile_query->have_posts() ) {
while ($profile_query->have_posts()) : $profile_query->the_post(); ?>
<?php endwhile;
} else { ?>
<?php }
$post = $orig_post;
wp_reset_query();
?>
`
This is my CSS for the run-in list:
`
.comma-list ul, .comma-list li {
color: #ffffff;
font-size: 10px;
text-transform: uppercase;
display: inline;
line-height: 12px;
}
.comma-list li {
text-decoration: underline;
}
`
Looks a lot neater now – thanks!