WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Ambrosite Next/Previous Post Link Plus] custom meta key value

[Resolved] [Plugin: Ambrosite Next/Previous Post Link Plus] custom meta key value

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author ambrosite
    Participant

    @ambrosite

    Yes, that is possible if you are doing a custom sort on the ‘Work’ meta key (which I assume you are). The function call would look something like this:

    next_post_link_plus( array('order_by' => 'custom', 'meta_key' => 'work', 'link' => 'Next: Work %meta %title', 'format' => '%link') );

    offpeakdesign
    Member

    @offpeakdesign

    Thank you! That was what I was looking to do.

    I’m hoping you could help me just a little bit more.

    My original nav code looks very different to me and I’m not sure how to integrate it with what you’ve shared. I want to keep the original formatting, but to insert the ‘work’ meta key just before the post title with a dash in between.

    Here’s the original code:

    <?php previous_post_link( '<div class="previous">' . __( '%link', 'hatch-pro' ) . '</div>', '<span class="post-nav-text">← Previous:</span> %title' ); ?>
    <?php next_post_link( '<div class="next">' . __( '%link', 'hatch-pro' ) . '</div>', '<span class="post-nav-text">→ Next:</span> %title' ); ?>
    Plugin Author ambrosite
    Participant

    @ambrosite

    Try this:

    <?php previous_post_link_plus( array('order_by' => 'custom', 'meta_key' => 'work', 'link' => '<span class="post-nav-text">? Previous:</span> Work %meta - %title', 'format' => '<div class="previous">' . __( '%link', 'hatch-pro' ) . '</div>') ); ?>
    <?php next_post_link_plus( array('order_by' => 'custom', 'meta_key' => 'work', 'link' => '<span class="post-nav-text">? Next:</span> Work %meta - %title', 'format' => '<div class="next">' . __( '%link', 'hatch-pro' ) . '</div>') ); ?>
    offpeakdesign
    Member

    @offpeakdesign

    genius. Thank you thank you thank you.

    Plugin Author ambrosite
    Participant

    @ambrosite

    I assume it worked then. 🙂 Would you be so kind as to mark this thread resolved?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: Ambrosite Next/Previous Post Link Plus] custom meta key value’ is closed to new replies.