Directory plugin - different url when compared to printing permalink

Hi all
I am running WP3.4 and Directorys Plugin.
I have a menu tab for Musicians which points to
http://www.mysite.com/listings-category/musicians.
This page shows all the posts under the musicians listing category.
I have another listing-category/music-venue page, which runs off the same archive.php template, but which shows different posts (all the music venues); so far so good.
Now I want to include a sentence at the top of each post archive listing; such as "This is the a listing of musicians...etc..."
But I've tried several methods, including looking for at if tag_ID, if category, if taxonomy ...etc. I eventually decided to simply look for the word 'musician' directly within the URL so went for:
if (strpos($_SERVER['PHP_SELF'],'musician')===true) { echo 'Working'; } ?>
yet still that didn't work. In desperation I ran the php code:
<?php
print(the_permalink());
?>
and to my horror it returned a different url!
Instead of mysite.com/listings-category/musician it returned
mysite.com/listings/nexcyx (where nexcyx was the last musician listing I created).
Equally if I now go to the 'music venue' page, it too returns the url for the last music venue listing I created.
Can you explain to me why it is doing this?
And can you tell me how I can differentiate between the two listings-category archive pages? I obviously can't use these URL's as they will change every time I add someone in.
Thanks
Robert

  • aecnu

    Greetings Robert,

    Thank you for these great questions and bringing these significant issues to our attention.

    Though your questions are not directly related to the normal functioning of the plugin nor its intended use, I am inclined to see if I can get the lead developer of the Directory plugin in here to possibly answer these questions but only after you confirm you are indeed running the latest update to the plugin Version 2.1.1.6

    Please advise.

    Cheers, Joe

  • Robert

    Hi Arnold and Aecnu.
    I apologise - I hadn't seen your responses until now as I'd forgotten to tick the follow up by email box.

    Thanks for your help - I have found a way now.

    Arnold, I had tried
    if( has_term('musicians', 'listings_category') )

    but this didn't work and I think it is because I am in an Archive page, rather than a listings-category page.

    However, the following code does work, so thank for the tip.

    <?php if($_SERVER['REQUEST_URI'] == '/listings-category/musician/') {
    do something;
    }
     ?>

    Thanks again for all your assistance. Once I've finished I'll put an article together so you can see what I've been aiming for; and hopefully it may help someone else in the future too.

    Thanks
    Robert

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.