WordPress.org

Ready to get started?Download WordPress

Forums

Previous and Next Post in Same Taxonomy
[resolved] Warning: implode() [function.implode]: Line 68 (10 posts)

  1. Sina
    Member
    Posted 2 years ago #

    The plugin is returning this warning:

    Warning: implode() [function.implode]: Invalid arguments passed in \wp-content\plugins\previous-and-next-post-in-same-taxonomy\previous-and-next-post-in-same-taxonomy.php on line 68

    Line 68: $join .= " AND tt.taxonomy = '$taxonomy' AND tt.term_id IN (" . implode(',', $cat_array) . ")"

    Tested out on a clean version of 3.2.1 using TwentyEleven.

    The only mod to add custom taxonomies, activated through functions.php. No other plugins were enabled.

    Would love to see this working.

    http://wordpress.org/extend/plugins/previous-and-next-post-in-same-taxonomy/

  2. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    Can you post the code you're using in your theme? I just tested this plugin yesterday (testing all my plugins for 3.3) and it worked fine.

  3. Sina
    Member
    Posted 2 years ago #

    I'm sorry, I forgot to mention I am working locally.

    I just copied and pasted your sample to be sure and changed 'color' to my own taxonomy and it brings up the error.

    If I remove it and leave the empty, the error goes and it cycles through the category without a problem.

    Error
    <?php be_next_post_link('%link', '%title', true, 'mytaxonomy'); ?>

    Fine
    <?php be_next_post_link('%link', '%title', true, ''); ?>

    This is all I've added to functions.php

    add_action( 'init', 'my_taxonomies', 0 );
    function my_taxonomies() {
        register_taxonomy( 'my_taxonomies', 'post', array( 'hierarchical' => true, 'label' => 'My Taxonomies', 'query_var' => true, 'rewrite' => true ) );
    }

    No other changes. Thank you for responding, I really appreciate it.

  4. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    Your taxonomy is called 'my_taxonomy' but you're putting 'mytaxonomy' in the be_next_post_link() function. Can you try it with the proper taxonomy name?

  5. Sina
    Member
    Posted 2 years ago #

    Hi Bill,

    Sorry that was just an example. I'll double check everything again now.

  6. Sina
    Member
    Posted 2 years ago #

    I'm not sure what's happened but I made these edits and the error went away.

    Added a custom column function from a plugin into functions.php and
    saw that some posts weren't associated with the taxonomies. Added them in.
    Changed the taxonomy settings from hierachical from true to false and back again.
    There is no error but now but it's not working the way I understand it would.

    Say I have two categories: Buy | Sell

    I also have two custom taxonomies: New | Old

    My navigation is:

    <?php be_previous_post_link('%link', '%title', true, 'new'); ?>
    <?php be_next_post_link('%link', '%title', true, 'new'); ?>

    So if I'm the Buy category, looking at a post associated with the taxonomy "New".

    I understand that I should be able to continue navigating in the category Buy and through posts associated with New.

    Am I missing something?

  7. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    I think you're confused by some terminology. Taxonomy is an organizational structure. 'category' and 'post_tag' are built-in taxonomies, but you can add your own. I'm going to call the custom taxonomy you make 'status'.

    Inside a taxonomy you have taxonomy terms. The 'category' taxonomy might have 'buy' and 'sell' as terms. The 'status' taxonomy might have 'new' and 'old' as terms.

    The previous_post_link/next_post_link functions in WordPress have an option to limit it to the same category. So if you use:

    previous_post_link( '%link', '%title', true, '' );

    When viewing a post in the Buy category, the previous/next posts would also be in the Buy category.

    I've created functions that let you specify a taxonomy other than category. So if you use:

    be_previous_post_link( '%link', '%title', true, '', 'status' );

    When viewing a post in the New term of the Status taxonomy, the previous/next posts would also be in the New taxonomy term.

    This does NOT find intersections between categories and taxonomies (posts in Buy and in New). This only allows the "in same category" option to apply to taxonomies other than category.

  8. Sina
    Member
    Posted 2 years ago #

    So it basically allows you to specify something other than a standard category, but you can't limit it to both the current category and specify custom taxomony with the previous_post_link etc. That's what I thought the plugin enabled. I think the confusion was more in regards to the in_same_cat parameter rather than the taxonomies.

    I also just realised the navigation I inserted about was wrong. I'd left out fourth parameter ''. I'm still returning the error locally, but I'll test it out live when I get a moment.

    Thank you again for taking the time to explain it.

  9. Sina
    Member
    Posted 2 years ago #

    The error is a user error (mine), but it returns the error if you don't put the correct taxonomy in, I put in the terms and it caused the error. (Refer to Bill's post above regarding.)

  10. Levdbas
    Member
    Posted 2 years ago #

    Hi, I having a question very related to this problem:
    I got a taxonomy called: specialties with terms like online and design.
    Now I have a posttype cases which is linked to this taxonomy. But, as soon as I navigate to a post with multiple terms something goes wrong. When navigating the Online term everything is fine until the post with also the taxonomy Design and all the links after that case are in the design term.

    Am I missing something here? :(

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic