PHP slug?
-
I am wanting display a link within the entry head of each post like this: https://domain.com/folder/some-category/postname
What I need is the slug (with the category) folder. I just want to add my own “https://domain.com/” in front of it. The reason I am doing this is because I would like them to have the discussion on the post in the forums (not in WordPress) instead of in the ‘comments section’.
I will keep the directory structure and post name same. I am using permalinks and so my usual post links appear like this: https://domain.com/hello/how-are-you/
This is the code that I have so far, it gets me to:
https://domain.com/hello/ I see need the post slug at the end.<?php foreach((get_the_category()) as $category) { echo '<a href="https://xxx.com/forum/' . $category->category_nicename . '/" alt="' . $category->cat_name . '" />'; } ?>Forum</a>
I really hope someone can figure this out. Thanks!
- The topic ‘PHP slug?’ is closed to new replies.