Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
636 views
in Plugins by

I am developing a page plugin currently.

I get the question ids ("postid") from a separate table.

Now I would like to create correct links by using only the postid (the question number).

Problem is, the default function:

function qa_q_path($questionid, $title, $absolute=false, $showtype=null, $showid=null)

is expecting a $title that I do not have. I only have the postid.

 

1. What is the current way to solve this? An extra DB-query?

2. Why is there no core function that retrieves the title automatically by just throwing in the postid?

Thanks,
Kai

Q2A version: 1.6.2

1 Answer

0 votes
by

>1. What is the current way to solve this? An extra DB-query?

We can get path without title.

rtrim(qa_q_path($postid, '', $absFlag), '/');

>2. Why is there no core function that retrieves the title automatically by just throwing in the postid?

Path without title is also right. Because friendly URL with title is aimed for SEO, title will not be supplemented in function. We can remodel this function to like it by overriding in plugin. However, there will be need to improve this function (e.g: Adding "$furl=true" parameter as last argument of function).

...