I modified the code a bit
<?php query_posts( 'tag=RIGHTHERE' );
while (have_posts()) : the_post();?>
<a href="<?php the_permalink(); ?>"><?php the_title() ?></a>
<?php endwhile; ?>
<?php wp_reset_query();?>
Hi Steelclover
Can you explain a bit more.
On what page do you want to do this?
Is this for the main query of the page?
If it’s the single post page you can get the post slug whith this:
<?php
$slug = $post->post_name;
echo $slug;
?>
The function query_posts() isn’t meant to be used by plugins or themes. Try to convert it to new WP_Query.
https://codex.wordpress.org/Function_Reference/WP_Query
<?php
$slug = $post->post_name;
$the_query = new WP_Query( 'tag=' . $slug );
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
Thanks for answering.
Example:
1 Post Location
1 Post Musical
1 Post Actor
I want to tag the actor with the musical and the location
i want to tag the musical with the actor and the location
i want to tag the location with the actor and the musical
so finally the
actor post displays in what musicals and which location he plays in.
location post displays what musical and actors plays in.
musical post displays what actor and location its played in.
Normally a Tag is written the same way as the post_slug. so it would be very easy to have all the related posts in my theme.
i know its hard to explain but i hope u understand what i am talking about.
Have you tried the code above?
It seems to me you want to have post to post relationships. Take a look at this plugin:
https://wordpress.org/plugins/posts-to-posts/