Frontend display of all linked posts in multiple relationships

Support MB Relationships Frontend display of all linked posts in multiple relationshipsResolved

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12611
    Max ElmanMax Elman
    Participant

    This site has CPT "attorney" with multiple linked CPTs "legal news", "events", "alerts", "articles". I currently have them all displaying in separate lists here: https://cooperwhitecooper.kinsta.com/attorney/sarah-j-banola/

    I'd like to combine the lists for "alerts", "articles", and "legal news" and have them display together in chronological order. How can I combine multiple relationship queries like that?

    Thanks!

    #12616
    FarheenFarheen
    Participant

    Hello Max

    Can you please share your code here.

    you want to be able to add “alerts”, “articles”, and “legal news” separately and display them together, is that what you want?

    Thanks

    #12630
    Max ElmanMax Elman
    Participant

    Correct. Current registration code:

    https://ghostbin.com/paste/9x8jp

    #12730
    Max ElmanMax Elman
    Participant

    Hi there - Any chance someone can help resolve this? Thanks!

    #12731
    Anh TranAnh Tran
    Keymaster

    Hi Max,

    The current version doesn't support query from multiple relationships at once. However, there's a workaround. You can make a raw query to get all your connected posts like this:

    https://ghostbin.com/paste/9gfhe

    #12744
    Max ElmanMax Elman
    Participant

    Thanks! This looks close, but breaks the page and throws errors:
    2018/12/20 01:25:39 [error] 61905#61905: *18816 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function wpdb::prepare(), 1 passed in /www/cooperwhitecooper_161/public/wp-content/themes/cooper-white-cooper/functions.php on line 186 and exactly 2 expected in /www/cooperwhitecooper_161/public/wp-includes/wp-db.php:1222

    Guessing that the << code >> elements shouldn't be within that wpdb->prepare statement? Can you check that?

    #12747
    Anh TranAnh Tran
    Keymaster

    I've updated the snippet, can you try again?

    #12748
    Max ElmanMax Elman
    Participant

    That worked, thank you!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.