I’m going to admit, im not quite sure how to do this. Although I do have enough coding skill to understand the explanation.
I have created a randomly generated thumbnail gallery of posts that exist withing a custom post type called “projects”. When you click on the thumbnail it takes you to the post page where you can view a video and underneath is a sortable thumbnail gallery for the custom post type “projects”. The sort feature works off of the posts tags.
I require a function that will display 1 single tag slug of the post that the thumbnail has been generated for so when the thumbnail is clicked the sortable gallery on the post page will auto sort to the tag slug of the clicked thumbnail.
The url needs to look something like this:
Thank you very much for your help.
I thought I was following your explanation until the sample URL. To show a single post from the random thumbs which has the video, the link should be something like
hxxp://example.com/projects/cpt-projects-slug(the hxxp is intentional as I hate the auto linkifying ‘feature’). So to pass the tag in the link, the URL would have to be more like
hxxp://example.com/projects/cpt-projects-slug/#thumbnail-tag-here, which will load the single post with a video and allow the thumbs below to be sorted by #thumbnail-tag-here.
If that is not your intention, I’m afraid you will need to try to explain again. I’m also unclear where the tag value is coming from. If it’s from the post, why pass it as an URL parameter? It is attached to the post, so just grab the value from the current post object and sort the thumbs accordingly. Since there’s possibly multiple tags, what ever logic was used to assign a particular tag to the link from the random thumb could be used on the single post page to sort the thumbs there.
In any case, it is possible to pass a value in the permalink as illustrated using the Rewrite API, though it would be a bit easier to simply format the URL with the tag as an actual parameter, as in
- The topic ‘Trying to display a single tag slug for my post’ is closed to new replies.