Page 1 of 1
How to get Post Link and Post Subject?
Posted: Thu May 14, 2020 7:34 am
by marustiweb
I'm trying to get into FP plugins but i'm a bit stuck right now.
1) Post link
I tried get_permalink($id) but what i'm getting back is
Code: Select all
http://localhost/flatpress-1.1/20///welcome-to-flatpress/
(with prettyurl on) or
Code: Select all
http://localhost/flatpress-1.1/?x=entry:
(prettyurl off). I'm clearly missing something but i right now i have no idea what.
2) post subject
Couldnt find anything so far
Can someone pls. point me into the correct direction? Thanks
Re: How to get Post Link and Post Subject?
Posted: Tue Mar 23, 2021 12:34 pm
by Arvid
Argh, totally missed that one
get_permalink() is the right way to go, the
Internal URLs plugin also utilizes this function. Do you have a valid entry ID in the format 'entry210228-104517'?
When I started using the Internal URLs plugin, I wondered how to display the entry ID in my theme, so I wouldn't have to cut it out of admin area URLs.
PieroVDFN helped me out there, since then I have the {$id} as part of my entry admin controls. In my case in
fp-interface/sharedtpls/entryadminctrls.tpl:
{admincontrols}
<div class="admincontrols">
<span class="admin_id">{$id}</span> <a href="{$smarty.const.BLOG_BASEURL}admin.php?p=entry&entry={$id}&action=write"><img src="{$flatpress.themeurl}imgs/adminctrls/page_edit.png" alt="{$lang.main.btn_edit}" title="{$lang.main.btn_edit}" /></a> <a href="{$smarty.const.BLOG_BASEURL}admin.php?p=entry&entry={$id}&action=delete"><img src="{$flatpress.themeurl}imgs/adminctrls/page_delete.png" alt="{$lang.main.btn_delete}" title="{$lang.main.btn_delete}" /></a>
</div>
{/admincontrols}
To get the subject of an entry, use:
Code: Select all
$entryID = 'entry210228-104517';
$entry = entry_parse($entryID);
$subject = $entry ['subject'];
Let me know if that works for you!
All the best,
Arvid