We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Blog

No Author for certain blog posts

Hi

I'm trying to omit the author name from some posts, so I've added the following to my post.html template;

<perch:blog type="checkbox" id="noauthor" value="1" label="Check for no author" suppress="true" />
<perch:if not-exists="noauthor">
        by <a href="/article/archive.php?author=<perch:blog id="authorSlug" type="hidden" />"><span class="p-author h-card"><perch:blog id="authorGivenName" type="hidden" /> <perch:blog id="authorFamilyName" type="hidden" /></span></a>
</perch:if>

Which when checked doesn't display the author name, so is working as expected.

I'm trying to use the same checkbox to not display the Authors details at the bottom of the post, so I've tried the following on the post.php (along with a few other things), but can get it to hide.

<?php
    perch_blog_author_for_post(perch_get('s'), array(
        'template' => 'author.html',
        'filter' => 'noauthor',
        'match' => 'neq',
    ));
?>

I'm not sure what to try next. Does anyone have any pointers?

Thanks Wayne

SUMMARY INFORMATION

Perch: 2.8.26, PHP: 5.4.45, MySQL: 5.5.46, with MySQLi
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.26), assets (2.8.26), categories (2.8.26), perch_blog (5.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/genx/public_html/perch
PERCH_CORE: /home/genx/public_html/perch/core
PERCH_RESFILEPATH: /home/genx/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 25M, Max POST 128M, Memory: 128M, Total max file upload: 25M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
DOCUMENT_ROOT: /home/genx/public_html
HTTP_HOST: www.genx.media
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Wayne Hooper

Wayne Hooper 6 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you'll need to use perch_blog_post_field() to get the value of the field from your post, and then use that to conditionally display the author.