I’m asking for some help here, as I wasn’t able to find any answer in the WP Support forum.
My site has 3 different sessions for organizing the content. One is the “BLOG”. The lother two are “PORTFOLIO” and “ARTIGOS”, where I put some projects I developed as a designer, and some articles I wrote as a professor. Each session has it’s own template, where it lists all the posts that are categorized as “portfolio” or “artigos” – this way I manage to exclude them from the “blog”, and to show only the posts corresponding to each category on the specific category page, and a specific “single” page (so I can use different sidebars, different menu itens etc.).
Here comes the tricky part.
Some projects, as well as some articles, has links to other stuff. For instance, if the project is about a website, it has a link to it. An article could also have a link to a PDF version, whatsoever.
I wanted these links to appears in a separeted column, separated from the text. I’ve created a sidebar for each template, to put this stuff. On this sidebar I’ve created a “link” session, to show the links related to the post.
As the content is dinamic, I wanted to show the “links” session of the sidebar ONLY if the post showing on the singlepage has links. As I had no idea on how to do this, I’ve used the “link manager” to create the links to theses files (PDFs, URLs for other sites etc.). I’ve also created link-categories with the name of the projects and articles.
By making this link-categories with the same name of the project and article titles, I’ve used the get_liknksbyname combined with the get_the_title to create a list, with the comands bellow:
‘<li class=”menu”>’, ‘
FALSE, ‘id’, TRUE, FALSE, -1, TRUE);?>
It works fine, UNLESS…in case there is not a linkname corresponding to the title of the page,
here are some examples:
(posts that have links-categories with the same name as the post title)
(post that has no links-category with the same name as the post title)
As you can see, in the 3rd case, where there isn’t a link-category name equals to the title of the post, the list is generated as if the “cat-name” parameter in the “get_linksbyname” tag is null, showing all the links that exists.
What I wanted is to create a way to check this before going through the “get_linksbyname” function. So, first I should be able to check if there is a link-category equals to “the_title” of the post. In that case, it would follow the script. Otherwise, it wouldn’t even show the component to start with.
Is this possible? I’m sure there is better ways to do this, but this is the way I was able to come with by myself…if only I could do this check, I think it would work…all solutions I’ve found in the support forum needed to put a specific category. As the element is dinamic, it wouldn’t work if I put it manually – it would result always the same list of links.
I would really appreciate some help with this!
I’m using WP 2.2.1, by the way. 🙂
Forgive me for my english. 🙂
thanks in advance!!!