• Resolved mjdeangelis

    (@mjdeangelis)


    This plugin seems to work great. However, in one of my templates, making a call to get_the_category() doesn’t return anything for a page that is tagged with a category. Strangely, it only returns the applicable categories when logged in with an admin account (not, for example, a subscriber account).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author AccountClosed

    (@wistudatbe)

    Do you have this in all the templates or just one of it?
    Regards,
    Danny

    Plugin Author AccountClosed

    (@wistudatbe)

    Can you give me a copy of the code to display the categories?
    So i can test it on my site.
    Regards,
    Danny

    Plugin Author AccountClosed

    (@wistudatbe)

    Ok found it … ??
    for POSTS: get_the_category();
    for PAGES: get_the_terms( $post->ID, ‘categories’ );

    To avoid using 2 codes (pages and posts), use the shortcode: wudrelated
    can be used as follows:
    [wudrelated] = Displays all related post and/or pages.
    Extra parameters:
    [wudrelated max=”x”] where X is the maximum records to show
    [wudrelated flat=”1″] shows the post/pages next to each other instead as list
    [wudrelated title=”x”] shows a custom title instead the title entered in the admin page
    [wudrelated include=”category”] shows also the related categories
    The parameters can be mixed in one shortcode

    Optional parameters:
    [wudrelated type=”page”] = Displays all related pages
    [wudrelated type=”post”] = Displays all related posts.
    These parameters cannot be used together with the others.

    Explained here: https://wud-plugins.com/home/category-to-pages-how-to-use/

    Regards, Danny

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_the_category() not working for non-admin users’ is closed to new replies.