• Resolved bsmolyanov

    (@bsmolyanov)


    Hello and congrats for the excellent plugin!

    We use the post-to-post functionality and it seems to work very well.

    Is there a way to display additional information about the connected posts using the shortcode, e.g. connected post excerpt and author?

    So far we get list of post titles, including links.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @bsmolyanov ,

    Thanks for your kind words!

    Yes, it’s possible to output other details of the connected posts. If you use a snippet that is similar to the documentation, then you can see, it’s just a standard WordPress loop. So you can use normal WordPress functions such as “the_title()” and “the_content()” to output these details.

    Thread Starter bsmolyanov

    (@bsmolyanov)

    Thank you so much for your reply. We need a bit more hand here.

    We use this code in the functions.php file:

    add_action( 'mb_relationships_init', function() {
        MB_Relationships_API::register( [
            'id'         => 'posts_to_pages',
            'from'       => 'post',
            'to'         => 'post',
        ] );
    } );

    and we use this shortcodes in the body of the post:

    [mb_relationships id="posts_to_pages" direction="from" mode="ul"]
    [mb_relationships id="posts_to_pages" direction="to" mode="ul"]

    These settings provide nice list of ‘from’ and ‘to’ post titles, whicih include links to the specific posts.

    We just need to display the posts excerpts below each post title.

    Do we need to add something in the functions.php file or do we need to add something to the shortcode? If yes, could you please write it.

    Maybe something like this, but where to put it if its correct at all?

    <?php
    $my_excerpt = get_the_excerpt();
    echo $my_excerpt;
    ?>

    Thank you very much!

    • This reply was modified 4 years, 8 months ago by bsmolyanov.
    • This reply was modified 4 years, 8 months ago by bsmolyanov.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode – additional parameters’ is closed to new replies.