WordPress.org

Ready to get started?Download WordPress

Forums

More conditional tags? (5 posts)

  1. Michael_
    Member
    Posted 8 years ago #

    Conditional Tags are quite helpful, but I am missing some tags there, e.g. comments_open(), pings_open() or have_posts().
    Do they just miss or is there another page available?

    I have searched, but could not find a list of all these tags.

    Currently I need to know if a user is permitted to edit a post (similar to edit_post_link() but this does not return true/false).

    Thanks,
    Michael

  2. Joshua Sigar
    Member
    Posted 8 years ago #

    If they prove to be used a lot, template tags will be added by developers. None of you suggested above is really popular at all.

    But you can always whip up your own function. Just find the function edit_post_link() in the source code and rip it off.

    The following is a portion of edit_post_link() which you can use/tailor for your purpose.

    <?php
    get_currentuserinfo();

    if (user_can_edit_post($user_ID, $post->ID)) {
    // current user can edit this post
    }
    ?>

  3. And here's the other two:

    comments_open() = $post->comment_status
    pings_open() = $post->ping_status

  4. Michael_
    Member
    Posted 8 years ago #

    Thanks for your responses.
    My apologies, I did not want the developers to add new conditional tags, I just was wondering if more conditional tags exist that are not mentioned in the codex.
    E.g. comments_open(), pings_open() or have_posts() are existing functions (at least on WP 2.0) and are being used by the default theme and/or the classic theme. So I was wondering:
    - Do more conditional tags exist that are not listed in the codex Conditional Tags page
    - Is there any other list of such functions somewhere available?

    Thanks,
    Michael

  5. Joshua Sigar
    Member
    Posted 8 years ago #

    I could only suggest that you look at the source code.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags