WordPress.org

Ready to get started?Download WordPress

Forums

Ambrosite Next/Previous Post Link Plus
Echoing "x of y" and category title? (7 posts)

  1. anielsen
    Member
    Posted 2 years ago #

    First I want to say great plugin and even better support! Thanks a lot and keep it up!

    I was wondering if this is possible in it's current form or maybe with an update down the line, but I would love to do an "x of y" type indicator. So it would read something like this:

    << Previous | 1 of 12 | Next >>

    With the "1 of 12" indicating you are viewing post 1 of the 12 that are in the current category. The 1 of 12 would just be straight text, not links or anything.

    Also, I would really like it to show the name of the category it is in that this plugin is keying on. So if you have in_same_cat set to true, ex_cats_method set to diff and you list all the categories you want it to ignore in ex_cats that should only leave one category it is looping through, if this plugin could list the name of that category (not it's ID) that would be awesome! So something like this:

    << Previous | Trip to Florida | Next >>

    And if I were to dream big, I would love both of my requests together so something like this:

    << Previous | 1 of 12 in Trip to Florida | Next >>

    http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/

  2. ambrosite
    Member
    Plugin Author

    Posted 2 years ago #

    That request has already been made:

    http://wordpress.org/support/topic/echo-current-post-number

    As I explained in the other thread, I would have to add a new function called current_post_link_plus in order to enable that feature. It would require a fairly substantial rewrite of the existing code, but it is possible. I have it on the list of features to be considered for a future release.

  3. anielsen
    Member
    Posted 2 years ago #

    Thanks for the reply and I can understand why "x of y" isn't currently possible, but is it possible to echo the name of the category that the plugin has keyed in on for the Next/Previous?

    I tried messing around with the 'return' => 'object' and 'return' => 'output' but they both just returned nothing/blank.

  4. ambrosite
    Member
    Plugin Author

    Posted 2 years ago #

    Have you tried using the %category variable in the 'format' parameter?

    If you want to return the category from the function, it is possible by making a small hack to the plugin code.

  5. anielsen
    Member
    Posted 2 years ago #

    Thanks for the tip!

    Just tried it and it works, except it doesn't seem to honor the ex_cats list. So if a Post is in 6 different categories and 5 of those are in the ex_cats list I want it to only show the one left over category.

    And in addition to the ex_cats, I would hope that it would honor the in_same_cat and ex_cats_method values to further limit the resulting category names.

    I wish I knew more PHP so I could look at the code and a) figure out if this was even possible and b) help make it possible :-/

  6. ambrosite
    Member
    Plugin Author

    Posted 2 years ago #

    No, it doesn't honor in_same_cat or ex_cats. The %category variable is implemented using the function get_the_term_list, which returns a simple PHP string of the post terms (categories and custom taxonomies).

    In order to do what you ask, I would have to rewrite that part of the code using wp_get_object_terms, which returns an array of term objects. It might then be possible to filter that array based on in_same_cat and ex_cats.

    I was just looking over the code, and I don't think it would be too difficult a change, so I may try to implement it the next time I update the plugin. Good suggestion.

  7. ambrosite
    Member
    Plugin Author

    Posted 2 years ago #

    By the way, I'll probably start working on the new version as soon as the WP 3.4 release candidate comes out, so if you have any interest in beta testing it, contact me off forum and I'll send it to you when it is ready.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic