• First off this plugin is a god-send. Love it. I’m having the following issue that I’m hoping you can help me with.

    I’m trying to loop through posts of a custom post type but I only want to display those posts where the viewer is the author. I’ve tried [is author] inside of the CPT loop but that seems to loop through all posts and pages where the viewer is the author and seems to ignore the parent loop for only the specified CPT. Can you recommend a solution? Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Use the [pass] shortcode to pass the id of the current user to the the author parameter of the loop.

    Peter

    Thread Starter y2gabs

    (@y2gabs)

    Thanks Peter! So would it look something like this?
    [Pass id=get_current_id]
    [loop author=id]

    Sorry for the noobness, I’m barely scratching the surface of the advanced stuff with this plugin.

    Thanks again!

    Did you take a look at the reference of the [pass] shortcode (Settings > Custom Content > Advanced)? It is easy to ask, but you will learn more if you try to find it out by yourself.

    Try something like this:

    [pass user_field=id]
    [loop type=yourcptname count=5 author={USER_FIELD} list=true]
    [field title]
    [/loop]
    [/pass]

    Peter

    Thread Starter y2gabs

    (@y2gabs)

    thanks Peter! This worked. I definitely read and re-read the advanced documentation but I was hung up on passing something referencing the author in the pass argument rather than the user and passing that user to the loop.

    Thanks again.

    Thread Starter y2gabs

    (@y2gabs)

    Hi Peter, I was able to successfully get this working to display those posts where the logged in user is the author. Is it possible to use the same [pass] parameters to filter for bp_displayed_user_id instead and display a list of a displayed user’s posts on their buddypress profile page?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘custom post type and is author’ is closed to new replies.