• When

    $in_same_term = true

    when using the get_next_post and get_previous_post functions, and the current post has several parent categories and several child catgeories:

    – will the function pick the next/previous post only from the current posts parent categories or will it also consider child categories?

    – if the post has several categories, let’s say: first, second and third category (both parent and child categories), will it choose a post from all 3 categories, or only from the first?

    And if the current post has categories A and B, then will an other post that has the categories A and B have priority in the next/prev choice, even if its publish date falls further away than let’s say an other post, that has categories A and C?

    And is there any difference in the choices of the functions in comparison, when using get_next_post & get_previous_post, get_adjacent_post and get_{$adjacent}_post_where ?

Viewing 3 replies - 61 through 63 (of 63 total)
  • Moderator bcworkz

    (@bcworkz)

    Right, but it depends on what they change. The only change that would effect what you have is the specific link HTML and its related CSS. Even then, you could choose to continue to use your shortcode and the related CSS unchanged regardless of what they change. It doesn’t utilize any other theme resources, it’s essentially a stand-alone drop-in replacement. At worst you may need to add some CSS if theirs changes.

    And if you did choose to incorporate their changes, your PHP would remain the same, you’d only replace the static HTML strings.

    I don’t remember at this point where you placed your PHP code. Do you have a child theme or plugin where it resides? You should, then your code will be protected from being overwritten. I assumed in my above comments that it’s somewhere safe. If you do need to move your code out of the primary theme, it can reside in a custom plugin. They are easier to create than a child theme, provided you’re not altering theme templates.
    https://developer.www.ads-software.com/plugins/plugin-basics/#getting-started

    The Unix command line stuff in the linked section looks a little scary, but it’s not necessary. I’ve always created plugin files locally and then uploaded the file via FTP or the hosting file manager.

    Thread Starter berry metal

    (@erikalleman)

    I do have a child theme (readily provided by the theme developer), and the code is in the functions.php of my child theme.

    Then everything is all right, thanks!

    Moderator bcworkz

    (@bcworkz)

    You’re welcome. Enjoy the custom functionality you created ??

Viewing 3 replies - 61 through 63 (of 63 total)
  • The topic ‘get_next_post options’ is closed to new replies.