I solved my problem by automatically adding the tag ‘light’ to all my projects. And then query all the post and projects with the light tag like this:
Query post by taxonomy tag ‘light’:
$args = array(
'post_type' => array( 'projects' , 'post' ),
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'post_tag',
'field' => 'name',
'terms' => 'light'
)
),
'post_status' => 'publish'
);
query_posts( $args );
Add tag ‘light’ to all projects on publish:
add_action('publish_projects', 'projects_post_type_tagging', 10, 2);
function projects_post_type_tagging($post_id, $post){
wp_set_post_terms( $post_id, 'light', 'post_tag', true );
}
It’s not the most elegant solution but it works. If theres a better way to solve this problem i’ve would like to know.