How to get Post Link and Post Subject?

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
Post Reply
Posts: 4
Joined: Thu May 07, 2020 9:30 am

How to get Post Link and Post Subject?

Post by marustiweb » Thu May 14, 2020 7:34 am

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

(with prettyurl on) or

Code: Select all

(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

User avatar
FlatPress Coder
Posts: 497
Joined: Sat Jan 26, 2019 7:40 pm

Re: How to get Post Link and Post Subject?

Post by Arvid » Tue Mar 23, 2021 12:34 pm

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:
<div class="admincontrols">
<span class="admin_id">{$id}</span>&nbsp;<a href="{$smarty.const.BLOG_BASEURL}admin.php?p=entry&amp;entry={$id}&amp;action=write"><img src="{$flatpress.themeurl}imgs/adminctrls/page_edit.png" alt="{$lang.main.btn_edit}" title="{$lang.main.btn_edit}" /></a>&nbsp;<a href="{$smarty.const.BLOG_BASEURL}admin.php?p=entry&amp;entry={$id}&amp;action=delete"><img src="{$flatpress.themeurl}imgs/adminctrls/page_delete.png" alt="{$lang.main.btn_delete}" title="{$lang.main.btn_delete}" /></a>

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,

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests